From 615ae8cc18627d352e71cd228c498e8475e43825 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 22 Mar 2016 11:46:43 +0800 Subject: [PATCH 1/2] update actions all api. --- cocos2d/actions/CCAction.js | 65 ++++++--- cocos2d/actions/CCActionCatmullRom.js | 15 ++- cocos2d/actions/CCActionEase.js | 185 +++++++++++++++++++++++--- cocos2d/actions/CCActionInstant.js | 34 +++-- cocos2d/actions/CCActionInterval.js | 85 +++++++++--- 5 files changed, 310 insertions(+), 74 deletions(-) diff --git a/cocos2d/actions/CCAction.js b/cocos2d/actions/CCAction.js index 1c7b8f9fd7..67a727990b 100644 --- a/cocos2d/actions/CCAction.js +++ b/cocos2d/actions/CCAction.js @@ -29,7 +29,8 @@ */ /** - * Base class cc.Action for action classes. + * !#en Base class cc.Action for action classes. + * !#zh Action 类是所有动作类型的基类。 * @class Action */ cc.Action = cc._Class.extend({ @@ -43,8 +44,10 @@ cc.Action = cc._Class.extend({ }, /** + * !#en * to copy object with deep copy. * returns a clone of action. + * !#zh 返回一个克隆的动作。 * @method clone * @return {Action} */ @@ -57,7 +60,9 @@ cc.Action = cc._Class.extend({ }, /** + * !#en * return true if the action has finished. + * !#zh 如果动作已完成就返回 true。 * @method isDone * @return {Boolean} */ @@ -87,7 +92,8 @@ cc.Action = cc._Class.extend({ }, /** - * get the target. + * !#en get the target. + * !#zh 获取当前目标节点。 * @method getTarget * @return {Node} */ @@ -96,7 +102,8 @@ cc.Action = cc._Class.extend({ }, /** - * The action will modify the target properties. + * !#en The action will modify the target properties. + * !#zh 设置目标节点属性。 * @method setTarget * @param {Node} target */ @@ -105,7 +112,8 @@ cc.Action = cc._Class.extend({ }, /** - * get the original target. + * !#en get the original target. + * !#zh 获取原始目标节点。 * @method getOriginalTarget * @return {Node} */ @@ -121,7 +129,8 @@ cc.Action = cc._Class.extend({ }, /** - * get tag number. + * !#en get tag number. + * !#zh 获取一个用于识别动作的标签。 * @method getTag * @return {Number} */ @@ -130,7 +139,8 @@ cc.Action = cc._Class.extend({ }, /** - * set tag number. + * !#en set tag number. + * !#zh 设置标签,用于识别动作。 * @method setTag * @param {Number} tag */ @@ -151,21 +161,27 @@ cc.Action = cc._Class.extend({ } }); -/** Default Action tag +/** + * !#en Default Action tag. + * !#zh 默认动作标签。 + * @property TAG_INVALID * @constant + * @static * @type {Number} - * @default + * @default -1 */ cc.Action.TAG_INVALID = -1; /** + * !#en * Base class actions that do have a finite time duration.
* Possible actions:
* - An action with a duration of 0 seconds.
* - An action with a duration of 35.5 seconds. * * Infinite time actions are valid + * !#zh 有限时间动作,这种动作拥有时长 duration 属性。 * @class FiniteTimeAction * @extends Action */ @@ -179,7 +195,8 @@ cc.FiniteTimeAction = cc.Action.extend({ }, /** - * get duration of the action. (seconds) + * !#en get duration of the action. (seconds). + * !#zh 获取动作以秒为单位的持续时间。 * @method getDuration * @return {Number} */ @@ -188,7 +205,8 @@ cc.FiniteTimeAction = cc.Action.extend({ }, /** - * set duration of the action. (seconds) + * !#en set duration of the action. (seconds). + * !#zh 设置动作以秒为单位的持续时间。 * @method setDuration * @param {Number} duration */ @@ -197,11 +215,13 @@ cc.FiniteTimeAction = cc.Action.extend({ }, /** + * !#en * Returns a reversed action.
* For example:
* - The action will be x coordinates of 0 move to 100.
* - The reversed action will be x of 100 move to 0. * - Will be rewritten + * !#zh 返回一个新的动作,执行与原动作完全相反的动作。 * @method reverse * @return {Null} */ @@ -211,8 +231,10 @@ cc.FiniteTimeAction = cc.Action.extend({ }, /** + * !#en * to copy object with deep copy. * returns a clone of action. + * !#zh 返回一个克隆的动作。 * @method clone * @return {FiniteTimeAction} */ @@ -249,7 +271,7 @@ cc.Speed = cc.Action.extend({ action && this.initWithAction(action, speed); }, - /** + /* * Gets the current running speed.
* Will get a percentage number, compared to the original speed. * @@ -260,7 +282,7 @@ cc.Speed = cc.Action.extend({ return this._speed; }, - /** + /* * alter the speed of the inner function in runtime. * @method setSpeed * @param {Number} speed @@ -269,7 +291,7 @@ cc.Speed = cc.Action.extend({ this._speed = speed; }, - /** + /* * initializes the action. * @method initWithAction * @param {ActionInterval} action @@ -313,7 +335,7 @@ cc.Speed = cc.Action.extend({ return new cc.Speed(this._innerAction.reverse(), this._speed); }, - /** + /* * Set inner Action. * @method setInnerAction * @param {ActionInterval} action @@ -324,7 +346,7 @@ cc.Speed = cc.Action.extend({ } }, - /** + /* * Get inner Action. * @method getInnerAction * @return {ActionInterval} @@ -339,16 +361,21 @@ cc.Speed = cc.Action.extend({ */ /** + * !#en * Creates the speed action which changes the speed of an action, making it take longer (speed > 1) * or less (speed < 1) time.
* Useful to simulate 'slow motion' or 'fast forward' effect. - * + * !#zh 修改目标动作的速率。 * @warning This action can't be Sequenceable because it is not an cc.IntervalAction * * @method speed * @param {ActionInterval} action * @param {Number} speed * @return {Action} + * @example + * // change the target action speed; + * var action = cc.scaleTo(0.2, 1, 0.6); + * var newAction = cc.speed(action, 0.5); */ cc.speed = function (action, speed) { return new cc.Speed(action, speed); @@ -400,7 +427,7 @@ cc.Follow = cc.Action.extend({ topBoundary:0.0, bottomBoundary:0.0, - /** + /* * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
* creates the action with a set boundary.
* creates the action with no boundary set. @@ -528,8 +555,8 @@ cc.Follow = cc.Action.extend({ }); /** - * Create a follow action which makes its target follows another node. - * + * !#en Create a follow action which makes its target follows another node. + * !#zh 追踪目标节点的位置。 * @method follow * @param {Node} followedNode * @param {Rect} rect diff --git a/cocos2d/actions/CCActionCatmullRom.js b/cocos2d/actions/CCActionCatmullRom.js index d7ee983e17..123f62a528 100644 --- a/cocos2d/actions/CCActionCatmullRom.js +++ b/cocos2d/actions/CCActionCatmullRom.js @@ -268,8 +268,8 @@ cc.CardinalSplineTo = cc.ActionInterval.extend({ }); /** - * creates an action with a Cardinal Spline array of points and tension. - * + * !#en Creates an action with a Cardinal Spline array of points and tension. + * !#zh 按基数样条曲线轨迹移动到目标位置。 * @method cardinalSplineTo * @param {Number} duration * @param {Array} points array of control points @@ -378,8 +378,8 @@ cc.CardinalSplineBy = cc.CardinalSplineTo.extend({ }); /** - * creates an action with a Cardinal Spline array of points and tension. - * + * !#en Creates an action with a Cardinal Spline array of points and tension. + * !#zh 按基数样条曲线轨迹移动指定的距离。 * @method cardinalSplineBy * @param {Number} duration * @param {Array} points @@ -430,8 +430,8 @@ cc.CatmullRomTo = cc.CardinalSplineTo.extend({ }); /** - * creates an action with a Cardinal Spline array of points and tension. - * + * !#en Creates an action with a Cardinal Spline array of points and tension. + * !#zh 按 Catmull Rom 样条曲线轨迹移动到目标位置。 * @method catmullRomTo * @param {Number} dt * @param {Array} points @@ -485,7 +485,8 @@ cc.CatmullRomBy = cc.CardinalSplineBy.extend({ }); /** - * Creates an action with a Cardinal Spline array of points and tension + * !#en Creates an action with a Cardinal Spline array of points and tension. + * !#zh 按 Catmull Rom 样条曲线轨迹移动指定的距离。 * @method catmullRomBy * @param {Number} dt * @param {Array} points diff --git a/cocos2d/actions/CCActionEase.js b/cocos2d/actions/CCActionEase.js index 0777104624..fe147af550 100644 --- a/cocos2d/actions/CCActionEase.js +++ b/cocos2d/actions/CCActionEase.js @@ -29,7 +29,8 @@ */ /** - * Base class for Easing actions + * !#en Base class for Easing actions. + * !#zh 所有缓动动作基类,用于修饰 ActionInterval。 * @class ActionEase * @extends ActionInterval * @param {ActionInterval} action @@ -98,8 +99,8 @@ cc.actionEase = function (action) { }; /** - * Base class for Easing actions with rate parameters - * + * !#en Base class for Easing actions with rate parameters + * !#zh 拥有速率属性的缓动动作基类。 * @class EaseRateAction * @extends ActionEase * @param {ActionInterval} action @@ -191,9 +192,10 @@ cc.EaseIn = cc.EaseRateAction.extend({ }); /** + * !#en * Creates the action easing object with the rate parameter.
* From slow to fast. - * + * !#zh 创建 easeIn 缓动对象,由慢到快。 * @method easeIn * @param {Number} rate * @return {Object} @@ -241,9 +243,10 @@ cc.EaseOut = cc.EaseRateAction.extend({ }); /** + * !#en * Creates the action easing object with the rate parameter.
* From fast to slow. - * + * !#zh 创建 easeOut 缓动对象,由快到慢。 * @method easeOut * @param {Number} rate * @return {Object} @@ -295,8 +298,10 @@ cc.EaseInOut = cc.EaseRateAction.extend({ }); /** + * !#en * Creates the action easing object with the rate parameter.
* Slow to fast then to slow. + * !#zh 创建 easeInOut 缓动对象,慢到快,然后慢。 * @method easeInOut * @param {Number} rate * @return {Object} @@ -359,9 +364,14 @@ cc._easeExponentialInObj = { }; /** + * !#en * Creates the action easing object with the rate parameter.
* Reference easeInExpo:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeExponentialIn 缓动对象。
+ * EaseExponentialIn 是按指数函数缓动进入的动作。
+ * 参考 easeInExpo:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeExponentialIn * @return {Object} * @example @@ -410,9 +420,14 @@ cc._easeExponentialOutObj = { }; /** - * creates the action easing object.
+ * !#en + * Creates the action easing object.
* Reference easeOutExpo:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeExponentialOut 缓动对象。
+ * EaseExponentialOut 是按指数函数缓动退出的动作。
+ * 参考 easeOutExpo:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeExponentialOut * @return {Object} * @example @@ -476,9 +491,14 @@ cc._easeExponentialInOutObj = { }; /** - * creates an EaseExponentialInOut action easing object.
+ * !#en + * Creates an EaseExponentialInOut action easing object.
* Reference easeInOutExpo:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeExponentialInOut 缓动对象。
+ * EaseExponentialInOut 是按指数函数缓动进入并退出的动作。
+ * 参考 easeInOutExpo:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeExponentialInOut * @return {Object} * @example @@ -527,9 +547,14 @@ cc._easeSineInObj = { } }; /** - * creates an EaseSineIn action.
+ * !#en + * Creates an EaseSineIn action.
* Reference easeInSine:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 EaseSineIn 缓动对象。
+ * EaseSineIn 是按正弦函数缓动进入的动作。
+ * 参考 easeInSine:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeSineIn * @return {Object} * @example @@ -579,9 +604,14 @@ cc._easeSineOutObj = { }; /** + * !#en * Creates an EaseSineOut action easing object.
* Reference easeOutSine:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 EaseSineOut 缓动对象。
+ * EaseSineIn 是按正弦函数缓动退出的动作。
+ * 参考 easeOutSine:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeSineOut * @return {Object} * @example @@ -631,9 +661,14 @@ cc._easeSineInOutObj = { }; /** - * creates the action easing object.
+ * !#en + * Creates the action easing object.
* Reference easeInOutSine:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeSineInOut 缓动对象。
+ * EaseSineIn 是按正弦函数缓动进入并退出的动作。
+ * 参考 easeInOutSine:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeSineInOut * @return {Object} * @example @@ -645,11 +680,12 @@ cc.easeSineInOut = function(){ }; /** - * Ease Elastic abstract class. + * !#en Ease Elastic abstract class. + * !#zh 弹性缓动动作基类。 * @class EaseElastic * @extends ActionEase * @param {ActionInterval} action - * @param {Number} [period=0.3] + * @param {Number} period */ cc.EaseElastic = cc.ActionEase.extend({ _period: 0.3, @@ -755,11 +791,16 @@ cc._easeElasticInObj = { }; /** + * !#en * Creates the action easing obejct with the period in radians (default is 0.3).
* Reference easeInElastic:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeElasticIn 缓动对象。
+ * EaseElasticIn 是按弹性曲线缓动进入的动作。
+ * 参数 easeInElastic:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeElasticIn - * @param {Number} [period=0.3] + * @param {Number} period * @return {Object} * @example * // example @@ -830,11 +871,16 @@ cc._easeElasticOutObj = { } }; /** + * !#en * Creates the action easing object with the period in radians (default is 0.3).
* Reference easeOutElastic:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeElasticOut 缓动对象。
+ * EaseElasticOut 是按弹性曲线缓动退出的动作。
+ * 参考 easeOutElastic:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeElasticOut - * @param {Number} [period=0.3] + * @param {Number} period * @return {Object} * @example * // example @@ -901,11 +947,16 @@ cc.EaseElasticInOut = cc.EaseElastic.extend({ }); /** + * !#en * Creates the action easing object with the period in radians (default is 0.3).
* Reference easeInOutElastic:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeElasticInOut 缓动对象。
+ * EaseElasticInOut 是按弹性曲线缓动进入并退出的动作。
+ * 参考 easeInOutElastic:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeElasticInOut - * @param {Number} [period=0.3] + * @param {Number} period * @return {Object} * @example * // example @@ -940,8 +991,8 @@ cc.easeElasticInOut = function (period) { }; /** - * cc.EaseBounce abstract class. - * + * !#en cc.EaseBounce abstract class. + * !#zh 反弹缓动动作基类。 * @class EaseBounce * @extends ActionEase */ @@ -1034,8 +1085,12 @@ cc._easeBounceInObj = { }; /** + * !#en * Creates the action easing object.
* Eased bounce effect at the beginning. + * !#zh + * 创建 easeBounceIn 缓动对象。
+ * EaseBounceIn 是按弹跳动作缓动进入的动作。 * @method easeBounceIn * @return {Object} * @example @@ -1085,8 +1140,12 @@ cc._easeBounceOutObj = { }; /** + * !#en * Creates the action easing object.
* Eased bounce effect at the ending. + * !#zh + * 创建 easeBounceOut 缓动对象。
+ * EaseBounceOut 是按弹跳动作缓动退出的动作。 * @method easeBounceOut * @return {Object} * @example @@ -1149,8 +1208,12 @@ cc._easeBounceInOutObj = { }; /** + * !#en * Creates the action easing object.
* Eased bounce effect at the begining and ending. + * !#zh + * 创建 easeBounceInOut 缓动对象。
+ * EaseBounceInOut 是按弹跳动作缓动进入并退出的动作。 * @method easeBounceInOut * @return {Object} * @example @@ -1202,8 +1265,12 @@ cc._easeBackInObj = { }; /** + * !#en * Creates the action easing object.
* In the opposite direction to move slowly, and then accelerated to the right direction. + * !#zh + * 创建 easeBackIn 缓动对象。
+ * easeBackIn 是在相反的方向缓慢移动,然后加速到正确的方向。
* @method easeBackIn * @return {Object} * @example @@ -1256,8 +1323,12 @@ cc._easeBackOutObj = { }; /** + * !#en * Creates the action easing object.
* Fast moving more than the finish, and then slowly back to the finish. + * !#zh + * 创建 easeBackOut 缓动对象。
+ * easeBackOut 快速移动超出目标,然后慢慢回到目标点。 * @method easeBackOut * @return {Object} * @example @@ -1320,8 +1391,11 @@ cc._easeBackInOutObj = { }; /** + * !#en * Creates the action easing object.
* Begining of cc.EaseBackIn. Ending of cc.EaseBackOut. + * !#zh + * 创建 easeBackInOut 缓动对象。
* @method easeBackInOut * @return {Object} * @example @@ -1399,9 +1473,13 @@ cc.EaseBezierAction = cc.ActionEase.extend({ }); /** + * !#en * Creates the action easing object.
* Into the 4 reference point.
* To calculate the motion curve. + * !#zh + * 创建 easeBezierAction 缓动对象。
+ * EaseBezierAction 是按贝塞尔曲线缓动的动作。 * @method easeBezierAction * @param {Number} p0 The first bezier parameter * @param {Number} p1 The second bezier parameter @@ -1465,9 +1543,14 @@ cc._easeQuadraticActionIn = { }; /** + * !#en * Creates the action easing object.
* Reference easeInQuad:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuadraticActionIn 缓动对象。
+ * EaseQuadraticIn是按二次函数缓动进入的动作。
+ * 参考 easeInQuad:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuadraticActionIn * @returns {Object} * @example @@ -1518,9 +1601,14 @@ cc._easeQuadraticActionOut = { } }; /** + * !#en * Creates the action easing object.
* Reference easeOutQuad:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuadraticActionOut 缓动对象。
+ * EaseQuadraticOut 是按二次函数缓动退出的动作。
+ * 参考 easeOutQuad:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuadraticActionOut * @returns {Object} * @example @@ -1579,9 +1667,14 @@ cc._easeQuadraticActionInOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeInOutQuad:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuadraticActionInOut 缓动对象。
+ * EaseQuadraticInOut 是按二次函数缓动进入并退出的动作。
+ * 参考 easeInOutQuad:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuadraticActionInOut * @returns {Object} * @example @@ -1631,9 +1724,14 @@ cc._easeQuarticActionIn = { } }; /** + * !#en * Creates the action easing object.
* Reference easeIntQuart:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuarticActionIn 缓动对象。
+ * EaseQuarticIn 是按四次函数缓动进入的动作。
+ * 参考 easeIntQuart:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuarticActionIn * @returns {Object} * @example @@ -1685,9 +1783,14 @@ cc._easeQuarticActionOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeOutQuart:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuarticActionOut 缓动对象。
+ * EaseQuarticOut 是按四次函数缓动退出的动作。
+ * 参考 easeOutQuart:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuarticActionOut * @returns {Object} * @example @@ -1741,9 +1844,14 @@ cc._easeQuarticActionInOut = { } }; /** + * !#en * Creates the action easing object.
* Reference easeInOutQuart:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuarticActionInOut 缓动对象。
+ * EaseQuarticInOut 是按四次函数缓动进入并退出的动作。
+ * 参考 easeInOutQuart:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuarticActionInOut * @returns {Object} */ @@ -1791,9 +1899,14 @@ cc._easeQuinticActionIn = { }; /** + * !#en * Creates the action easing object.
* Reference easeInQuint:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuinticActionIn 缓动对象。
+ * EaseQuinticIn 是按五次函数缓动进的动作。
+ * 参考 easeInQuint:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuinticActionIn * @returns {Object} * @example @@ -1845,9 +1958,14 @@ cc._easeQuinticActionOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeOutQuint:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuinticActionOut 缓动对象。
+ * EaseQuinticOut 是按五次函数缓动退出的动作 + * 参考 easeOutQuint:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuinticActionOut * @returns {Object} * @example @@ -1902,9 +2020,14 @@ cc._easeQuinticActionInOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeInOutQuint:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeQuinticActionInOut 缓动对象。
+ * EaseQuinticInOut是按五次函数缓动进入并退出的动作。
+ * 参考 easeInOutQuint:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeQuinticActionInOut * @returns {Object} * @example @@ -1955,9 +2078,14 @@ cc._easeCircleActionIn = { }; /** + * !#en * Creates the action easing object.
* Reference easeInCirc:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeCircleActionIn 缓动对象。
+ * EaseCircleIn是按圆形曲线缓动进入的动作。
+ * 参考 easeInCirc:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeCircleActionIn * @returns {Object} * @example @@ -2009,9 +2137,14 @@ cc._easeCircleActionOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeOutCirc:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeCircleActionOut 缓动对象。
+ * EaseCircleOut是按圆形曲线缓动退出的动作。
+ * 参考 easeOutCirc:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeCircleActionOut * @returns {Object} * @exampple @@ -2066,9 +2199,14 @@ cc._easeCircleActionInOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeInOutCirc:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeCircleActionInOut 缓动对象。
+ * EaseCircleInOut 是按圆形曲线缓动进入并退出的动作。
+ * 参考 easeInOutCirc:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeCircleActionInOut * @returns {Object} * @example @@ -2119,9 +2257,14 @@ cc._easeCubicActionIn = { }; /** + * !#en * Creates the action easing object.
* Reference easeInCubic:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeCubicActionIn 缓动对象。
+ * EaseCubicIn 是按三次函数缓动进入的动作。
+ * 参考 easeInCubic:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeCubicActionIn * @returns {Object} * @example @@ -2173,9 +2316,14 @@ cc._easeCubicActionOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeOutCubic:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeCubicActionOut 缓动对象。
+ * EaseCubicOut 是按三次函数缓动退出的动作。
+ * 参考 easeOutCubic:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeCubicActionOut * @returns {Object} * @example @@ -2230,9 +2378,14 @@ cc._easeCubicActionInOut = { }; /** + * !#en * Creates the action easing object.
* Reference easeInOutCubic:
* http://www.zhihu.com/question/21981571/answer/19925418 + * !#zh + * 创建 easeCubicActionInOut 缓动对象。
+ * EaseCubicInOut是按三次函数缓动进入并退出的动作。
+ * 参考 easeInOutCubic:http://www.zhihu.com/question/21981571/answer/19925418 * @method easeCubicActionInOut * @returns {Object} */ diff --git a/cocos2d/actions/CCActionInstant.js b/cocos2d/actions/CCActionInstant.js index b5679ec581..d5b990887b 100644 --- a/cocos2d/actions/CCActionInstant.js +++ b/cocos2d/actions/CCActionInstant.js @@ -29,7 +29,8 @@ */ /** - * Instant actions are immediate actions. They don't have a duration like the ActionInterval actions. + * !#en Instant actions are immediate actions. They don't have a duration like the ActionInterval actions. + * !#zh 即时动作,这种动作立即就会执行,继承自 FiniteTimeAction。 * @class ActionInstant * @extends FiniteTimeAction */ @@ -87,7 +88,8 @@ cc.Show = cc.ActionInstant.extend({ }); /** - * Show the Node. + * !#en Show the Node. + * !#zh 立即显示。 * @method show * @return {ActionInstant} * @example @@ -119,7 +121,8 @@ cc.Hide = cc.ActionInstant.extend({ }); /** - * Hide the node. + * !#en Hide the node. + * !#zh 立即隐藏。 * @method hide * @return {ActionInstant} * @example @@ -151,7 +154,8 @@ cc.ToggleVisibility = cc.ActionInstant.extend({ }); /** - * Toggles the visibility of a node. + * !#en Toggles the visibility of a node. + * !#zh 显隐状态切换。 * @method toggleVisibility * @return {ActionInstant} * @example @@ -166,7 +170,7 @@ cc.toggleVisibility = function () { * Delete self in the next frame. * @class RemoveSelf * @extends ActionInstant - * @param {Boolean} [isNeedCleanUp=true] + * @param {Boolean} isNeedCleanUp * * @example * // example @@ -200,10 +204,10 @@ cc.RemoveSelf = cc.ActionInstant.extend({ }); /** - * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing. - * + * !#en Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing. + * !#zh 从父节点移除自身。 * @method removeSelf - * @param {Boolean} [isNeedCleanUp=true] + * @param {Boolean} isNeedCleanUp * @return {ActionInstant} * * @example @@ -258,8 +262,8 @@ cc.FlipX = cc.ActionInstant.extend({ }); /** - * Create a FlipX action to flip or unflip the target. - * + * !#en Create a FlipX action to flip or unflip the target. + * !#zh X轴翻转。 * @method flipX * @param {Boolean} flip Indicate whether the target should be flipped or not * @return {ActionInstant} @@ -314,8 +318,8 @@ cc.FlipY = cc.ActionInstant.extend({ }); /** - * Create a FlipY action to flip or unflip the target. - * + * !#en Create a FlipY action to flip or unflip the target. + * !#zh Y轴翻转。 * @method flipY * @param {Boolean} flip * @return {ActionInstant} @@ -378,7 +382,8 @@ cc.Place = cc.ActionInstant.extend({ }); /** - * Creates a Place action with a position. + * !#en Creates a Place action with a position. + * !#zh 放置在目标位置。 * @method place * @param {Vec2|Number} pos * @param {Number} [y] @@ -487,7 +492,8 @@ cc.CallFunc = cc.ActionInstant.extend({ }); /** - * Creates the action with the callback + * !#en Creates the action with the callback. + * !#zh 执行回调函数。 * @method callFunc * @param {function} selector * @param {object|null} [selectorTarget] diff --git a/cocos2d/actions/CCActionInterval.js b/cocos2d/actions/CCActionInterval.js index 12a3327062..1fbcf94d2a 100644 --- a/cocos2d/actions/CCActionInterval.js +++ b/cocos2d/actions/CCActionInterval.js @@ -29,6 +29,7 @@ */ /** + * !#en *

An interval action is an action that takes place within a certain period of time.
* It has an start time, and a finish time. The finish time is the parameter
* duration plus the start time.

@@ -40,7 +41,7 @@ * *

For example, you can simulate a Ping Pong effect running the action normally and
* then running it again in Reverse mode.

- * + * !#zh 时间间隔动作,这种动作在已定时间内完成,继承 FiniteTimeAction。 * @class ActionInterval * @extends FiniteTimeAction * @param {Number} d duration in seconds @@ -118,7 +119,9 @@ cc.ActionInterval = cc.FiniteTimeAction.extend({ }, /** - * Implementation of ease motion. + * !#en Implementation of ease motion. + * !#zh 缓动运动。 + * @example * @method easing * @param {Object} easeObj * @returns {ActionInterval} @@ -206,10 +209,13 @@ cc.ActionInterval = cc.FiniteTimeAction.extend({ }, /** + * !#en * Changes the speed of an action, making it take longer (speed>1) * or less (speed<1) time.
* Useful to simulate 'slow motion' or 'fast forward' effect. - * + * !#zh + * 改变一个动作的速度,使它的执行使用更长的时间(speed > 1)
+ * 或更少(speed < 1)可以有效得模拟“慢动作”或“快进”的效果。 * @param speed * @returns {Action} */ @@ -243,8 +249,10 @@ cc.ActionInterval = cc.FiniteTimeAction.extend({ }, /** + * !#en * Repeats an action a number of times. * To repeat an action forever use the CCRepeatForever action. + * !#zh 重复动作可以按一定次数重复一个动作,使用 RepeatForever 动作来永远重复一个动作。 * @method repeat * @param times * @returns {ActionInterval} @@ -261,8 +269,10 @@ cc.ActionInterval = cc.FiniteTimeAction.extend({ }, /** + * !#en * Repeats an action for ever.
* To repeat the an action for a limited number of times use the Repeat action.
+ * !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 Repeat 动作。 * @method repeatForever * @returns {ActionInterval} */ @@ -416,8 +426,10 @@ cc.Sequence = cc.ActionInterval.extend({ }); /** + * !#en * Helper constructor to create an array of sequenceable actions * The created action will run actions sequentially, one after another. + * !#zh 顺序执行动作,创建的动作将按顺序依次运行。 * @method sequence * @param {Array|FiniteTimeAction} tempArray * @return {ActionInterval} @@ -592,7 +604,8 @@ cc.Repeat = cc.ActionInterval.extend({ }); /** - * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) + * !#en Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) + * !#zh 重复动作,可以按一定次数重复一个动,如果想永远重复一个动作请使用 repeatForever 动作来完成。 * @method repeat * @param {FiniteTimeAction} action * @param {Number} times @@ -694,7 +707,8 @@ cc.RepeatForever = cc.ActionInterval.extend({ }); /** - * Create a acton which repeat forever + * !#en Create a acton which repeat forever + * !#zh 永远地重复一个动作,有限次数内重复一个动作请使用 repeat 动作。 * @method repeatForever * @param {FiniteTimeAction} action * @return {ActionInterval} @@ -803,7 +817,8 @@ cc.Spawn = cc.ActionInterval.extend({ }); /** - * Create a spawn action which runs several actions in parallel. + * !#en Create a spawn action which runs several actions in parallel. + * !#zh 同步执行动作,同步执行一组动作。 * @method spawn * @param {Array|FiniteTimeAction}tempArray * @return {FiniteTimeAction} @@ -918,8 +933,10 @@ cc.RotateTo = cc.ActionInterval.extend({ }); /** + * !#en * Rotates a Node object to a certain angle by modifying its rotation property.
* The direction will be decided by the shortest angle. + * !#zh 旋转到目标角度,通过逐帧修改它的 rotation 属性,旋转方向将由最短的角度决定。 * @method rotateTo * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees. @@ -1003,8 +1020,10 @@ cc.RotateBy = cc.ActionInterval.extend({ }); /** + * !#en * Rotates a Node object clockwise a number of degrees by modifying its rotation property. * Relative to its properties to modify. + * !#zh 旋转指定的角度。 * @method rotateBy * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees @@ -1120,10 +1139,12 @@ cc.MoveBy = cc.ActionInterval.extend({ }); /** + * !#en * Moves a Node object x,y pixels by modifying its position property.
* x and y are relative to the position of the object.
* Several MoveBy actions can be concurrently called, and the resulting
* movement will be the sum of individual movements. + * !#zh 移动指定的距离。 * @method moveBy * @param {Number} duration duration in seconds * @param {Vec2|Number} deltaPos @@ -1196,9 +1217,11 @@ cc.MoveTo = cc.MoveBy.extend({ }); /** + * !#en * Moves a Node object to the position x,y. x and y are absolute coordinates by modifying its position property.
* Several MoveTo actions can be concurrently called, and the resulting
* movement will be the sum of individual movements. + * !#zh 移动到目标位置。 * @method moveTo * @param {Number} duration duration in seconds * @param {Vec2} position @@ -1288,8 +1311,10 @@ cc.SkewTo = cc.ActionInterval.extend({ }); /** + * !#en * Create a action which skews a Node object to given angles by modifying its skewX and skewY properties. * Changes to the specified value. + * !#zh 偏斜到目标角度。 * @method skewTo * @param {Number} t time in seconds * @param {Number} sx @@ -1360,8 +1385,10 @@ cc.SkewBy = cc.SkewTo.extend({ }); /** + * !#en * Skews a Node object by skewX and skewY degrees.
* Relative to its property modification. + * !#zh 偏斜指定的角度。 * @method skewBy * @param {Number} t time in seconds * @param {Number} sx sx skew in degrees for X axis @@ -1487,8 +1514,10 @@ cc.JumpBy = cc.ActionInterval.extend({ }); /** + * !#en * Moves a Node object simulating a parabolic jump movement by modifying it's position property. * Relative to its movement. + * !#zh 用跳跃的方式移动指定的距离。 * @method jumpBy * @param {Number} duration * @param {Vec2|Number} position @@ -1568,8 +1597,10 @@ cc.JumpTo = cc.JumpBy.extend({ }); /** + * !#en * Moves a Node object to a parabolic position simulating a jump movement by modifying its position property.
* Jump to the specified location. + * !#zh 用跳跃的方式移动到目标位置。 * @method jumpTo * @param {Number} duration * @param {Vec2|Number} position @@ -1712,8 +1743,10 @@ cc.BezierBy = cc.ActionInterval.extend({ }); /** + * !#en * An action that moves the target with a cubic Bezier curve by a certain distance. * Relative to its movement. + * !#zh 按贝赛尔曲线轨迹移动指定的距离。 * @method bezierBy * @param {Number} t time in seconds * @param {Array} c Array of points @@ -1779,7 +1812,8 @@ cc.BezierTo = cc.BezierBy.extend({ } }); /** - * An action that moves the target with a cubic Bezier curve to a destination point. + * !#en An action that moves the target with a cubic Bezier curve to a destination point. + * !#zh 按贝赛尔曲线轨迹移动到目标位置。 * @method bezierTo * @param {Number} t * @param {Array} c array of points @@ -1863,7 +1897,8 @@ cc.ScaleTo = cc.ActionInterval.extend({ } }); /** - * Scales a Node object to a zoom factor by modifying it's scale property. + * !#en Scales a Node object to a zoom factor by modifying it's scale property. + * !#zh 将节点大小缩放到指定的倍数。 * @method scaleTo * @param {Number} duration * @param {Number} sx scale parameter in X @@ -1909,8 +1944,10 @@ cc.ScaleBy = cc.ScaleTo.extend({ } }); /** + * !#en * Scales a Node object a zoom factor by modifying it's scale property. * Relative to its changes. + * !#zh 按指定的倍数缩放节点大小。 * @method scaleBy * @param {Number} duration duration in seconds * @param {Number} sx sx scale parameter in X @@ -1992,7 +2029,8 @@ cc.Blink = cc.ActionInterval.extend({ } }); /** - * Blinks a Node object by modifying it's visible property. + * !#en Blinks a Node object by modifying it's visible property. + * !#zh 闪烁(基于透明度)。 * @method blink * @param {Number} duration duration in seconds * @param {Number} blinks blinks in times @@ -2057,7 +2095,10 @@ cc.FadeTo = cc.ActionInterval.extend({ }); /** - * Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one. + * !#en + * Fades an object that implements the cc.RGBAProtocol protocol. + * It modifies the opacity from the current value to a custom one. + * !#zh 修改透明度到指定值。 * @method fadeTo * @param {Number} duration * @param {Number} opacity 0-255, 0 is transparent @@ -2109,7 +2150,8 @@ cc.FadeIn = cc.FadeTo.extend({ }); /** - * Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255. + * !#en Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255. + * !#zh 渐显效果。 * @method fadeIn * @param {Number} duration duration in seconds * @return {ActionInterval} @@ -2155,7 +2197,8 @@ cc.FadeOut = cc.FadeTo.extend({ }); /** - * Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0. + * !#en Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0. + * !#zh 渐隐效果。 * @method fadeOut * @param {Number} d duration in seconds * @return {ActionInterval} @@ -2235,7 +2278,8 @@ cc.TintTo = cc.ActionInterval.extend({ }); /** - * Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. + * !#en Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. + * !#zh 修改颜色到指定值。 * @method tintTo * @param {Number} duration * @param {Number} red 0-255 @@ -2327,8 +2371,10 @@ cc.TintBy = cc.ActionInterval.extend({ }); /** + * !#en * Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. * Relative to their own color change. + * !#zh 按照指定的增量修改颜色。 * @method tintBy * @param {Number} duration duration in seconds * @param {Number} deltaRed @@ -2366,7 +2412,8 @@ cc.DelayTime = cc.ActionInterval.extend({ }); /** - * Delays the action a certain amount of seconds + * !#en Delays the action a certain amount of seconds. + * !#en 延迟指定的时间量。 * @method delayTime * @param {Number} d duration in seconds * @return {ActionInterval} @@ -2448,7 +2495,8 @@ cc.ReverseTime = cc.ActionInterval.extend({ }); /** - * Executes an action in reverse order, from time=duration to time=0. + * !#en Executes an action in reverse order, from time=duration to time=0. + * !#zh 反转目标动作的时间轴。 * @method reverseTime * @param {FiniteTimeAction} action * @return {ActionInterval} @@ -2460,7 +2508,7 @@ cc.reverseTime = function (action) { return new cc.ReverseTime(action); }; -/** +/* * This API is deprecated, will be replaced by new API from {{#crossLink "Animation"}}cc.Animation{{/crossLink}} * Animates a sprite given the name of an Animation * @class Animate @@ -2616,7 +2664,7 @@ cc.Animate = cc.ActionInterval.extend({ } }); -/** +/* * create the animate with animation * @method animate * @param {SpriteFrameAnimation} animation @@ -2704,7 +2752,8 @@ cc.TargetedAction = cc.ActionInterval.extend({ }); /** - * Create an action with the specified action and forced target + * !#en Create an action with the specified action and forced target. + * !#zh 用已有动作和一个新的目标节点创建动作。 * @method targetedAction * @param {Node} target * @param {FiniteTimeAction} action From f907974bc4de074c1e2d3b2f2031c89d3c6c9314 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 22 Mar 2016 14:06:55 +0800 Subject: [PATCH 2/2] update CCAction --- cocos2d/actions/CCAction.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2d/actions/CCAction.js b/cocos2d/actions/CCAction.js index 67a727990b..bbb268309c 100644 --- a/cocos2d/actions/CCAction.js +++ b/cocos2d/actions/CCAction.js @@ -103,7 +103,7 @@ cc.Action = cc._Class.extend({ /** * !#en The action will modify the target properties. - * !#zh 设置目标节点属性。 + * !#zh 设置目标节点。 * @method setTarget * @param {Node} target */ @@ -130,7 +130,7 @@ cc.Action = cc._Class.extend({ /** * !#en get tag number. - * !#zh 获取一个用于识别动作的标签。 + * !#zh 获取用于识别动作的标签。 * @method getTag * @return {Number} */