change animation api: set universe when calling run

This commit is contained in:
Max Stockner 2013-07-31 11:54:18 +02:00
parent 9f16f2ed67
commit 645773b09c
2 changed files with 6 additions and 7 deletions

View file

@ -1,8 +1,7 @@
var ease = require('./easing.js').ease var ease = require('./easing.js').ease
var resolution = 25; var resolution = 25;
exports.Anim = function(universe) { exports.Anim = function() {
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 || {};
@ -14,7 +13,7 @@ exports.Anim = function(universe) {
this.delay = function(duration) { this.delay = function(duration) {
return this.add({}, duration); return this.add({}, duration);
} }
this.run = function(onFinish) { this.run = function(universe, onFinish) {
var config = {} var config = {}
, t = 0 , t = 0
, d = 0 , d = 0

View file

@ -43,7 +43,7 @@ green_water(universe, [3+15, 6+15, 9+15], 4000);
return; return;
var x = new A(universe) var x = new A()
.add({1: 255, 6: 110, 7: 255, 8: 10}, 1200) .add({1: 255, 6: 110, 7: 255, 8: 10}, 1200)
.delay(1000) .delay(1000)
.add({1: 0}, 600) .add({1: 0}, 600)
@ -71,8 +71,8 @@ var x = new A(universe)
.delay(200) .delay(200)
.add({2: 0}); .add({2: 0});
var y = new A(universe) var y = new A()
.add({9: 255}, 10000); .add({9: 255}, 10000);
x.run(done); x.run(universe, done);
y.run(done); y.run(universe, done);