From 1ecd93c24cb88e79ac0bcbc22f79bbed2524422e Mon Sep 17 00:00:00 2001 From: 06wj <06wj@163.com> Date: Fri, 28 Apr 2017 17:59:15 +0800 Subject: [PATCH] fix: Tween Ease.Back bug --- src/tween/Tween.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tween/Tween.js b/src/tween/Tween.js index b0996a0b..68ac8bfb 100644 --- a/src/tween/Tween.js +++ b/src/tween/Tween.js @@ -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 @@ -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