Skip to content

Commit 1b8a0e3

Browse files
author
SeanLin
committed
Merge pull request #742 from dingpinglv/Iss1671_EaseActionBug
Fixed #1617 fixed EaseElasticInOutAction bug
2 parents d65e4a1 + 2d5737c commit 1b8a0e3

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

cocos2d/actions/CCActionEase.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# *
315315
* @param {Number} time1
316316
*/
317317
update:function (time1) {
318-
this._other.update(time1 == 1 ? 1 : (-(Math.pow(2, -10 * time1 )) + 1));
318+
this._other.update(time1 == 1 ? 1 : (-(Math.pow(2, -10 * time1)) + 1));
319319
},
320320

321321
/**
@@ -674,32 +674,28 @@ cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
674674
*/
675675
update:function (time1) {
676676
var newT = 0;
677-
if (time1 == 0 || time1 == 1) {
677+
if (time1 === 0 || time1 === 1) {
678678
newT = time1;
679679
} else {
680680
time1 = time1 * 2;
681-
if (!this._period) {
681+
if (!this._period)
682682
this._period = 0.3 * 1.5;
683-
}
684683

685684
var s = this._period / 4;
686-
687685
time1 = time1 - 1;
688-
if (time1 < 0) {
686+
if (time1 < 0)
689687
newT = -0.5 * Math.pow(2, 10 * time1) * Math.sin((time1 - s) * Math.PI * 2 / this._period);
690-
} else {
688+
else
691689
newT = Math.pow(2, -10 * time1) * Math.sin((time1 - s) * Math.PI * 2 / this._period) * 0.5 + 1;
692-
}
693690
}
694-
695691
this._other.update(newT);
696692
},
697693

698694
/**
699695
* @return {cc.ActionInterval}
700696
*/
701697
reverse:function () {
702-
return cc.EaseInOut.create(this._other.reverse(), this._period);
698+
return cc.EaseElasticInOut.create(this._other.reverse(), this._period);
703699
}
704700
});
705701

0 commit comments

Comments
 (0)