diff --git a/src/tween/Tween.js b/src/tween/Tween.js index 2e1cbe55..33e1a150 100644 --- a/src/tween/Tween.js +++ b/src/tween/Tween.js @@ -138,6 +138,7 @@ return Class.create(/** @lends Tween.prototype */{ time: 0, //ready only isStart:false, + isComplete:false, onStart: null, onUpdate: null, onComplete: null, @@ -186,7 +187,11 @@ return Class.create(/** @lends Tween.prototype */{ me._startTime = now() + me.delay; me._seekTime = 0; me._pausedTime = 0; + me._reverseFlag = 1; + me._repeatCount = 0; me.paused = false; + me.isStart = false; + me.isComplete = false; Tween.add(me); return me; }, @@ -323,6 +328,7 @@ return Class.create(/** @lends Tween.prototype */{ _update: function(time, forceUpdate){ var me = this; if(me.paused && !forceUpdate) return; + if(me.isComplete) return true; //elapsed time var elapsed = time - me._startTime - me._pausedTime + me._seekTime; @@ -376,7 +382,7 @@ return Class.create(/** @lends Tween.prototype */{ me._startTime = now() + me.repeatDelay; me._pausedTime = 0; }else{ - complete = true; + me.isComplete = true; } } @@ -389,14 +395,14 @@ return Class.create(/** @lends Tween.prototype */{ next._render(ratio); next.time = elapsed; Tween.add(next); - }else if(complete && (nextStartTime < 0 || nextStartTime > time)){ + }else if(me.isComplete && (nextStartTime < 0 || nextStartTime > time)){ //next tween next.start(); } } //complete - if(complete){ + if(me.isComplete){ (callback = me.onComplete) && callback.call(me, me); return true; }