fixed small bug related to animations - if you called .start() multiple times, multiple animation instances would be created. This wasn't desirable. Also beefed up animation unit tests

This commit is contained in:
Eric Rowell
2012-04-28 18:33:05 -07:00
parent e8dcb8e584
commit ff31dcb0ae
4 changed files with 95 additions and 13 deletions

View File

@@ -67,9 +67,12 @@ Kinetic.Stage.prototype = {
* start animation
*/
start: function() {
var go = Kinetic.GlobalObject;
go._addAnimation(this.anim);
go._handleAnimation();
if(!this.animRunning) {
var go = Kinetic.GlobalObject;
go._addAnimation(this.anim);
go._handleAnimation();
this.animRunning = true;
}
},
/**
* stop animation
@@ -77,7 +80,7 @@ Kinetic.Stage.prototype = {
stop: function() {
var go = Kinetic.GlobalObject;
go._removeAnimation(this.anim);
go._handleAnimation();
this.animRunning = false;
},
/**
* draw children
@@ -910,6 +913,7 @@ Kinetic.Stage.prototype = {
this.ids = {};
this.names = {};
this.anim = undefined;
this.animRunning = false;
}
};
// Extend Container and Node