Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed #1509 correct EaseExponentialInOut action

  • Loading branch information...
commit 32ec667ae02ebdf34eaeedd637770f962b09bf34 1 parent c525dd5
@dingpinglv dingpinglv authored
Showing with 15 additions and 237 deletions.
  1. +15 −237 cocos2d/actions/CCActionEase.js
View
252 cocos2d/actions/CCActionEase.js
@@ -31,7 +31,6 @@
*/
cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{
-
/** initializes the action
* @param {cc.ActionInterval} action
* @return {Boolean}
@@ -45,20 +44,13 @@ cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{
}
return false;
},
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
- },
/**
* @param {cc.Node} target
*/
startWithTarget:function (target) {
- this._super(target);
- this._other.startWithTarget(this._target); //TODO, need to be checked
+ cc.ActionInterval.prototype.startWithTarget.call(this, target);
+ this._other.startWithTarget(this._target);
},
/**
@@ -137,14 +129,6 @@ cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{
},
/**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
- },
-
- /**
* @return {cc.ActionInterval}
*/
reverse:function () {
@@ -166,7 +150,6 @@ cc.EaseRateAction.create = function (action, rate) {
var ret = new cc.EaseRateAction();
if (ret) {
ret.initWithAction(action, rate);
-
}
return ret;
};
@@ -189,14 +172,6 @@ cc.EaseIn = cc.EaseRateAction.extend(/** @lends cc.EaseIn# */{
*/
reverse:function () {
return cc.EaseIn.create(this._other.reverse(), 1 / this._rate);
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
});
@@ -212,7 +187,6 @@ cc.EaseIn.create = function (action, rate) {
var ret = new cc.EaseIn();
if (ret) {
ret.initWithAction(action, rate);
-
}
return ret;
};
@@ -222,7 +196,6 @@ cc.EaseIn.create = function (action, rate) {
* @extends cc.EaseRateAction
*/
cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{
-
/**
* @param {Number} time1
*/
@@ -235,17 +208,7 @@ cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{
*/
reverse:function () {
return cc.EaseOut.create(this._other.reverse(), 1 / this._rate);
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
-
});
/** Creates the action with the inner action and the rate parameter
@@ -260,7 +223,6 @@ cc.EaseOut.create = function (action, rate) {
var ret = new cc.EaseOut();
if (ret) {
ret.initWithAction(action, rate);
-
}
return ret;
};
@@ -285,22 +247,11 @@ cc.EaseInOut = cc.EaseRateAction.extend(/** @lends cc.EaseInOut# */{
},
/**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
- },
-
- /**
* @return {cc.ActionInterval}
*/
reverse:function () {
return cc.EaseInOut.create(this._other.reverse(), this._rate);
-
}
-
-
});
/** Creates the action with the inner action and the rate parameter
@@ -315,7 +266,6 @@ cc.EaseInOut.create = function (action, rate) {
var ret = new cc.EaseInOut();
if (ret) {
ret.initWithAction(action, rate);
-
}
return ret;
};
@@ -325,13 +275,11 @@ cc.EaseInOut.create = function (action, rate) {
* @extends cc.ActionEase
*/
cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{
-
/**
* @param {Number} time1
*/
update:function (time1) {
- this._other.update(time1 == 0 ? 0 : Math.pow(2, 10 * (time1 / 1 - 1)) - 1 * 0.001);
-
+ this._other.update(time1 == 0 ? 0 : Math.pow(2, 10 * (time1 - 1)) - 0.001);
},
/**
@@ -339,16 +287,7 @@ cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{
*/
reverse:function () {
return cc.EaseExponentialOut.create(this._other.reverse());
- },
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
-
});
/** creates the action
@@ -362,7 +301,6 @@ cc.EaseExponentialIn.create = function (action) {
var ret = new cc.EaseExponentialIn();
if (ret) {
ret.initWithAction(action);
-
}
return ret;
};
@@ -377,7 +315,7 @@ cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# *
* @param {Number} time1
*/
update:function (time1) {
- this._other.update(time1 == 1 ? 1 : (-(Math.pow(2, -10 * time1 / 1)) + 1));
+ this._other.update(time1 == 1 ? 1 : (-(Math.pow(2, -10 * time1 )) + 1));
},
/**
@@ -385,17 +323,7 @@ cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# *
*/
reverse:function () {
return cc.EaseExponentialIn.create(this._other.reverse());
- },
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
-
-
});
/** creates the action
@@ -409,30 +337,27 @@ cc.EaseExponentialOut.create = function (action) {
var ret = new cc.EaseExponentialOut();
if (ret) {
ret.initWithAction(action);
-
}
return ret;
};
+
/**
* Ease Exponential InOut
* @class
* @extends cc.ActionEase
*/
cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOut# */{
-
/**
- * @param {Number} time1
+ * @param {Number} time
*/
- update:function (time1) {
- time1 /= 0.5;
- if (time1 < 1) {
- time1 = 0.5 * Math.pow(2, 10 * (time1 - 1));
- } else {
- time1 = 0.5 * (-Math.pow(2, 10 * (time1 - 1)) + 2);
- }
-
- this._other.update(time1);
+ update:function (time) {
+ time /= 0.5;
+ if (time < 1)
+ time = 0.5 * Math.pow(2, 10 * (time - 1));
+ else
+ time = 0.5 * (-Math.pow(2, -10 * (time - 1)) + 2);
+ this._other.update(time);
},
/**
@@ -440,19 +365,9 @@ cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOu
*/
reverse:function () {
return cc.EaseExponentialInOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
-
/** creates the action
* @param {cc.ActionInterval} action
* @return {cc.EaseExponentialInOut}
@@ -464,7 +379,6 @@ cc.EaseExponentialInOut.create = function (action) {
var ret = new cc.EaseExponentialInOut();
if (ret) {
ret.initWithAction(action);
-
}
return ret;
};
@@ -488,14 +402,6 @@ cc.EaseSineIn = cc.ActionEase.extend(/** @lends cc.EaseSineIn# */{
*/
reverse:function () {
return cc.EaseSineOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
});
@@ -510,7 +416,6 @@ cc.EaseSineIn.create = function (action) {
var ret = new cc.EaseSineIn();
if (ret) {
ret.initWithAction(action);
-
}
return ret;
};
@@ -532,14 +437,6 @@ cc.EaseSineOut = cc.ActionEase.extend(/** @lends cc.EaseSineOut# */{
*/
reverse:function () {
return cc.EaseSineIn.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
});
@@ -555,7 +452,6 @@ cc.EaseSineOut.create = function (action) {
var ret = new cc.EaseSineOut();
if (ret) {
ret.initWithAction(action);
-
}
return ret;
};
@@ -581,16 +477,7 @@ cc.EaseSineInOut = cc.ActionEase.extend(/** @lends cc.EaseSineInOut# */{
*/
reverse:function () {
return cc.EaseSineInOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
/** creates the action
@@ -604,7 +491,6 @@ cc.EaseSineInOut.create = function (action) {
var ret = new cc.EaseSineInOut();
if (ret) {
ret.initWithAction(action);
-
}
return ret;
};
@@ -646,18 +532,9 @@ cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{
*/
reverse:function () {
cc.Assert(0, "Override me");
-
return null;
},
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
- },
-
_period:null
});
@@ -677,7 +554,6 @@ cc.EaseElastic.create = function (action, period) {
} else {
ret.initWithAction(action, period);
}
-
}
return ret;
};
@@ -711,16 +587,7 @@ cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{
*/
reverse:function () {
return cc.EaseElasticOut.create(this._other.reverse(), this._period);
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
@@ -740,7 +607,6 @@ cc.EaseElasticIn.create = function (action, period) {
} else {
ret.initWithAction(action, period);
}
-
}
return ret;
};
@@ -765,7 +631,6 @@ cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{
}
this._other.update(newT);
-
},
/**
@@ -773,17 +638,7 @@ cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{
*/
reverse:function () {
return cc.EaseElasticIn.create(this._other.reverse(), this._period);
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
-
});
@@ -803,7 +658,6 @@ cc.EaseElasticOut.create = function (action, period) {
} else {
ret.initWithAction(action, period);
}
-
}
return ret;
};
@@ -839,7 +693,6 @@ cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
}
this._other.update(newT);
-
},
/**
@@ -847,16 +700,7 @@ cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
*/
reverse:function () {
return cc.EaseInOut.create(this._other.reverse(), this._period);
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
/** Creates the action with the inner action and the period in radians (default is 0.3)
@@ -875,7 +719,6 @@ cc.EaseElasticInOut.create = function (action, period) {
} else {
ret.initWithAction(action, period);
}
-
}
return ret;
};
@@ -910,16 +753,7 @@ cc.EaseBounce = cc.ActionEase.extend(/** @lends cc.EaseBounce# */{
*/
reverse:function () {
return cc.EaseBounce.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
/** creates the action
@@ -957,17 +791,7 @@ cc.EaseBounceIn = cc.EaseBounce.extend(/** @lends cc.EaseBounceIn# */{
*/
reverse:function () {
return cc.EaseBounceOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
-
});
/** creates the action
@@ -1005,17 +829,7 @@ cc.EaseBounceOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceOut# */{
*/
reverse:function () {
return cc.EaseBounceIn.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
-
});
/** creates the action
@@ -1054,25 +868,15 @@ cc.EaseBounceInOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceInOut# */{
}
this._other.update(newT);
-
},
/**
* @return {cc.ActionInterval}
*/
- reverse:function(){
+ reverse:function () {
return cc.EaseBounceInOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
/** creates the action
@@ -1113,16 +917,7 @@ cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{
reverse:function () {
return cc.EaseBackOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
@@ -1163,14 +958,6 @@ cc.EaseBackOut = cc.ActionEase.extend(/** @lends cc.EaseBackOut# */{
*/
reverse:function () {
return cc.EaseBackIn.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
});
@@ -1214,18 +1001,9 @@ cc.EaseBackInOut = cc.ActionEase.extend(/** @lends cc.EaseBackInOut# */{
/**
* @return {cc.ActionInterval}
*/
- reverse:function(){
+ reverse:function () {
return cc.EaseBackInOut.create(this._other.reverse());
- },
-
- /**
- * @deprecated It is not needed anymore.
- * @param zone
- */
- copyWithZone:function (zone) {
-
}
-
});
Please sign in to comment.
Something went wrong with that request. Please try again.