Skip to content

Commit

Permalink
fix: Tween Ease.Back bug
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Apr 28, 2017
1 parent 0e3a9f1 commit 1ecd93c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tween/Tween.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,15 @@ return Class.create(/** @lends Tween.prototype */{

//elapsed ratio
var ratio = elapsed / me.duration, complete = false, callback;
ratio = ratio <= 0 ? 0 : ratio >= 1 ? 1 : me.ease ? me.ease(ratio) : ratio;
ratio = ratio <= 0 ? 0 : ratio >= 1 ? 1 : ratio;
var easeRatio = me.ease ? me.ease(ratio) : ratio;

if(me.reverse){
//backward
if(me._reverseFlag < 0) ratio = 1 - ratio;
if(me._reverseFlag < 0) {
ratio = 1 - ratio;
easeRatio = 1 - easeRatio;
}
//forward
if(ratio < 1e-7){
//repeat complete or not loop
Expand All @@ -351,7 +355,7 @@ return Class.create(/** @lends Tween.prototype */{
me.time = elapsed;

//render & update callback
me._render(ratio);
me._render(easeRatio);
(callback = me.onUpdate) && callback.call(me, ratio, me);

//check if complete
Expand Down

0 comments on commit 1ecd93c

Please sign in to comment.