This commit is contained in:
Sebastian Wiedenroth 2012-09-02 14:59:49 +02:00
parent d80e08f2c9
commit 633c125d51
3 changed files with 20 additions and 3 deletions

View file

@ -1,11 +1,12 @@
var ease = require('./easing.js').ease var ease = require('./easing.js').ease
var resolution = 30; var resolution = 25;
exports.Anim = function(universe) { exports.Anim = function(universe) {
this.universe = universe; this.universe = universe;
this.fx_stack = []; this.fx_stack = [];
this.add = function(to, duration, options) { this.add = function(to, duration, options) {
var options = options || {}; var options = options || {};
var duration = duration || resolution;
options['easing'] = options['easing'] || 'linear'; options['easing'] = options['easing'] || 'linear';
this.fx_stack.push({'to': to, 'duration': duration, 'options': options}); this.fx_stack.push({'to': to, 'duration': duration, 'options': options});
return this; return this;

16
dmx.js
View file

@ -17,4 +17,20 @@ var x = new A(universe)
.add({1: 255}, 200) .add({1: 255}, 200)
.add({1: 0}, 100) .add({1: 0}, 100)
.add({1: 255}, 100) .add({1: 255}, 100)
.add({1: 0})
.delay(50)
.add({1: 255})
.delay(50)
.add({1: 0})
.delay(50)
.add({1: 255})
.delay(50)
.add({1: 0})
.delay(50)
.add({1: 255})
.delay(50)
.add({1: 0})
.run(done);
var y = new A(universe)
.add({9: 255}, 10000)
.run(done); .run(done);

View file

@ -49,7 +49,7 @@ exports.init = function(dev_id) {
setInterval(function() { setInterval(function() {
send_universe(dev, universe); send_universe(dev, universe);
}, 30); }, 25);
return this; return this;
} }