Permalink
Browse files

Add: hsv based animation to readme

  • Loading branch information...
1 parent 580131b commit f3fd0b355ad05a40b1c74af5be671d788f40f130 @tmpvar committed Aug 17, 2012
Showing with 18 additions and 3 deletions.
  1. +18 −3 README.md
View
21 README.md
@@ -10,17 +10,17 @@
`tpad(index, color)` - change the color of a pad
-`tpad.color('#FF0')` or `tpad('F00')` - set the color of all the leds
+`tpad.color('#FF0')` - set the color of all the leds
##### pad operations
`tpad(index)` - get a pad
`tpad(index).on([pressure,press,depress], function(pad) {})` - bind to events
-`tpad(index).color('#fff');` - change the color of an individual pad
+`tpad(index).color('#fff');` - change the color of an individual button
-`tpad(0).on('pressure', function(p) { p.color(color().hsv((p.value/18000)*360, 100, 100)); })` - change the color of pad[0] based on the amount of pressure applied
+`tpad(0).on('pressure', function(p) { p.color(color().hsv((p.value/18000)*360, 100, 100)); })` - change the color of button[0] based on the amount of pressure applied
##### pre-baked functionality
@@ -35,6 +35,21 @@ tpad.animate(milliseconds, [0,1,2,3], function(pad) {
});
```
+or shift on hsv!
+
+```javascript
+
+var a = 0;
+tpad.animate(100, [0,1,3,2], function(p) {
+ a+=70;
+ if(a>360) {
+ a=0;
+ }
+
+ p.color(color().hsv(a, 100, 100));
+});
+```
+
and to stop the animation `tpad.stop()`
calling `tpad.animate` again will first stop the currently running animation

0 comments on commit f3fd0b3

Please sign in to comment.