diff --git a/cocos2d/actions/CCAction.js b/cocos2d/actions/CCAction.js index a1de81b5f4..0d62a26c42 100644 --- a/cocos2d/actions/CCAction.js +++ b/cocos2d/actions/CCAction.js @@ -24,6 +24,10 @@ THE SOFTWARE. ****************************************************************************/ +/** + * @module actions + */ + /** Default Action tag * @constant * @type {Number} @@ -32,16 +36,12 @@ cc.ACTION_TAG_INVALID = -1; /** - * Base class for cc.Action objects. - * @class + * Base class cc.Action for action classes. + * @class Action * - * @extends cc._Class - * - * @property {_ccsg.Node} target - The target will be set with the 'startWithTarget' method. When the 'stop' method is called, target will be set to nil. - * @property {_ccsg.Node} originalTarget - The original target of the action. - * @property {Number} tag - The tag of the action, can be used to find the action. + * @extends _Class */ -cc.Action = cc._Class.extend(/** @lends cc.Action# */{ +cc.Action = cc._Class.extend({ //***********variables************* originalTarget:null, target:null, @@ -49,32 +49,17 @@ cc.Action = cc._Class.extend(/** @lends cc.Action# */{ //**************Public Functions*********** - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - */ ctor:function () { this.originalTarget = null; this.target = null; this.tag = cc.ACTION_TAG_INVALID; }, - /** - * to copy object with deep copy. - * - * @deprecated since v3.0 please use .clone - * - * @return {cc.Action} - */ - copy:function () { - cc.log("copy is deprecated. Please use clone instead."); - return this.clone(); - }, - /** * to copy object with deep copy. * returns a clone of action. - * - * @return {cc.Action} + * @method clone + * @return {Action} */ clone:function () { var action = new cc.Action(); @@ -86,54 +71,38 @@ cc.Action = cc._Class.extend(/** @lends cc.Action# */{ /** * return true if the action has finished. - * + * @method isDone * @return {Boolean} */ isDone:function () { return true; }, - /** - * called before the action start. It will also set the target. - * - * @param {_ccsg.Node} target - */ + // called before the action start. It will also set the target. startWithTarget:function (target) { this.originalTarget = target; this.target = target; }, - /** - * called after the action has finished. It will set the 'target' to nil.
- * IMPORTANT: You should never call "action stop" manually. Instead, use: "target.stopAction(action);" - */ + // called after the action has finished. It will set the 'target' to nil. stop:function () { this.target = null; }, - /** - * called every frame with it's delta time.
- * DON'T override unless you know what you are doing. - * - * @param {Number} dt - */ + // called every frame with it's delta time.
step:function (dt) { cc.log("[Action step]. override me"); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ + // Called once per frame. Time is the number of seconds of a frame interval. update:function (dt) { cc.log("[Action update]. override me"); }, /** * get the target. - * - * @return {_ccsg.Node} + * @method getTarget + * @return {Node} */ getTarget:function () { return this.target; @@ -141,8 +110,8 @@ cc.Action = cc._Class.extend(/** @lends cc.Action# */{ /** * The action will modify the target properties. - * - * @param {_ccsg.Node} target + * @method setTarget + * @param {Node} target */ setTarget:function (target) { this.target = target; @@ -150,26 +119,23 @@ cc.Action = cc._Class.extend(/** @lends cc.Action# */{ /** * get the original target. - * - * @return {_ccsg.Node} + * @method getOriginalTarget + * @return {Node} */ getOriginalTarget:function () { return this.originalTarget; }, - /** - * Set the original target, since target can be nil.
- * Is the target that were used to run the action.
- * Unless you are doing something complex, like cc.ActionManager, you should NOT call this method.
- * The target is 'assigned', it is not 'retained'.
- * @param {_ccsg.Node} originalTarget - */ + // Set the original target, since target can be nil. + // Is the target that were used to run the action. + // Unless you are doing something complex, like cc.ActionManager, you should NOT call this method. setOriginalTarget:function (originalTarget) { this.originalTarget = originalTarget; }, /** * get tag number. + * @method getTag * @return {Number} */ getTag:function () { @@ -178,52 +144,30 @@ cc.Action = cc._Class.extend(/** @lends cc.Action# */{ /** * set tag number. + * @method setTag * @param {Number} tag */ setTag:function (tag) { this.tag = tag; }, - /** - * Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB,
- * and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB.
- * This is a hack, and should be removed once JSB fixes the retain/release bug. - */ + // Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB, + // and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB. + // This is a hack, and should be removed once JSB fixes the retain/release bug. retain:function () { }, - /** - * Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB,
- * and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB.
- * This is a hack, and should be removed once JSB fixes the retain/release bug. - */ + // Currently JavaScript Bindigns (JSB), in some cases, needs to use retain and release. This is a bug in JSB, + // and the ugly workaround is to use retain/release. So, these 2 methods were added to be compatible with JSB. + // This is a hack, and should be removed once JSB fixes the retain/release bug. release:function () { } }); -/** - * Allocates and initializes the action. - * - * @function cc.action - * @static - * @return {cc.Action} - * - * @example - * // return {cc.Action} - * var action = cc.action(); - */ cc.action = function () { return new cc.Action(); }; -/** - * Please use cc.action instead.
- * Allocates and initializes the action. - * - * @deprecated since v3.0 please use cc.action() instead. - * @static - * @returns {cc.Action} - */ cc.Action.create = cc.action; @@ -234,16 +178,13 @@ cc.Action.create = cc.action; * - An action with a duration of 35.5 seconds. * * Infinite time actions are valid - * @class - * @extends cc.Action + * @class FiniteTimeAction + * @extends Action */ -cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{ +cc.FiniteTimeAction = cc.Action.extend({ //! duration in seconds _duration:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - */ ctor:function () { cc.Action.prototype.ctor.call(this); this._duration = 0; @@ -251,7 +192,7 @@ cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{ /** * get duration of the action. (seconds) - * + * @method getDuration * @return {Number} */ getDuration:function () { @@ -260,7 +201,7 @@ cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{ /** * set duration of the action. (seconds) - * + * @method setDuration * @param {Number} duration */ setDuration:function (duration) { @@ -273,7 +214,7 @@ cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{ * - 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 - * + * @method reverse * @return {Null} */ reverse:function () { @@ -284,8 +225,8 @@ cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{ /** * to copy object with deep copy. * returns a clone of action. - * - * @return {cc.FiniteTimeAction} + * @method clone + * @return {FiniteTimeAction} */ clone:function () { return new cc.FiniteTimeAction(); @@ -293,23 +234,27 @@ cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{ }); /** + * @module actions + */ + +/* * 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. * * @warning This action can't be Sequenceable because it is not an cc.IntervalAction * @class - * @extends cc.Action - * @param {cc.ActionInterval} action + * @extends Action + * @param {ActionInterval} action * @param {Number} speed */ -cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ +cc.Speed = cc.Action.extend({ _speed:0.0, _innerAction:null, - /** + /* * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {cc.ActionInterval} action + * @param {ActionInterval} action * @param {Number} speed */ ctor:function (action, speed) { @@ -320,7 +265,7 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ action && this.initWithAction(action, speed); }, - /** + /* * Gets the current running speed.
* Will get a percentage number, compared to the original speed. * @@ -330,7 +275,7 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ return this._speed; }, - /** + /* * alter the speed of the inner function in runtime. * * @param {Number} speed @@ -339,10 +284,10 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ this._speed = speed; }, - /** + /* * initializes the action. * - * @param {cc.ActionInterval} action + * @param {ActionInterval} action * @param {Number} speed * @return {Boolean} */ @@ -355,71 +300,37 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ return true; }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.Speed} - */ clone:function () { var action = new cc.Speed(); action.initWithAction(this._innerAction.clone(), this._speed); return action; }, - /** - * called before the action start. It will also set the target. - * - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.Action.prototype.startWithTarget.call(this, target); this._innerAction.startWithTarget(target); }, - /** - * Stop the action. - */ stop:function () { this._innerAction.stop(); cc.Action.prototype.stop.call(this); }, - /** - * called every frame with it's delta time.
- * DON'T override unless you know what you are doing. - * - * @param {Number} dt - */ step:function (dt) { this._innerAction.step(dt * this._speed); }, - /** - * return true if the action has finished. - * - * @return {Boolean} - */ isDone:function () { return this._innerAction.isDone(); }, - /** - * 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 - * - * @return {cc.Speed} - */ reverse:function () { return new cc.Speed(this._innerAction.reverse(), this._speed); }, - /** + /* * Set inner Action. - * @param {cc.ActionInterval} action + * @param {ActionInterval} action */ setInnerAction:function (action) { if (this._innerAction !== action) { @@ -427,10 +338,10 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ } }, - /** + /* * Get inner Action. * - * @return {cc.ActionInterval} + * @return {ActionInterval} */ getInnerAction:function () { return this._innerAction; @@ -438,31 +349,25 @@ cc.Speed = cc.Action.extend(/** @lends cc.Speed# */{ }); /** - * creates the speed action. + * 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. * - * @function cc.speed - * @param {cc.ActionInterval} action + * @warning This action can't be Sequenceable because it is not an cc.IntervalAction + * + * @method cc.speed + * @param {ActionInterval} action * @param {Number} speed - * @return {cc.Speed} + * @return {Speed} */ cc.speed = function (action, speed) { return new cc.Speed(action, speed); }; -/** - * Please use cc.speed instead. - * creates the action. - * - * @param {cc.ActionInterval} action - * @param {Number} speed - * @return {cc.Speed} - * @static - * @deprecated since v3.0 please use cc.speed() instead. - */ cc.Speed.create = cc.speed; -/** - * cc.Follow is an action that "follows" a node. +/* + * cc.Follow is a follow action which makes its target follows another node. * * @example * //example @@ -475,7 +380,7 @@ cc.Speed.create = cc.speed; * @property {Number} bottomBoundary - world bottomBoundary. * * @param {_ccsg.Node} followedNode - * @param {cc.Rect} rect + * @param {Rect} rect * @example * // creates the action with a set boundary * var sprite = new _ccsg.Sprite("spriteFileName"); @@ -488,9 +393,9 @@ cc.Speed.create = cc.speed; * this.runAction(followAction); * * @class - * @extends cc.Action + * @extends Action */ -cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ +cc.Follow = cc.Action.extend({ // node to follow _followedNode:null, // whether camera should be limited to certain area @@ -512,7 +417,7 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ * creates the action with a set boundary.
* creates the action with no boundary set. * @param {_ccsg.Node} followedNode - * @param {cc.Rect} rect + * @param {Rect} rect */ ctor:function (followedNode, rect) { cc.Action.prototype.ctor.call(this); @@ -534,12 +439,6 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ : this.initWithTarget(followedNode); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.Follow} - */ clone:function () { var action = new cc.Follow(); var locRect = this._worldRect; @@ -548,7 +447,7 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ return action; }, - /** + /* * Get whether camera should be limited to certain area. * * @return {Boolean} @@ -557,7 +456,7 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ return this._boundarySet; }, - /** + /* * alter behavior - turn on/off boundary. * * @param {Boolean} value @@ -566,11 +465,11 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ this._boundarySet = value; }, - /** + /* * initializes the action with a set boundary. * * @param {_ccsg.Node} followedNode - * @param {cc.Rect} [rect=] + * @param {Rect} [rect=] * @return {Boolean} */ initWithTarget:function (followedNode, rect) { @@ -613,12 +512,6 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ return true; }, - /** - * called every frame with it's delta time.
- * DON'T override unless you know what you are doing. - * - * @param {Number} dt - */ step:function (dt) { var tempPosX = this._followedNode.x; var tempPosY = this._followedNode.y; @@ -639,18 +532,10 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ } }, - /** - * Return true if the action has finished. - * - * @return {Boolean} - */ isDone:function () { return ( !this._followedNode.running ); }, - /** - * Stop the action. - */ stop:function () { this.target = null; cc.Action.prototype.stop.call(this); @@ -658,37 +543,24 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{ }); /** - * creates the action with a set boundary.
- * creates the action with no boundary set. + * Create a follow action which makes its target follows another node. * - * @function - * @param {_ccsg.Node} followedNode - * @param {cc.Rect} rect - * @return {cc.Follow|Null} returns the cc.Follow object on success + * @method + * @param {Node} followedNode + * @param {Rect} rect + * @return {Follow|Null} returns the cc.Follow object on success * @example * // example * // creates the action with a set boundary - * var sprite = new _ccsg.Sprite("spriteFileName"); - * var followAction = cc.follow(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height)); - * this.runAction(followAction); + * var followAction = cc.follow(targetNode, cc.rect(0, 0, screenWidth * 2 - 100, screenHeight)); + * node.runAction(followAction); * * // creates the action with no boundary set - * var sprite = new _ccsg.Sprite("spriteFileName"); - * var followAction = cc.follow(sprite); - * this.runAction(followAction); + * var followAction = cc.follow(targetNode); + * node.runAction(followAction); */ cc.follow = function (followedNode, rect) { return new cc.Follow(followedNode, rect); }; -/** - * Please use cc.follow instead. - * creates the action with a set boundary.
- * creates the action with no boundary set. - * @param {_ccsg.Node} followedNode - * @param {cc.Rect} rect - * @return {cc.Follow|Null} returns the cc.Follow object on success - * @static - * @deprecated since v3.0 please cc.follow() instead. - */ cc.Follow.create = cc.follow; diff --git a/cocos2d/actions/CCActionCamera.js b/cocos2d/actions/CCActionCamera.js index cc1c0186aa..a346d0733e 100644 --- a/cocos2d/actions/CCActionCamera.js +++ b/cocos2d/actions/CCActionCamera.js @@ -27,9 +27,9 @@ /** * Base class for cc.Camera actions * @class - * @extends cc.ActionInterval + * @extends ActionInterval */ -cc.ActionCamera = cc.ActionInterval.extend(/** @lends cc.ActionCamera# */{ +cc.ActionCamera = cc.ActionInterval.extend({ _centerXOrig:0, _centerYOrig:0, _centerZOrig:0, @@ -88,7 +88,7 @@ cc.ActionCamera = cc.ActionInterval.extend(/** @lends cc.ActionCamera# */{ * to copy object with deep copy. * returns a new clone of the action * - * @returns {cc.ActionCamera} + * @returns {ActionCamera} */ clone:function(){ return new cc.ActionCamera(); @@ -119,9 +119,9 @@ cc.ActionCamera = cc.ActionInterval.extend(/** @lends cc.ActionCamera# */{ * @param {Number} deltaAngleX * * @class - * @extends cc.ActionCamera + * @extends ActionCamera */ -cc.OrbitCamera = cc.ActionCamera.extend(/** @lends cc.OrbitCamera# */{ +cc.OrbitCamera = cc.ActionCamera.extend({ _radius: 0.0, _deltaRadius: 0.0, _angleZ: 0.0, @@ -232,7 +232,7 @@ cc.OrbitCamera = cc.ActionCamera.extend(/** @lends cc.OrbitCamera# */{ * to copy object with deep copy. * returns a new clone of the action * - * @returns {cc.ActionCamera} + * @returns {ActionCamera} */ clone:function(){ var a = new cc.OrbitCamera(), _t = this; @@ -262,7 +262,7 @@ cc.OrbitCamera = cc.ActionCamera.extend(/** @lends cc.OrbitCamera# */{ /** * creates a cc.OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX - * @function + * @method * @param {Number} t time * @param {Number} radius * @param {Number} deltaRadius @@ -270,7 +270,7 @@ cc.OrbitCamera = cc.ActionCamera.extend(/** @lends cc.OrbitCamera# */{ * @param {Number} deltaAngleZ * @param {Number} angleX * @param {Number} deltaAngleX - * @return {cc.OrbitCamera} + * @return {OrbitCamera} */ cc.orbitCamera = function (t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX) { return new cc.OrbitCamera(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX); @@ -286,7 +286,7 @@ cc.orbitCamera = function (t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, * @param {Number} deltaAngleZ * @param {Number} angleX * @param {Number} deltaAngleX - * @return {cc.OrbitCamera} + * @return {OrbitCamera} * @static * @deprecated since v3.0 please use cc.orbitCamera() instead. */ diff --git a/cocos2d/actions/CCActionCatmullRom.js b/cocos2d/actions/CCActionCatmullRom.js index 6beb30a18b..c540d4d4be 100644 --- a/cocos2d/actions/CCActionCatmullRom.js +++ b/cocos2d/actions/CCActionCatmullRom.js @@ -33,18 +33,21 @@ ****************************************************************************/ /** + * @module actions + */ + +/* * Returns the Cardinal Spline position for a given set of control points, tension and time.
* CatmullRom Spline formula.
* s(-ttt + 2tt - t)P1 + s(-ttt + tt)P2 + (2ttt - 3tt + 1)P2 + s(ttt - 2tt + t)P3 + (-2ttt + 3tt)P3 + s(ttt - tt)P4 * - * @function - * @param {cc.Vec2} p0 - * @param {cc.Vec2} p1 - * @param {cc.Vec2} p2 - * @param {cc.Vec2} p3 + * @param {Vec2} p0 + * @param {Vec2} p1 + * @param {Vec2} p2 + * @param {Vec2} p3 * @param {Number} tension * @param {Number} t - * @return {cc.Vec2} + * @return {Vec2} */ cc.cardinalSplineAt = function (p0, p1, p2, p3, tension, t) { var t2 = t * t; @@ -65,7 +68,7 @@ cc.cardinalSplineAt = function (p0, p1, p2, p3, tension, t) { return cc.p(x, y); }; -/** +/* * returns a new copy of the array reversed. * * @return {Array} @@ -79,7 +82,7 @@ cc.reverseControlPoints = function (controlPoints) { }; -/** +/* * returns a new clone of the controlPoints * * @param controlPoints @@ -92,15 +95,9 @@ cc.cloneControlPoints = function (controlPoints) { return newArray; }; -/** - * returns a new clone of the controlPoints - * @deprecated since v3.0 please use cc.cloneControlPoints() instead. - * @param controlPoints - * @returns {Array} - */ cc.copyControlPoints = cc.cloneControlPoints; -/** +/* * returns a point from the array * * @param {Array} controlPoints @@ -112,7 +109,7 @@ cc.getControlPointAt = function (controlPoints, pos) { return controlPoints[p]; }; -/** +/* * reverse the current control point array inline, without generating a new one
* * @param controlPoints @@ -128,12 +125,12 @@ cc.reverseControlPointsInline = function (controlPoints) { }; -/** - * Cardinal Spline path. {@link http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline} +/* + * Cardinal Spline path. http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline * Absolute coordinates. * - * @class - * @extends cc.ActionInterval + * @class CardinalSplineTo + * @extends ActionInterval * @param {Number} duration * @param {Array} points array of control points * @param {Number} tension @@ -142,21 +139,14 @@ cc.reverseControlPointsInline = function (controlPoints) { * //create a cc.CardinalSplineTo * var action1 = cc.cardinalSplineTo(3, array, 0); */ -cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# */{ - /** Array of control points */ +cc.CardinalSplineTo = cc.ActionInterval.extend({ + /* Array of control points */ _points:null, _deltaT:0, _tension:0, _previousPosition:null, _accumulatedDiff:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates an action with a Cardinal Spline array of points and tension. - * @param {Number} duration - * @param {Array} points array of control points - * @param {Number} tension - */ ctor: function (duration, points, tension) { cc.ActionInterval.prototype.ctor.call(this); @@ -164,7 +154,7 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# * tension !== undefined && this.initWithDuration(duration, points, tension); }, - /** + /* * initializes the action with a duration and an array of points * * @param {Number} duration @@ -185,22 +175,12 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# * return false; }, - /** - * returns a new clone of the action - * - * @returns {cc.CardinalSplineTo} - */ clone:function () { var action = new cc.CardinalSplineTo(); action.initWithDuration(this._duration, cc.copyControlPoints(this._points), this._tension); return action; }, - /** - * called before the action start. It will also set the target. - * - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); // Issue #1441 from cocos2d-iphone @@ -209,11 +189,6 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# * this._accumulatedDiff = cc.p(0, 0); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); var p, lt; @@ -255,28 +230,22 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# * this.updatePosition(newPos); }, - /** - * reverse a new cc.CardinalSplineTo.
- * Along the track of movement in the opposite. - * - * @return {cc.CardinalSplineTo} - */ reverse:function () { var reversePoints = cc.reverseControlPoints(this._points); return cc.cardinalSplineTo(this._duration, reversePoints, this._tension); }, - /** + /* * update position of target * - * @param {cc.Vec2} newPos + * @param {Vec2} newPos */ updatePosition:function (newPos) { this.target.setPosition(newPos); this._previousPosition = newPos; }, - /** + /* * Points getter * * @return {Array} @@ -285,7 +254,7 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# * return this._points; }, - /** + /* * Points setter * * @param {Array} points @@ -298,11 +267,11 @@ cc.CardinalSplineTo = cc.ActionInterval.extend(/** @lends cc.CardinalSplineTo# * /** * creates an action with a Cardinal Spline array of points and tension. * - * @function + * @method cc.cardinalSplineTo * @param {Number} duration * @param {Array} points array of control points * @param {Number} tension - * @return {cc.CardinalSplineTo} + * @return {CardinalSplineTo} * * @example * //create a cc.CardinalSplineTo @@ -312,26 +281,14 @@ cc.cardinalSplineTo = function (duration, points, tension) { return new cc.CardinalSplineTo(duration, points, tension); }; -/** - * Please use cc.cardinalSplineTo instead.
- * creates an action with a Cardinal Spline array of points and tension - * - * @function - * @param {Number} duration - * @param {Array} points array of control points - * @param {Number} tension - * @return {cc.CardinalSplineTo} - * @static - * @deprecated since v3.0 please use cc.cardinalSplineTo(duration, points, tension) instead. - */ cc.CardinalSplineTo.create = cc.cardinalSplineTo; -/** - * Cardinal Spline path. {@link http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline} +/* + * Cardinal Spline path. http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline * Relative coordinates. * - * @class - * @extends cc.CardinalSplineTo + * @class CardinalSplineBy + * @extends CardinalSplineTo * @param {Number} duration * @param {Array} points * @param {Number} tension @@ -340,16 +297,9 @@ cc.CardinalSplineTo.create = cc.cardinalSplineTo; * //create a cc.CardinalSplineBy * var action1 = cc.cardinalSplineBy(3, array, 0); */ -cc.CardinalSplineBy = cc.CardinalSplineTo.extend(/** @lends cc.CardinalSplineBy# */{ +cc.CardinalSplineBy = cc.CardinalSplineTo.extend({ _startPosition:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * creates an action with a Cardinal Spline array of points and tension. - * @param {Number} duration - * @param {Array} points - * @param {Number} tension - */ ctor:function (duration, points, tension) { cc.CardinalSplineTo.prototype.ctor.call(this); this._startPosition = cc.p(0, 0); @@ -357,22 +307,12 @@ cc.CardinalSplineBy = cc.CardinalSplineTo.extend(/** @lends cc.CardinalSplineBy# tension !== undefined && this.initWithDuration(duration, points, tension); }, - /** - * called before the action start. It will also set the target. - * - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.CardinalSplineTo.prototype.startWithTarget.call(this, target); this._startPosition.x = target.getPositionX(); this._startPosition.y = target.getPositionY(); }, - /** - * reverse a new cc.CardinalSplineBy - * - * @return {cc.CardinalSplineBy} - */ reverse:function () { var copyConfig = this._points.slice(); var current; @@ -409,10 +349,10 @@ cc.CardinalSplineBy = cc.CardinalSplineTo.extend(/** @lends cc.CardinalSplineBy# return cc.cardinalSplineBy(this._duration, reverseArray, this._tension); }, - /** + /* * update position of target * - * @param {cc.Vec2} newPos + * @param {Vec2} newPos */ updatePosition:function (newPos) { var pos = this._startPosition; @@ -423,10 +363,10 @@ cc.CardinalSplineBy = cc.CardinalSplineTo.extend(/** @lends cc.CardinalSplineBy# this.target.setPosition(posX, posY); }, - /** + /* * returns a new clone of the action * - * @returns {cc.CardinalSplineBy} + * @returns {CardinalSplineBy} */ clone:function () { var a = new cc.CardinalSplineBy(); @@ -438,57 +378,39 @@ cc.CardinalSplineBy = cc.CardinalSplineTo.extend(/** @lends cc.CardinalSplineBy# /** * creates an action with a Cardinal Spline array of points and tension. * - * @function + * @method cc.cardinalSplineBy * @param {Number} duration * @param {Array} points * @param {Number} tension * - * @return {cc.CardinalSplineBy} + * @return {CardinalSplineBy} */ cc.cardinalSplineBy = function (duration, points, tension) { return new cc.CardinalSplineBy(duration, points, tension); }; - -/** - * Please use cc.cardinalSplineBy instead. - * creates an action with a Cardinal Spline array of points and tension. - * @function - * @param {Number} duration - * @param {Array} points - * @param {Number} tension - * @return {cc.CardinalSplineBy} - * @static - * @deprecated since v3.0 please use cc.cardinalSplineBy(duration, points, tension); - */ cc.CardinalSplineBy.create = cc.cardinalSplineBy; -/** +/* * An action that moves the target with a CatmullRom curve to a destination point.
* A Catmull Rom is a Cardinal Spline with a tension of 0.5.
- * {@link http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline} + * http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline * Absolute coordinates. * - * @class - * @extends cc.CardinalSplineTo + * @class CatmullRomTo + * @extends CardinalSplineTo * @param {Number} dt * @param {Array} points * * @example * var action1 = cc.catmullRomTo(3, array); */ -cc.CatmullRomTo = cc.CardinalSplineTo.extend(/** @lends cc.CatmullRomTo# */{ +cc.CatmullRomTo = cc.CardinalSplineTo.extend({ - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * creates an action with a Cardinal Spline array of points and tension. - * @param {Number} dt - * @param {Array} points - */ ctor: function(dt, points) { points && this.initWithDuration(dt, points); }, - /** + /* * Initializes the action with a duration and an array of points * * @param {Number} dt @@ -498,10 +420,6 @@ cc.CatmullRomTo = cc.CardinalSplineTo.extend(/** @lends cc.CatmullRomTo# */{ return cc.CardinalSplineTo.prototype.initWithDuration.call(this, dt, points, 0.5); }, - /** - * returns a new clone of the action - * @returns {cc.CatmullRomTo} - */ clone:function () { var action = new cc.CatmullRomTo(); action.initWithDuration(this._duration, cc.copyControlPoints(this._points)); @@ -512,10 +430,10 @@ cc.CatmullRomTo = cc.CardinalSplineTo.extend(/** @lends cc.CatmullRomTo# */{ /** * creates an action with a Cardinal Spline array of points and tension. * - * @function + * @method cc.catmullRomTo * @param {Number} dt * @param {Array} points - * @return {cc.CatmullRomTo} + * @return {CatmullRomTo} * * @example * var action1 = cc.catmullRomTo(3, array); @@ -523,26 +441,16 @@ cc.CatmullRomTo = cc.CardinalSplineTo.extend(/** @lends cc.CatmullRomTo# */{ cc.catmullRomTo = function (dt, points) { return new cc.CatmullRomTo(dt, points); }; -/** - * Please use cc.catmullRomTo instead. - * creates an action with a Cardinal Spline array of points and tension. - * - * @param {Number} dt - * @param {Array} points - * @return {cc.CatmullRomTo} - * @static - * @deprecated since v3.0 please use cc.catmullRomTo(dt, points) instead. - */ cc.CatmullRomTo.create = cc.catmullRomTo; -/** +/* * An action that moves the target with a CatmullRom curve by a certain distance.
* A Catmull Rom is a Cardinal Spline with a tension of 0.5.
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline * Relative coordinates. * - * @class - * @extends cc.CardinalSplineBy + * @class CatmullRomBy + * @extends CardinalSplineBy * @param {Number} dt * @param {Array} points * @@ -551,21 +459,15 @@ cc.CatmullRomTo.create = cc.catmullRomTo; */ cc.CatmullRomBy = cc.CardinalSplineBy.extend({ - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates an action with a Cardinal Spline array of points and tension. - * @param {Number} dt - * @param {Array} points - */ ctor: function(dt, points) { cc.CardinalSplineBy.prototype.ctor.call(this); points && this.initWithDuration(dt, points); }, - /** + /* * initializes the action with a duration and an array of points * - * @function + * @method * @param {Number} dt * @param {Array} points */ @@ -573,10 +475,6 @@ cc.CatmullRomBy = cc.CardinalSplineBy.extend({ return cc.CardinalSplineTo.prototype.initWithDuration.call(this, dt, points, 0.5); }, - /** - * returns a new clone of the action - * @returns {cc.CatmullRomBy} - */ clone:function () { var action = new cc.CatmullRomBy(); action.initWithDuration(this._duration, cc.copyControlPoints(this._points)); @@ -586,20 +484,14 @@ cc.CatmullRomBy = cc.CardinalSplineBy.extend({ /** * Creates an action with a Cardinal Spline array of points and tension - * @function + * @method cc.catmullRomBy * @param {Number} dt * @param {Array} points - * @return {cc.CatmullRomBy} + * @return {CatmullRomBy} * @example * var action1 = cc.catmullRomBy(3, array); */ cc.catmullRomBy = function (dt, points) { return new cc.CatmullRomBy(dt, points); }; -/** - * Please use cc.catmullRomBy instead - * Creates an action with a Cardinal Spline array of points and tension - * @static - * @deprecated since v3.0 please cc.catmullRomBy(dt, points) instead. - */ cc.CatmullRomBy.create = cc.catmullRomBy; diff --git a/cocos2d/actions/CCActionEase.js b/cocos2d/actions/CCActionEase.js index e5f27d8017..cd198af3aa 100644 --- a/cocos2d/actions/CCActionEase.js +++ b/cocos2d/actions/CCActionEase.js @@ -25,24 +25,18 @@ ****************************************************************************/ /** - * Base class for Easing actions - * @class - * @extends cc.ActionInterval - * @param {cc.ActionInterval} action - * - * @deprecated since v3.0 Does not recommend the use of the base object. - * - * @example - * var moveEase = new cc.ActionEase(action); + * @module actions */ -cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{ + +/** + * Base class for Easing actions + * @class ActionEase + * @extends ActionInterval + * @param {ActionInterval} action + */ +cc.ActionEase = cc.ActionInterval.extend({ _inner:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * creates the action of ActionEase. - * @param {cc.ActionInterval} action - */ ctor: function (action) { cc.ActionInterval.prototype.ctor.call(this); action && this.initWithAction(action); @@ -51,7 +45,7 @@ cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{ /** * initializes the action * - * @param {cc.ActionInterval} action + * @param {ActionInterval} action * @return {Boolean} */ initWithAction:function (action) { @@ -65,53 +59,26 @@ cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{ return false; }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.ActionEase} - */ clone:function(){ var action = new cc.ActionEase(); action.initWithAction(this._inner.clone()); return action; }, - /** - * called before the action start. It will also set the target. - * - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._inner.startWithTarget(this.target); }, - /** - * Stop the action. - */ stop:function () { this._inner.stop(); cc.ActionInterval.prototype.stop.call(this); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this._inner.update(dt); }, - /** - * Create new action to original operation effect opposite.
- * 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 - * @return {cc.ActionEase} - */ reverse:function () { return new cc.ActionEase(this._inner.reverse()); }, @@ -119,62 +86,30 @@ cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{ /** * Get inner Action. * - * @return {cc.ActionInterval} + * @return {ActionInterval} */ getInnerAction:function(){ return this._inner; } }); -/** - * creates the action of ActionEase - * - * @param {cc.ActionInterval} action - * @return {cc.ActionEase} - * @example - * // example - * var moveEase = cc.actionEase(action); - */ cc.actionEase = function (action) { return new cc.ActionEase(action); }; -/** - * Please use cc.actionEase instead - * creates the action of ActionEase - * - * @param {cc.ActionInterval} action - * @return {cc.ActionEase} - * @static - * @deprecated since v3.0 please use cc.actionEase(action) instead. - */ cc.ActionEase.create = cc.actionEase; /** * Base class for Easing actions with rate parameters * - * @class - * @extends cc.ActionEase - * @param {cc.ActionInterval} action + * @class EaseRateAction + * @extends ActionEase + * @param {ActionInterval} action * @param {Number} rate - * - * @deprecated since v3.0 please cc.easeRateAction(action, 3.0); - * - * @example - * //The old usage - * cc.EaseRateAction.create(action, 3.0); - * //The new usage - * var moveEaseRateAction = cc.easeRateAction(action, 3.0); */ -cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{ +cc.EaseRateAction = cc.ActionEase.extend({ _rate:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates the action with the inner action and the rate parameter. - * @param {cc.ActionInterval} action - * @param {Number} rate - */ ctor: function(action, rate){ cc.ActionEase.prototype.ctor.call(this); @@ -198,7 +133,7 @@ cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{ /** * Initializes the action with the inner action and the rate parameter - * @param {cc.ActionInterval} action + * @param {ActionInterval} action * @param {Number} rate * @return {Boolean} */ @@ -210,67 +145,32 @@ cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{ return false; }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseRateAction} - */ clone:function(){ var action = new cc.EaseRateAction(); action.initWithAction(this._inner.clone(), this._rate); return action; }, - /** - * Create new action to original operation effect opposite.
- * 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 - * @return {cc.EaseRateAction} - */ reverse:function () { return new cc.EaseRateAction(this._inner.reverse(), 1 / this._rate); } }); -/** - * Creates the action with the inner action and the rate parameter. - * - * @param {cc.ActionInterval} action - * @param {Number} rate - * @return {cc.EaseRateAction} - * @example - * // example - * var moveEaseRateAction = cc.easeRateAction(action, 3.0); - */ cc.easeRateAction = function (action, rate) { return new cc.EaseRateAction(action, rate); }; -/** - * Please use cc.easeRateAction instead.
- * Creates the action with the inner action and the rate parameter. - * - * @param {cc.ActionInterval} action - * @param {Number} rate - * @return {cc.EaseRateAction} - * @static - * @deprecated since v3.0 please use cc.easeRateAction(action, rate) - * @example - * //The old usage - * cc.EaseRateAction.create(action, 3.0); - * //The new usage - * var moveEaseRateAction = cc.easeRateAction(action, 3.0); - */ cc.EaseRateAction.create = cc.easeRateAction; /** + * @module actions + */ + +/* * cc.EaseIn action with a rate. From slow to fast. * - * @class - * @extends cc.EaseRateAction + * @class EaseIn + * @extends EaseRateAction * * @deprecated since v3.0 please use action.easing(cc.easeIn(3)); * @@ -280,31 +180,16 @@ cc.EaseRateAction.create = cc.easeRateAction; * //The new usage * action.easing(cc.easeIn(3.0)); */ -cc.EaseIn = cc.EaseRateAction.extend(/** @lends cc.EaseIn# */{ +cc.EaseIn = cc.EaseRateAction.extend({ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this._inner.update(Math.pow(dt, this._rate)); }, - /** - * Create a cc.easeIn action. Opposite with the original motion trajectory. - * @return {cc.EaseIn} - */ reverse:function () { return new cc.EaseIn(this._inner.reverse(), 1 / this._rate); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseIn} - */ clone:function(){ var action = new cc.EaseIn(); action.initWithAction(this._inner.clone(), this._rate); @@ -312,23 +197,6 @@ cc.EaseIn = cc.EaseRateAction.extend(/** @lends cc.EaseIn# */{ } }); -/** - * Creates the action with the inner action and the rate parameter.
- * From slow to fast. - * - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeIn(3)) - * - * @example - * //The old usage - * cc.EaseIn.create(action, 3); - * //The new usage - * action.easing(cc.easeIn(3.0)); - * - * @param {cc.ActionInterval} action - * @param {Number} rate - * @return {cc.EaseIn} - */ cc.EaseIn.create = function (action, rate) { return new cc.EaseIn(action, rate); }; @@ -337,7 +205,7 @@ cc.EaseIn.create = function (action, rate) { * Creates the action easing object with the rate parameter.
* From slow to fast. * - * @function + * @method cc.easeIn * @param {Number} rate * @return {Object} * @example @@ -356,11 +224,11 @@ cc.easeIn = function (rate) { }; }; -/** +/* * cc.EaseOut action with a rate. From fast to slow. * - * @class - * @extends cc.EaseRateAction + * @class EaseOut + * @extends EaseRateAction * * @deprecated since v3.0 please use action.easing(cc.easeOut(3)) * @@ -370,30 +238,15 @@ cc.easeIn = function (rate) { * //The new usage * action.easing(cc.easeOut(3.0)); */ -cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseOut = cc.EaseRateAction.extend({ update:function (dt) { this._inner.update(Math.pow(dt, 1 / this._rate)); }, - /** - * Create a cc.easeIn action. Opposite with the original motion trajectory. - * @return {cc.EaseOut} - */ reverse:function () { return new cc.EaseOut(this._inner.reverse(), 1 / this._rate); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseOut} - */ clone:function(){ var action = new cc.EaseOut(); action.initWithAction(this._inner.clone(),this._rate); @@ -401,23 +254,6 @@ cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{ } }); -/** - * Creates the action with the inner action and the rate parameter.
- * From fast to slow. - * - * @static - * @deprecated since v3.0
Please use cc.easeOut instead. - * - * @example - * //The old usage - * cc.EaseOut.create(action, 3); - * //The new usage - * action.easing(cc.easeOut(3.0)); - * - * @param {cc.ActionInterval} action - * @param {Number} rate - * @return {cc.EaseOut} - */ cc.EaseOut.create = function (action, rate) { return new cc.EaseOut(action, rate); }; @@ -426,7 +262,7 @@ cc.EaseOut.create = function (action, rate) { * Creates the action easing object with the rate parameter.
* From fast to slow. * - * @function + * @method cc.easeOut * @param {Number} rate * @return {Object} * @example @@ -440,16 +276,16 @@ cc.easeOut = function (rate) { return Math.pow(dt, 1 / this._rate); }, reverse: function(){ - return cc.easeOut(1 / this._rate) + return cc.easeOut(1 / this._rate); } }; }; -/** +/* * cc.EaseInOut action with a rate.
* Slow to fast then to slow. - * @class - * @extends cc.EaseRateAction + * @class EaseInOut + * @extends EaseRateAction * * @deprecated since v3.0 please use action.easing(cc.easeInOut(3.0)) * @@ -459,12 +295,7 @@ cc.easeOut = function (rate) { * //The new usage * action.easing(cc.easeInOut(3.0)); */ -cc.EaseInOut = cc.EaseRateAction.extend(/** @lends cc.EaseInOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseInOut = cc.EaseRateAction.extend({ update:function (dt) { dt *= 2; if (dt < 1) @@ -473,43 +304,17 @@ cc.EaseInOut = cc.EaseRateAction.extend(/** @lends cc.EaseInOut# */{ this._inner.update(1.0 - 0.5 * Math.pow(2 - dt, this._rate)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseInOut} - */ clone:function(){ var action = new cc.EaseInOut(); action.initWithAction(this._inner.clone(), this._rate); return action; }, - /** - * Create a cc.EaseInOut action. Opposite with the original motion trajectory. - * @return {cc.EaseInOut} - */ reverse:function () { return new cc.EaseInOut(this._inner.reverse(), this._rate); } }); -/** - * Creates the action with the inner action and the rate parameter. - * Slow to fast then to slow. - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeInOut(3.0)) - * - * @example - * //The old usage - * cc.EaseInOut.create(action, 3); - * //The new usage - * action.easing(cc.easeInOut(3.0)); - * - * @param {cc.ActionInterval} action - * @param {Number} rate - * @return {cc.EaseInOut} - */ cc.EaseInOut.create = function (action, rate) { return new cc.EaseInOut(action, rate); }; @@ -517,7 +322,7 @@ cc.EaseInOut.create = function (action, rate) { /** * Creates the action easing object with the rate parameter.
* Slow to fast then to slow. - * @function + * @method cc.easeInOut * @param {Number} rate * @return {Object} * @@ -541,12 +346,12 @@ cc.easeInOut = function (rate) { }; }; -/** +/* * cc.Ease Exponential In. Slow to Fast.
* Reference easeInExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseExponentialIn + * @extends ActionEase * * @deprecated since v3.0 please action.easing(cc.easeExponentialIn()) * @@ -556,30 +361,15 @@ cc.easeInOut = function (rate) { * //The new usage * action.easing(cc.easeExponentialIn()); */ -cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseExponentialIn = cc.ActionEase.extend({ update:function (dt) { this._inner.update(dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1))); }, - /** - * Create a cc.EaseExponentialOut action. Opposite with the original motion trajectory. - * @return {cc.EaseExponentialOut} - */ reverse:function () { return new cc.EaseExponentialOut(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseExponentialIn} - */ clone:function(){ var action = new cc.EaseExponentialIn(); action.initWithAction(this._inner.clone()); @@ -587,21 +377,6 @@ cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{ } }); -/** - * Creates the action easing object with the rate parameter.
- * Reference easeInExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeExponentialIn()) - * @param {cc.ActionInterval} action - * @return {cc.EaseExponentialIn} - * - * @example - * //The old usage - * cc.EaseExponentialIn.create(action); - * //The new usage - * action.easing(cc.easeExponentialIn()); - */ cc.EaseExponentialIn.create = function (action) { return new cc.EaseExponentialIn(action); }; @@ -618,8 +393,8 @@ cc._easeExponentialInObj = { /** * Creates the action easing object with the rate parameter.
* Reference easeInExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeExponentialIn * @return {Object} * @example * // example @@ -629,12 +404,12 @@ cc.easeExponentialIn = function(){ return cc._easeExponentialInObj; }; -/** +/* * Ease Exponential Out.
* Reference easeOutExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseExponentialOut + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeExponentialOut()) * @@ -644,30 +419,15 @@ cc.easeExponentialIn = function(){ * //The new usage * action.easing(cc.easeExponentialOut()); */ -cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseExponentialOut = cc.ActionEase.extend({ update:function (dt) { this._inner.update(dt === 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1)); }, - /** - * Create a cc.EaseExponentialIn action. Opposite with the original motion trajectory. - * @return {cc.EaseExponentialIn} - */ reverse:function () { return new cc.EaseExponentialIn(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseExponentialOut} - */ clone:function(){ var action = new cc.EaseExponentialOut(); action.initWithAction(this._inner.clone()); @@ -675,21 +435,6 @@ cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# * } }); -/** - * Creates the action easing object with the rate parameter.
- * Reference easeOutExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeExponentialOut()) - * @param {cc.ActionInterval} action - * @return {Object} - * - * @example - * //The old usage - * cc.EaseExponentialOut.create(action); - * //The new usage - * action.easing(cc.easeExponentialOut()); - */ cc.EaseExponentialOut.create = function (action) { return new cc.EaseExponentialOut(action); }; @@ -706,8 +451,8 @@ cc._easeExponentialOutObj = { /** * creates the action easing object.
* Reference easeOutExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeExponentialOut * @return {Object} * @example * // example @@ -717,13 +462,13 @@ cc.easeExponentialOut = function(){ return cc._easeExponentialOutObj; }; -/** +/* * Ease Exponential InOut.
* Reference easeInOutExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} + * http://www.zhihu.com/question/21981571/answer/19925418 * - * @class - * @extends cc.ActionEase + * @class EaseExponentialInOut + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeExponentialInOut) * @@ -733,12 +478,7 @@ cc.easeExponentialOut = function(){ * //The new usage * action.easing(cc.easeExponentialInOut()); */ -cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseExponentialInOut = cc.ActionEase.extend({ update:function (dt) { if( dt !== 1 && dt !== 0) { dt *= 2; @@ -750,20 +490,10 @@ cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOu this._inner.update(dt); }, - /** - * Create a cc.EaseExponentialInOut action. Opposite with the original motion trajectory. - * @return {cc.EaseExponentialInOut} - */ reverse:function () { return new cc.EaseExponentialInOut(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseExponentialInOut} - */ clone:function(){ var action = new cc.EaseExponentialInOut(); action.initWithAction(this._inner.clone()); @@ -771,21 +501,6 @@ cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOu } }); -/** - * creates an EaseExponentialInOut action.
- * Reference easeInOutExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeExponentialInOut) - * @param {cc.ActionInterval} action - * @return {cc.EaseExponentialInOut} - * - * @example - * //The old usage - * cc.EaseExponentialInOut.create(action); - * //The new usage - * action.easing(cc.easeExponentialInOut()); - */ cc.EaseExponentialInOut.create = function (action) { return new cc.EaseExponentialInOut(action); }; @@ -809,8 +524,8 @@ cc._easeExponentialInOutObj = { /** * creates an EaseExponentialInOut action easing object.
* Reference easeInOutExpo:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeExponentialInOut * @return {Object} * @example * // example @@ -820,12 +535,12 @@ cc.easeExponentialInOut = function(){ return cc._easeExponentialInOutObj; }; -/** +/* * Ease Sine In.
* Reference easeInSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseSineIn + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeSineIn()) * @@ -835,31 +550,16 @@ cc.easeExponentialInOut = function(){ * //The new usage * action.easing(cc.easeSineIn()); */ -cc.EaseSineIn = cc.ActionEase.extend(/** @lends cc.EaseSineIn# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseSineIn = cc.ActionEase.extend({ update:function (dt) { dt = dt===0 || dt===1 ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1; this._inner.update(dt); }, - /** - * Create a cc.EaseSineOut action. Opposite with the original motion trajectory. - * @return {cc.EaseSineOut} - */ reverse:function () { return new cc.EaseSineOut(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseSineIn} - */ clone:function(){ var action = new cc.EaseSineIn(); action.initWithAction(this._inner.clone()); @@ -867,21 +567,6 @@ cc.EaseSineIn = cc.ActionEase.extend(/** @lends cc.EaseSineIn# */{ } }); -/** - * creates an EaseSineIn action.
- * Reference easeInSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeSineIn()) - * @param {cc.ActionInterval} action - * @return {cc.EaseSineIn} - * - * @example - * //The old usage - * cc.EaseSineIn.create(action); - * //The new usage - * action.easing(cc.easeSineIn()); - */ cc.EaseSineIn.create = function (action) { return new cc.EaseSineIn(action); }; @@ -897,8 +582,8 @@ cc._easeSineInObj = { /** * creates an EaseSineIn action.
* Reference easeInSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeSineIn * @return {Object} * @example * // example @@ -908,12 +593,12 @@ cc.easeSineIn = function(){ return cc._easeSineInObj; }; -/** +/* * Ease Sine Out.
* Reference easeOutSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseSineOut + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeSineOut()) * @@ -923,31 +608,16 @@ cc.easeSineIn = function(){ * //The new usage * action.easing(cc.easeSineOut()); */ -cc.EaseSineOut = cc.ActionEase.extend(/** @lends cc.EaseSineOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseSineOut = cc.ActionEase.extend({ update:function (dt) { dt = dt===0 || dt===1 ? dt : Math.sin(dt * Math.PI / 2); this._inner.update(dt); }, - /** - * Create a cc.EaseSineIn action. Opposite with the original motion trajectory. - * @return {cc.EaseSineIn} - */ reverse:function () { return new cc.EaseSineIn(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseSineOut} - */ clone:function(){ var action = new cc.EaseSineOut(); action.initWithAction(this._inner.clone()); @@ -955,21 +625,6 @@ cc.EaseSineOut = cc.ActionEase.extend(/** @lends cc.EaseSineOut# */{ } }); -/** - * Creates an EaseSineOut action.
- * Reference easeOutSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeSineOut()) - * @param {cc.ActionInterval} action - * @return {cc.EaseSineOut} - * - * @example - * //The old usage - * cc.EaseSineOut.create(action); - * //The new usage - * action.easing(cc.easeSineOut()); - */ cc.EaseSineOut.create = function (action) { return new cc.EaseSineOut(action); }; @@ -986,8 +641,8 @@ cc._easeSineOutObj = { /** * Creates an EaseSineOut action easing object.
* Reference easeOutSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeSineOut * @return {Object} * @example * // example @@ -997,12 +652,12 @@ cc.easeSineOut = function(){ return cc._easeSineOutObj; }; -/** +/* * Ease Sine InOut.
* Reference easeInOutSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class cc.EaseSineInOut + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeSineInOut()) * @@ -1012,53 +667,23 @@ cc.easeSineOut = function(){ * //The new usage * action.easing(cc.easeSineInOut()); */ -cc.EaseSineInOut = cc.ActionEase.extend(/** @lends cc.EaseSineInOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseSineInOut = cc.ActionEase.extend({ update:function (dt) { dt = dt===0 || dt===1 ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1); this._inner.update(dt); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseSineInOut} - */ clone:function(){ var action = new cc.EaseSineInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a cc.EaseSineInOut action. Opposite with the original motion trajectory. - * @return {cc.EaseSineInOut} - */ reverse:function () { return new cc.EaseSineInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInOutSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @param {cc.ActionInterval} action - * @return {cc.EaseSineInOut} - * @deprecated since v3.0
Please use action.easing(cc.easeSineInOut()) - * - * @example - * //The old usage - * cc.EaseSineInOut.create(action); - * //The new usage - * action.easing(cc.easeSineInOut()); - */ cc.EaseSineInOut.create = function (action) { return new cc.EaseSineInOut(action); }; @@ -1075,7 +700,8 @@ cc._easeSineInOutObj = { /** * creates the action easing object.
* Reference easeInOutSine:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeSineInOut * @return {Object} * @example * // example @@ -1087,22 +713,14 @@ cc.easeSineInOut = function(){ /** * Ease Elastic abstract class. - * @class - * @extends cc.ActionEase - * @param {cc.ActionInterval} action + * @class EaseElastic + * @extends ActionEase + * @param {ActionInterval} action * @param {Number} [period=0.3] - * - * @deprecated since v3.0 Does not recommend the use of the base object. */ -cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{ +cc.EaseElastic = cc.ActionEase.extend({ _period: 0.3, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates the action with the inner action and the period in radians (default is 0.3). - * @param {cc.ActionInterval} action - * @param {Number} [period=0.3] - */ ctor:function(action, period){ cc.ActionEase.prototype.ctor.call(this); @@ -1127,7 +745,7 @@ cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{ /** * Initializes the action with the inner action and the period in radians (default is 0.3) - * @param {cc.ActionInterval} action + * @param {ActionInterval} action * @param {Number} [period=0.3] * @return {Boolean} */ @@ -1137,22 +755,11 @@ cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{ return true; }, - /** - * Create a action. Opposite with the original motion trajectory.
- * Will be overwrite. - * @return {null} - */ reverse:function () { cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass."); return null; }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseElastic} - */ clone:function(){ var action = new cc.EaseElastic(); action.initWithAction(this._inner.clone(), this._period); @@ -1160,25 +767,21 @@ cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{ } }); -/** - * Creates the action with the inner action and the period in radians (default is 0.3). - * @static - * @deprecated since v3.0 Does not recommend the use of the base object. - * @param {cc.ActionInterval} action - * @param {Number} [period=0.3] - * @return {cc.EaseElastic} - */ cc.EaseElastic.create = function (action, period) { return new cc.EaseElastic(action, period); }; /** + * @module actions + */ + +/* * Ease Elastic In action.
* Reference easeInElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} + * http://www.zhihu.com/question/21981571/answer/19925418 * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.EaseElastic + * @class EaseElasticIn + * @extends EaseElastic * * @deprecated since v3.0 please use action.easing(cc.easeElasticIn()) * @@ -1188,12 +791,7 @@ cc.EaseElastic.create = function (action, period) { * //The new usage * action.easing(cc.easeElasticIn(period)); */ -cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseElasticIn = cc.EaseElastic.extend({ update:function (dt) { var newT = 0; if (dt === 0 || dt === 1) { @@ -1206,20 +804,10 @@ cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{ this._inner.update(newT); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseElasticOut} - */ reverse:function () { return new cc.EaseElasticOut(this._inner.reverse(), this._period); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseElasticIn} - */ clone:function(){ var action = new cc.EaseElasticIn(); action.initWithAction(this._inner.clone(), this._period); @@ -1227,22 +815,6 @@ cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{ } }); -/** - * Creates the action with the inner action and the period in radians (default is 0.3).
- * Reference easeInElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @deprecated since v3.0
Please use action.easing(cc.easeElasticIn(period)) - * - * @example - * //The old usage - * cc.EaseElasticIn.create(action, period); - * //The new usage - * action.easing(cc.easeElasticIn(period)); - * - * @param {cc.ActionInterval} action - * @param {Number} [period=0.3] - * @return {cc.EaseElasticIn} - */ cc.EaseElasticIn.create = function (action, period) { return new cc.EaseElasticIn(action, period); }; @@ -1263,8 +835,8 @@ cc._easeElasticInObj = { /** * Creates the action easing obejct with the period in radians (default is 0.3).
* Reference easeInElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeElasticIn * @param {Number} [period=0.3] * @return {Object} * @example @@ -1289,13 +861,13 @@ cc.easeElasticIn = function (period) { return cc._easeElasticInObj; }; -/** +/* * Ease Elastic Out action.
* Reference easeOutElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} + * http://www.zhihu.com/question/21981571/answer/19925418 * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.EaseElastic + * @class EaseElasticOut + * @extends EaseElastic * * @deprecated since v3.0
Please use action.easing(cc.easeElasticOut(period)) * @@ -1305,12 +877,7 @@ cc.easeElasticIn = function (period) { * //The new usage * action.easing(cc.easeElasticOut(period)); */ -cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseElasticOut = cc.EaseElastic.extend({ update:function (dt) { var newT = 0; if (dt === 0 || dt === 1) { @@ -1323,20 +890,10 @@ cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{ this._inner.update(newT); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseElasticIn} - */ reverse:function () { return new cc.EaseElasticIn(this._inner.reverse(), this._period); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseElasticOut} - */ clone:function(){ var action = new cc.EaseElasticOut(); action.initWithAction(this._inner.clone(), this._period); @@ -1344,21 +901,6 @@ cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{ } }); -/** - * Creates the action with the inner action and the period in radians (default is 0.3).
- * Reference easeOutElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @deprecated since v3.0
Please use action.easing(cc.easeElasticOut(period)) - * @param {cc.ActionInterval} action - * @param {Number} [period=0.3] - * @return {cc.EaseElasticOut} - * - * @example - * //The old usage - * cc.EaseElasticOut.create(action, period); - * //The new usage - * action.easing(cc.easeElasticOut(period)); - */ cc.EaseElasticOut.create = function (action, period) { return new cc.EaseElasticOut(action, period); }; @@ -1375,8 +917,8 @@ cc._easeElasticOutObj = { /** * Creates the action easing object with the period in radians (default is 0.3).
* Reference easeOutElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeElasticOut * @param {Number} [period=0.3] * @return {Object} * @example @@ -1398,13 +940,13 @@ cc.easeElasticOut = function (period) { return cc._easeElasticOutObj; }; -/** +/* * Ease Elastic InOut action.
* Reference easeInOutElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} + * http://www.zhihu.com/question/21981571/answer/19925418 * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.EaseElastic + * @class EaseElasticInOut + * @extends EaseElastic * * @deprecated since v3.0 please use action.easing(cc.easeElasticInOut()) * @@ -1414,12 +956,7 @@ cc.easeElasticOut = function (period) { * //The new usage * action.easing(cc.easeElasticInOut(period)); */ -cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseElasticInOut = cc.EaseElastic.extend({ update:function (dt) { var newT = 0; var locPeriod = this._period; @@ -1440,20 +977,10 @@ cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{ this._inner.update(newT); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseElasticInOut} - */ reverse:function () { return new cc.EaseElasticInOut(this._inner.reverse(), this._period); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseElasticInOut} - */ clone:function(){ var action = new cc.EaseElasticInOut(); action.initWithAction(this._inner.clone(), this._period); @@ -1461,21 +988,6 @@ cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{ } }); -/** - * Creates the action with the inner action and the period in radians (default is 0.3).
- * Reference easeInOutElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @deprecated since v3.0
Please use action.easing(cc.easeElasticInOut(period)) - * @param {cc.ActionInterval} action - * @param {Number} [period=0.3] - * @return {cc.EaseElasticInOut} - * - * @example - * //The old usage - * cc.EaseElasticInOut.create(action, period); - * //The new usage - * action.easing(cc.easeElasticInOut(period)); - */ cc.EaseElasticInOut.create = function (action, period) { return new cc.EaseElasticInOut(action, period); }; @@ -1483,8 +995,8 @@ cc.EaseElasticInOut.create = function (action, period) { /** * Creates the action easing object with the period in radians (default is 0.3).
* Reference easeInOutElastic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeElasticInOut * @param {Number} [period=0.3] * @return {Object} * @example @@ -1522,12 +1034,10 @@ cc.easeElasticInOut = function (period) { /** * cc.EaseBounce abstract class. * - * @deprecated since v3.0 Does not recommend the use of the base object. - * - * @class - * @extends cc.ActionEase + * @class EaseBounce + * @extends ActionEase */ -cc.EaseBounce = cc.ActionEase.extend(/** @lends cc.EaseBounce# */{ +cc.EaseBounce = cc.ActionEase.extend({ /** * @param {Number} time1 * @return {Number} @@ -1547,44 +1057,31 @@ cc.EaseBounce = cc.ActionEase.extend(/** @lends cc.EaseBounce# */{ return 7.5625 * time1 * time1 + 0.984375; }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBounce} - */ clone:function(){ var action = new cc.EaseBounce(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBounce} - */ reverse:function () { return new cc.EaseBounce(this._inner.reverse()); } }); -/** - * Creates an ease bounce action. - * @static - * @deprecated since v3.0 Does not recommend the use of the base object. - * @param {cc.ActionInterval} action - * @return {cc.EaseBounce} - */ cc.EaseBounce.create = function (action) { return new cc.EaseBounce(action); }; /** + * @module actions + */ + +/* * cc.EaseBounceIn action.
* Eased bounce effect at the beginning. * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.EaseBounce + * @class EaseBounceIn + * @extends EaseBounce * * @deprecated since v3.0 please use action.easing(cc.easeBounceIn()) * @@ -1594,31 +1091,16 @@ cc.EaseBounce.create = function (action) { * //The new usage * action.easing(cc.easeBounceIn()); */ -cc.EaseBounceIn = cc.EaseBounce.extend(/** @lends cc.EaseBounceIn# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseBounceIn = cc.EaseBounce.extend({ update:function (dt) { var newT = 1 - this.bounceTime(1 - dt); this._inner.update(newT); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBounceOut} - */ reverse:function () { return new cc.EaseBounceOut(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBounceIn} - */ clone:function(){ var action = new cc.EaseBounceIn(); action.initWithAction(this._inner.clone()); @@ -1626,20 +1108,6 @@ cc.EaseBounceIn = cc.EaseBounce.extend(/** @lends cc.EaseBounceIn# */{ } }); -/** - * Creates the action.
- * Eased bounce effect at the beginning. - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeBounceIn()) - * @param {cc.ActionInterval} action - * @return {cc.EaseBounceIn} - * - * @example - * //The old usage - * cc.EaseBounceIn.create(action); - * //The new usage - * action.easing(cc.easeBounceIn()); - */ cc.EaseBounceIn.create = function (action) { return new cc.EaseBounceIn(action); }; @@ -1671,7 +1139,7 @@ cc._easeBounceInObj = { /** * Creates the action easing object.
* Eased bounce effect at the beginning. - * @function + * @method cc.easeBounceIn * @return {Object} * @example * // example @@ -1681,12 +1149,12 @@ cc.easeBounceIn = function(){ return cc._easeBounceInObj; }; -/** +/* * cc.EaseBounceOut action.
* Eased bounce effect at the ending. * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.EaseBounce + * @class EaseBounceOut + * @extends EaseBounce * * @deprecated since v3.0 please use action.easing(cc.easeBounceOut()) * @@ -1696,31 +1164,16 @@ cc.easeBounceIn = function(){ * //The new usage * action.easing(cc.easeBounceOut()); */ -cc.EaseBounceOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseBounceOut = cc.EaseBounce.extend({ update:function (dt) { var newT = this.bounceTime(dt); this._inner.update(newT); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBounceIn} - */ reverse:function () { return new cc.EaseBounceIn(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBounceOut} - */ clone:function(){ var action = new cc.EaseBounceOut(); action.initWithAction(this._inner.clone()); @@ -1728,20 +1181,6 @@ cc.EaseBounceOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceOut# */{ } }); -/** - * Creates the action.
- * Eased bounce effect at the ending. - * @static - * @deprecated since v3.0 please use action.easing(cc.easeBounceOut()) - * @param {cc.ActionInterval} action - * @return {cc.EaseBounceOut} - * - * @example - * //The old usage - * cc.EaseBounceOut.create(action); - * //The new usage - * action.easing(cc.easeBounceOut()); - */ cc.EaseBounceOut.create = function (action) { return new cc.EaseBounceOut(action); }; @@ -1758,7 +1197,7 @@ cc._easeBounceOutObj = { /** * Creates the action easing object.
* Eased bounce effect at the ending. - * @function + * @method cc.easeBounceOut * @return {Object} * @example * // example @@ -1768,12 +1207,12 @@ cc.easeBounceOut = function(){ return cc._easeBounceOutObj; }; -/** +/* * cc.EaseBounceInOut action.
* Eased bounce effect at the begining and ending. * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.EaseBounce + * @class EaseBounceInOut + * @extends EaseBounce * * @deprecated since v3.0
Please use acton.easing(cc.easeBounceInOut()) * @@ -1783,12 +1222,7 @@ cc.easeBounceOut = function(){ * //The new usage * action.easing(cc.easeBounceInOut()); */ -cc.EaseBounceInOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceInOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseBounceInOut = cc.EaseBounce.extend({ update:function (dt) { var newT = 0; if (dt < 0.5) { @@ -1800,41 +1234,17 @@ cc.EaseBounceInOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceInOut# */{ this._inner.update(newT); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBounceInOut} - */ clone:function(){ var action = new cc.EaseBounceInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBounceInOut} - */ reverse:function () { return new cc.EaseBounceInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Eased bounce effect at the begining and ending. - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeBounceInOut()) - * @param {cc.ActionInterval} action - * @return {cc.EaseBounceInOut} - * - * @example - * //The old usage - * cc.EaseBounceInOut.create(action); - * //The new usage - * action.easing(cc.easeBounceInOut()); - */ cc.EaseBounceInOut.create = function (action) { return new cc.EaseBounceInOut(action); }; @@ -1858,7 +1268,7 @@ cc._easeBounceInOutObj = { /** * Creates the action easing object.
* Eased bounce effect at the begining and ending. - * @function + * @method cc.easeBounceInOut * @return {Object} * @example * // example @@ -1868,12 +1278,12 @@ cc.easeBounceInOut = function(){ return cc._easeBounceInOutObj; }; -/** +/* * cc.EaseBackIn action.
* In the opposite direction to move slowly, and then accelerated to the right direction. * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.ActionEase + * @class EaseBackIn + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeBackIn()) * @@ -1883,32 +1293,17 @@ cc.easeBounceInOut = function(){ * //The new usage * action.easing(cc.easeBackIn()); */ -cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseBackIn = cc.ActionEase.extend({ update:function (dt) { var overshoot = 1.70158; dt = dt===0 || dt===1 ? dt : dt * dt * ((overshoot + 1) * dt - overshoot); this._inner.update(dt); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBackOut} - */ reverse:function () { return new cc.EaseBackOut(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBackIn} - */ clone:function(){ var action = new cc.EaseBackIn(); action.initWithAction(this._inner.clone()); @@ -1916,21 +1311,6 @@ cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{ } }); - -/** - * Creates the cc.EaseBackIn.
- * In the opposite direction to move slowly, and then accelerated to the right direction. - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeBackIn()) - * @param {cc.ActionInterval} action - * @return {cc.EaseBackIn} - * - * @example - * //The old usage - * cc.EaseBackIn.create(action); - * //The new usage - * action.easing(cc.easeBackIn()); - */ cc.EaseBackIn.create = function (action) { return new cc.EaseBackIn(action); }; @@ -1948,7 +1328,7 @@ cc._easeBackInObj = { /** * Creates the action easing object.
* In the opposite direction to move slowly, and then accelerated to the right direction. - * @function + * @method cc.easeBackIn * @return {Object} * @example * // example @@ -1958,12 +1338,12 @@ cc.easeBackIn = function(){ return cc._easeBackInObj; }; -/** +/* * cc.EaseBackOut action.
* Fast moving more than the finish, and then slowly back to the finish. * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.ActionEase + * @class EaseBackOut + * @extends ActionEase * * @deprecated since v3.0 please use action.easing(cc.easeBackOut()); * @@ -1973,32 +1353,17 @@ cc.easeBackIn = function(){ * //The new usage * action.easing(cc.easeBackOut()); */ -cc.EaseBackOut = cc.ActionEase.extend(/** @lends cc.EaseBackOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseBackOut = cc.ActionEase.extend({ update:function (dt) { var overshoot = 1.70158; dt = dt - 1; this._inner.update(dt * dt * ((overshoot + 1) * dt + overshoot) + 1); }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBackIn} - */ reverse:function () { return new cc.EaseBackIn(this._inner.reverse()); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBackOut} - */ clone:function(){ var action = new cc.EaseBackOut(); action.initWithAction(this._inner.clone()); @@ -2006,20 +1371,6 @@ cc.EaseBackOut = cc.ActionEase.extend(/** @lends cc.EaseBackOut# */{ } }); -/** - * Creates the action.
- * Fast moving more than the finish, and then slowly back to the finish. - * @static - * @deprecated since v3.0
Please use action.easing(cc.easeBackOut()); - * @param {cc.ActionInterval} action - * @return {cc.EaseBackOut} - * - * @example - * //The old usage - * cc.EaseBackOut.create(action); - * //The new usage - * action.easing(cc.easeBackOut()); - */ cc.EaseBackOut.create = function (action) { return new cc.EaseBackOut(action); }; @@ -2038,7 +1389,7 @@ cc._easeBackOutObj = { /** * Creates the action easing object.
* Fast moving more than the finish, and then slowly back to the finish. - * @function + * @method cc.easeBackOut * @return {Object} * @example * // example @@ -2048,12 +1399,12 @@ cc.easeBackOut = function(){ return cc._easeBackOutObj; }; -/** +/* * cc.EaseBackInOut action.
* Begining of cc.EaseBackIn. Ending of cc.EaseBackOut. * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action. - * @class - * @extends cc.ActionEase + * @class EaseBackInOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeBackInOut()) * @@ -2063,12 +1414,7 @@ cc.easeBackOut = function(){ * //The new usage * action.easing(cc.easeBackInOut()); */ -cc.EaseBackInOut = cc.ActionEase.extend(/** @lends cc.EaseBackInOut# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +cc.EaseBackInOut = cc.ActionEase.extend({ update:function (dt) { var overshoot = 1.70158 * 1.525; dt = dt * 2; @@ -2080,43 +1426,17 @@ cc.EaseBackInOut = cc.ActionEase.extend(/** @lends cc.EaseBackInOut# */{ } }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBackInOut} - */ clone:function(){ var action = new cc.EaseBackInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBackInOut} - */ reverse:function () { return new cc.EaseBackInOut(this._inner.reverse()); } }); - -/** - * Creates the action.
- * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut. - * @static - * @param {cc.ActionInterval} action - * @return {cc.EaseBackInOut} - * - * @deprecated since v3.0
Please use action.easing(cc.easeBackInOut()) - * - * @example - * //The old usage - * cc.EaseBackInOut.create(action); - * //The new usage - * action.easing(cc.easeBackInOut()); - */ cc.EaseBackInOut.create = function (action) { return new cc.EaseBackInOut(action); }; @@ -2140,7 +1460,7 @@ cc._easeBackInOutObj = { /** * Creates the action easing object.
* Begining of cc.EaseBackIn. Ending of cc.EaseBackOut. - * @function + * @method cc.easeBackInOut * @return {Object} * @example * // example @@ -2150,13 +1470,13 @@ cc.easeBackInOut = function(){ return cc._easeBackInOutObj; }; -/** +/* * cc.EaseBezierAction action.
* Manually set a 4 order Bessel curve.
* According to the set point, calculate the trajectory. - * @class - * @extends cc.ActionEase - * @param {cc.Action} action + * @class EaseBezierAction + * @extends ActionEase + * @param {Action} action * * @deprecated since v3.0
Please use action.easing(cc.easeBezierAction()) * @@ -2167,7 +1487,7 @@ cc.easeBackInOut = function(){ * //The new usage * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0)); */ -cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{ +cc.EaseBezierAction = cc.ActionEase.extend({ _p0: null, _p1: null, @@ -2177,7 +1497,7 @@ cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{ /** * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
* Initialization requires the application of Bessel curve of action. - * @param {cc.Action} action + * @param {Action} action */ ctor: function(action){ cc.ActionEase.prototype.ctor.call(this, action); @@ -2187,22 +1507,11 @@ cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{ return (Math.pow(1-t,3) * a + 3*t*(Math.pow(1-t,2))*b + 3*Math.pow(t,2)*(1-t)*c + Math.pow(t,3)*d ); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ var t = this._updateTime(this._p0, this._p1, this._p2, this._p3, dt); this._inner.update(t); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseBezierAction} - */ clone: function(){ var action = new cc.EaseBezierAction(); action.initWithAction(this._inner.clone()); @@ -2210,10 +1519,6 @@ cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{ return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseBezierAction} - */ reverse: function(){ var action = new cc.EaseBezierAction(this._inner.reverse()); action.setBezierParamer(this._p3, this._p2, this._p1, this._p0); @@ -2235,23 +1540,6 @@ cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{ } }); -/** - * Creates the action.
- * After creating the cc.EaseBezierAction, also need to manually call setBezierParamer.
- * According to the set point, calculate the trajectory. - * @static - * @param action - * @returns {cc.EaseBezierAction} - * - * @deprecated since v3.0
Please use action.easing(cc.easeBezierAction()) - * - * @example - * //The old usage - * var action = cc.EaseBezierAction.create(action); - * action.setBezierParamer(0.5, 0.5, 1.0, 1.0); - * //The new usage - * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0)); - */ cc.EaseBezierAction.create = function(action){ return new cc.EaseBezierAction(action); }; @@ -2260,6 +1548,7 @@ cc.EaseBezierAction.create = function(action){ * Creates the action easing object.
* Into the 4 reference point.
* To calculate the motion curve. + * @method cc.easeBezierAction * @param {Number} p0 The first bezier parameter * @param {Number} p1 The second bezier parameter * @param {Number} p2 The third bezier parameter @@ -2280,12 +1569,12 @@ cc.easeBezierAction = function(p0, p1, p2, p3){ }; }; -/** +/* * cc.EaseQuadraticActionIn action.
* Reference easeInQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuadraticActionIn + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticAction()) * @@ -2295,59 +1584,28 @@ cc.easeBezierAction = function(p0, p1, p2, p3){ * //The new usage * action.easing(cc.easeQuadraticActionIn()); */ -cc.EaseQuadraticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionIn# */{ +cc.EaseQuadraticActionIn = cc.ActionEase.extend({ _updateTime: function(time){ return Math.pow(time, 2); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuadraticActionIn} - */ clone: function(){ var action = new cc.EaseQuadraticActionIn(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuadraticActionIn} - */ reverse: function(){ return new cc.EaseQuadraticActionIn(this._inner.reverse()); } }); -/** - * Creates the cc.EaseQuadRaticActionIn.
- * Reference easeInQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @param action - * @returns {cc.EaseQuadraticActionIn} - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticAction()) - * - * @example - * //The old usage - * cc.EaseQuadraticActionIn.create(action); - * //The new usage - * action.easing(cc.easeQuadraticActionIn()); - */ cc.EaseQuadraticActionIn.create = function(action){ return new cc.EaseQuadraticActionIn(action); }; @@ -2362,7 +1620,8 @@ cc._easeQuadraticActionIn = { /** * Creates the action easing object.
* Reference easeInQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuadraticActionIn * @returns {Object} * @example * //example @@ -2372,12 +1631,12 @@ cc.easeQuadraticActionIn = function(){ return cc._easeQuadraticActionIn; }; -/** +/* * cc.EaseQuadraticActionIn action.
* Reference easeOutQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuadraticActionOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticActionOut()) * @@ -2387,58 +1646,27 @@ cc.easeQuadraticActionIn = function(){ * //The new usage * action.easing(cc.easeQuadraticActionOut()); */ -cc.EaseQuadraticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionOut# */{ +cc.EaseQuadraticActionOut = cc.ActionEase.extend({ _updateTime: function(time){ return -time*(time-2); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuadraticActionOut} - */ clone: function(){ var action = new cc.EaseQuadraticActionOut(); action.initWithAction(); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuadraticActionOut} - */ reverse: function(){ return new cc.EaseQuadraticActionOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeOutQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * @param action - * @returns {cc.EaseQuadraticActionOut} - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticActionOut()) - * - * @example - * //The old usage - * cc.EaseQuadraticActionOut.create(action); - * //The new usage - * action.easing(cc.easeQuadraticActionOut()); - */ cc.EaseQuadraticActionOut.create = function(action){ return new cc.EaseQuadraticActionOut(action); }; @@ -2452,8 +1680,8 @@ cc._easeQuadraticActionOut = { /** * Creates the action easing object.
* Reference easeOutQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuadraticActionOut * @returns {Object} * @example * //example @@ -2463,12 +1691,12 @@ cc.easeQuadraticActionOut = function(){ return cc._easeQuadraticActionOut; }; -/** +/* * cc.EaseQuadraticActionInOut action.
* Reference easeInOutQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuadraticActionInOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticActionInOut()) * @@ -2478,7 +1706,7 @@ cc.easeQuadraticActionOut = function(){ * //The new usage * action.easing(cc.easeQuadraticActionInOut()); */ -cc.EaseQuadraticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionInOut# */{ +cc.EaseQuadraticActionInOut = cc.ActionEase.extend({ _updateTime: function(time){ var resultTime = time; time *= 2; @@ -2491,53 +1719,21 @@ cc.EaseQuadraticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticAc return resultTime; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuadraticActionInOut} - */ clone: function(){ var action = new cc.EaseQuadraticActionInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuadraticActionInOut} - */ reverse: function(){ return new cc.EaseQuadraticActionInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInOutQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticActionInOut()) - * - * @example - * //The old usage - * cc.EaseQuadraticActionInOut.create(action); - * //The new usage - * action.easing(cc.easeQuadraticActionInOut()); - * - * @param action - * @returns {cc.EaseQuadraticActionInOut} - */ cc.EaseQuadraticActionInOut.create = function(action){ return new cc.EaseQuadraticActionInOut(action); }; @@ -2552,8 +1748,8 @@ cc._easeQuadraticActionInOut = { /** * Creates the action easing object.
* Reference easeInOutQuad:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuadraticActionInOut * @returns {Object} * @example * //example @@ -2563,12 +1759,12 @@ cc.easeQuadraticActionInOut = function(){ return cc._easeQuadraticActionInOut; }; -/** +/* * cc.EaseQuarticActionIn action.
* Reference easeInQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuarticActionIn + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuarticActionIn()); * @@ -2578,58 +1774,26 @@ cc.easeQuadraticActionInOut = function(){ * //The new usage * action.easing(cc.easeQuarticActionIn()); */ -cc.EaseQuarticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionIn# */{ +cc.EaseQuarticActionIn = cc.ActionEase.extend({ _updateTime: function(time){ return time * time * time * time; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuarticActionIn} - */ clone: function(){ var action = new cc.EaseQuarticActionIn(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuarticActionIn} - */ reverse: function(){ return new cc.EaseQuarticActionIn(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuarticActionIn()); - * - * @example - * //The old usage - * cc.EaseQuarticActionIn.create(action); - * //The new usage - * action.easing(cc.easeQuarticActionIn()); - * - * @param action - * @returns {cc.EaseQuarticActionIn} - */ cc.EaseQuarticActionIn.create = function(action){ return new cc.EaseQuarticActionIn(action); }; @@ -2643,8 +1807,8 @@ cc._easeQuarticActionIn = { /** * Creates the action easing object.
* Reference easeIntQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuarticActionIn * @returns {Object} * @example * //example @@ -2654,12 +1818,12 @@ cc.easeQuarticActionIn = function(){ return cc._easeQuarticActionIn; }; -/** +/* * cc.EaseQuarticActionOut action.
* Reference easeOutQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuarticActionOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.QuarticActionOut()); * @@ -2669,59 +1833,27 @@ cc.easeQuarticActionIn = function(){ * //The new usage * action.easing(cc.EaseQuarticActionOut()); */ -cc.EaseQuarticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionOut# */{ +cc.EaseQuarticActionOut = cc.ActionEase.extend({ _updateTime: function(time){ time -= 1; return -(time * time * time * time - 1); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuarticActionOut} - */ clone: function(){ var action = new cc.EaseQuarticActionOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuarticActionOut} - */ reverse: function(){ return new cc.EaseQuarticActionOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeOutQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.QuarticActionOut()); - * - * @example - * //The old usage - * cc.EaseQuarticActionOut.create(action); - * //The new usage - * action.easing(cc.EaseQuarticActionOut()); - * - * @param action - * @returns {cc.EaseQuarticActionOut} - */ cc.EaseQuarticActionOut.create = function(action){ return new cc.EaseQuarticActionOut(action); }; @@ -2736,8 +1868,8 @@ cc._easeQuarticActionOut = { /** * Creates the action easing object.
* Reference easeOutQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuarticActionOut * @returns {Object} * @example * //example @@ -2747,12 +1879,12 @@ cc.easeQuarticActionOut = function(){ return cc._easeQuarticActionOut; }; -/** +/* * cc.EaseQuarticActionInOut action.
* Reference easeInOutQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuarticActionInOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuarticActionInOut()); * @@ -2762,7 +1894,7 @@ cc.easeQuarticActionOut = function(){ * //The new usage * action.easing(cc.easeQuarticActionInOut()); */ -cc.EaseQuarticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionInOut# */{ +cc.EaseQuarticActionInOut = cc.ActionEase.extend({ _updateTime: function(time){ time = time*2; if (time < 1) @@ -2771,53 +1903,21 @@ cc.EaseQuarticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticAction return -0.5 * (time * time * time * time - 2); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuarticActionInOut} - */ clone: function(){ var action = new cc.EaseQuarticActionInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuarticActionInOut} - */ reverse: function(){ return new cc.EaseQuarticActionInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInOutQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuarticActionInOut()); - * - * @example - * //The old usage - * cc.EaseQuarticActionInOut.create(action); - * //The new usage - * action.easing(cc.easeQuarticActionInOut()); - * - * @param action - * @returns {cc.EaseQuarticActionInOut} - */ cc.EaseQuarticActionInOut.create = function(action){ return new cc.EaseQuarticActionInOut(action); }; @@ -2831,20 +1931,20 @@ cc._easeQuarticActionInOut = { /** * Creates the action easing object.
* Reference easeInOutQuart:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuarticActionInOut * @returns {Object} */ cc.easeQuarticActionInOut = function(){ return cc._easeQuarticActionInOut; }; -/** +/* * cc.EaseQuinticActionIn action.
* Reference easeInQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuinticActionIn + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuinticActionIn()); * @@ -2854,58 +1954,26 @@ cc.easeQuarticActionInOut = function(){ * //The new usage * action.easing(cc.easeQuinticActionIn()); */ -cc.EaseQuinticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionIn# */{ +cc.EaseQuinticActionIn = cc.ActionEase.extend({ _updateTime: function(time){ return time * time * time * time * time; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuinticActionIn} - */ clone: function(){ var action = new cc.EaseQuinticActionIn(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuinticActionIn} - */ reverse: function(){ return new cc.EaseQuinticActionIn(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuinticActionIn()); - * - * @example - * //The old usage - * cc.EaseQuinticActionIn.create(action); - * //The new usage - * action.easing(cc.easeQuinticActionIn()); - * - * @param action - * @returns {cc.EaseQuinticActionIn} - */ cc.EaseQuinticActionIn.create = function(action){ return new cc.EaseQuinticActionIn(action); }; @@ -2920,8 +1988,8 @@ cc._easeQuinticActionIn = { /** * Creates the action easing object.
* Reference easeInQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuinticActionIn * @returns {Object} * @example * //example @@ -2931,12 +1999,12 @@ cc.easeQuinticActionIn = function(){ return cc._easeQuinticActionIn; }; -/** +/* * cc.EaseQuinticActionOut action.
* Reference easeQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuinticActionOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticActionOut()); * @@ -2946,59 +2014,27 @@ cc.easeQuinticActionIn = function(){ * //The new usage * action.easing(cc.easeQuadraticActionOut()); */ -cc.EaseQuinticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionOut# */{ +cc.EaseQuinticActionOut = cc.ActionEase.extend({ _updateTime: function(time){ time -=1; return (time * time * time * time * time + 1); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuinticActionOut} - */ clone: function(){ var action = new cc.EaseQuinticActionOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuinticActionOut} - */ reverse: function(){ return new cc.EaseQuinticActionOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeOutQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuadraticActionOut()); - * - * @example - * //The old usage - * cc.EaseQuinticActionOut.create(action); - * //The new usage - * action.easing(cc.easeQuadraticActionOut()); - * - * @param action - * @returns {cc.EaseQuinticActionOut} - */ cc.EaseQuinticActionOut.create = function(action){ return new cc.EaseQuinticActionOut(action); }; @@ -3013,8 +2049,8 @@ cc._easeQuinticActionOut = { /** * Creates the action easing object.
* Reference easeOutQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuinticActionOut * @returns {Object} * @example * //example @@ -3024,12 +2060,12 @@ cc.easeQuinticActionOut = function(){ return cc._easeQuinticActionOut; }; -/** +/* * cc.EaseQuinticActionInOut action.
* Reference easeInOutQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseQuinticActionInOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeQuinticActionInOut()); * @@ -3039,7 +2075,7 @@ cc.easeQuinticActionOut = function(){ * //The new usage * action.easing(cc.easeQuinticActionInOut()); */ -cc.EaseQuinticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionInOut# */{ +cc.EaseQuinticActionInOut = cc.ActionEase.extend({ _updateTime: function(time){ time = time*2; if (time < 1) @@ -3048,53 +2084,21 @@ cc.EaseQuinticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticAction return 0.5 * (time * time * time * time * time + 2); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseQuinticActionInOut} - */ clone: function(){ var action = new cc.EaseQuinticActionInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseQuinticActionInOut} - */ reverse: function(){ return new cc.EaseQuinticActionInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInOutQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeQuinticActionInOut()); - * - * @example - * //The old usage - * cc.EaseQuinticActionInOut.create(action); - * //The new usage - * action.easing(cc.easeQuinticActionInOut()); - * - * @param action - * @returns {cc.EaseQuinticActionInOut} - */ cc.EaseQuinticActionInOut.create = function(action){ return new cc.EaseQuinticActionInOut(action); }; @@ -3109,8 +2113,8 @@ cc._easeQuinticActionInOut = { /** * Creates the action easing object.
* Reference easeInOutQuint:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeQuinticActionInOut * @returns {Object} * @example * //example @@ -3120,12 +2124,12 @@ cc.easeQuinticActionInOut = function(){ return cc._easeQuinticActionInOut; }; -/** +/* * cc.EaseCircleActionIn action.
* Reference easeInCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseCircleActionIn + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeCircleActionIn()); * @@ -3135,58 +2139,26 @@ cc.easeQuinticActionInOut = function(){ * //The new usage * action.easing(cc.easeCircleActionIn()); */ -cc.EaseCircleActionIn = cc.ActionEase.extend(/** @lends cc.EaseCircleActionIn# */{ +cc.EaseCircleActionIn = cc.ActionEase.extend({ _updateTime: function(time){ return -1 * (Math.sqrt(1 - time * time) - 1); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseCircleActionIn} - */ clone: function(){ var action = new cc.EaseCircleActionIn(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseCircleActionIn} - */ reverse: function(){ return new cc.EaseCircleActionIn(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeCircleActionIn()); - * - * @example - * //The old usage - * cc.EaseCircleActionIn.create(action); - * //The new usage - * action.easing(cc.easeCircleActionIn()); - * - * @param action - * @returns {cc.EaseCircleActionIn} - */ cc.EaseCircleActionIn.create = function(action){ return new cc.EaseCircleActionIn(action); }; @@ -3201,8 +2173,8 @@ cc._easeCircleActionIn = { /** * Creates the action easing object.
* Reference easeInCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeCircleActionIn * @returns {Object} * @example * //example @@ -3212,12 +2184,12 @@ cc.easeCircleActionIn = function(){ return cc._easeCircleActionIn; }; -/** +/* * cc.EaseCircleActionOut action.
* Reference easeOutCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseCircleActionOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeCircleActionOut()); * @@ -3227,59 +2199,27 @@ cc.easeCircleActionIn = function(){ * //The new usage * action.easing(cc.easeCircleActionOut()); */ -cc.EaseCircleActionOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionOut# */{ +cc.EaseCircleActionOut = cc.ActionEase.extend({ _updateTime: function(time){ time = time - 1; return Math.sqrt(1 - time * time); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseCircleActionOut} - */ clone: function(){ var action = new cc.EaseCircleActionOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseCircleActionOut} - */ reverse: function(){ return new cc.EaseCircleActionOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeOutCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeCircleActionOut()); - * - * @example - * //The old usage - * cc.EaseCircleActionOut.create(action); - * //The new usage - * action.easing(cc.easeCircleActionOut()); - * - * @param action - * @returns {cc.EaseCircleActionOut} - */ cc.EaseCircleActionOut.create = function(action){ return new cc.EaseCircleActionOut(action); }; @@ -3294,8 +2234,8 @@ cc._easeCircleActionOut = { /** * Creates the action easing object.
* Reference easeOutCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeCircleActionOut * @returns {Object} * @exampple * //example @@ -3305,12 +2245,12 @@ cc.easeCircleActionOut = function(){ return cc._easeCircleActionOut; }; -/** +/* * cc.EaseCircleActionInOut action.
* Reference easeInOutCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseCircleActionInOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeCircleActionInOut()); * @@ -3320,7 +2260,7 @@ cc.easeCircleActionOut = function(){ * //The new usage * action.easing(cc.easeCircleActionInOut()); */ -cc.EaseCircleActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionInOut# */{ +cc.EaseCircleActionInOut = cc.ActionEase.extend({ _updateTime: function(time){ time = time * 2; if (time < 1) @@ -3329,53 +2269,21 @@ cc.EaseCircleActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionIn return 0.5 * (Math.sqrt(1 - time * time) + 1); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseCircleActionInOut} - */ clone: function(){ var action = new cc.EaseCircleActionInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseCircleActionInOut} - */ reverse: function(){ return new cc.EaseCircleActionInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInOutCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeCircleActionInOut()); - * - * @example - * //The old usage - * cc.EaseCircleActionInOut.create(action); - * //The new usage - * action.easing(cc.easeCircleActionInOut()); - * - * @param action - * @returns {cc.EaseCircleActionInOut} - */ cc.EaseCircleActionInOut.create = function(action){ return new cc.EaseCircleActionInOut(action); }; @@ -3390,8 +2298,8 @@ cc._easeCircleActionInOut = { /** * Creates the action easing object.
* Reference easeInOutCirc:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeCircleActionInOut * @returns {Object} * @example * //example @@ -3401,12 +2309,12 @@ cc.easeCircleActionInOut = function(){ return cc._easeCircleActionInOut; }; -/** +/* * cc.EaseCubicActionIn action.
* Reference easeInCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseCubicActionIn + * @extends ActionEase * * @deprecated since v3.0
action.easing(cc.easeCubicActionIn()); * @@ -3416,58 +2324,26 @@ cc.easeCircleActionInOut = function(){ * //The new usage * action.easing(cc.easeCubicActionIn()); */ -cc.EaseCubicActionIn = cc.ActionEase.extend(/** @lends cc.EaseCubicActionIn# */{ +cc.EaseCubicActionIn = cc.ActionEase.extend({ _updateTime: function(time){ return time * time * time; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseCubicActionIn} - */ clone: function(){ var action = new cc.EaseCubicActionIn(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseCubicActionIn} - */ reverse: function(){ return new cc.EaseCubicActionIn(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
action.easing(cc.easeCubicActionIn()); - * - * @example - * //The old usage - * cc.EaseCubicActionIn.create(action); - * //The new usage - * action.easing(cc.easeCubicActionIn()); - * - * @param action - * @returns {cc.EaseCubicActionIn} - */ cc.EaseCubicActionIn.create = function(action){ return new cc.EaseCubicActionIn(action); }; @@ -3482,8 +2358,8 @@ cc._easeCubicActionIn = { /** * Creates the action easing object.
* Reference easeInCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeCubicActionIn * @returns {Object} * @example * //example @@ -3493,12 +2369,12 @@ cc.easeCubicActionIn = function(){ return cc._easeCubicActionIn; }; -/** +/* * cc.EaseCubicActionOut action.
* Reference easeOutCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseCubicActionOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeCubicActionOut()); * @@ -3508,59 +2384,27 @@ cc.easeCubicActionIn = function(){ * //The new usage * action.easing(cc.easeCubicActionOut()); */ -cc.EaseCubicActionOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionOut# */{ +cc.EaseCubicActionOut = cc.ActionEase.extend({ _updateTime: function(time){ time -= 1; return (time * time * time + 1); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseCubicActionOut} - */ clone: function(){ var action = new cc.EaseCubicActionOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseCubicActionOut} - */ reverse: function(){ return new cc.EaseCubicActionOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeOutCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeCubicActionOut()); - * - * @example - * //The old usage - * cc.EaseCubicActionOut.create(action); - * //The new usage - * action.easing(cc.easeCubicActionOut()); - * - * @param action - * @returns {cc.EaseCubicActionOut} - */ cc.EaseCubicActionOut.create = function(action){ return new cc.EaseCubicActionOut(action); }; @@ -3575,8 +2419,8 @@ cc._easeCubicActionOut = { /** * Creates the action easing object.
* Reference easeOutCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeCubicActionOut * @returns {Object} * @example * //example @@ -3586,12 +2430,12 @@ cc.easeCubicActionOut = function(){ return cc._easeCubicActionOut; }; -/** +/* * cc.EaseCubicActionInOut action.
* Reference easeInOutCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @class - * @extends cc.ActionEase + * http://www.zhihu.com/question/21981571/answer/19925418 + * @class EaseCubicActionInOut + * @extends ActionEase * * @deprecated since v3.0
Please use action.easing(cc.easeCubicActionInOut()); * @@ -3601,7 +2445,7 @@ cc.easeCubicActionOut = function(){ * //The new usage * action.easing(cc.easeCubicActionInOut()); */ -cc.EaseCubicActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionInOut# */{ +cc.EaseCubicActionInOut = cc.ActionEase.extend({ _updateTime: function(time){ time = time*2; if (time < 1) @@ -3610,53 +2454,21 @@ cc.EaseCubicActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionInOu return 0.5 * (time * time * time + 2); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update: function(dt){ this._inner.update(this._updateTime(dt)); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @returns {cc.EaseCubicActionInOut} - */ clone: function(){ var action = new cc.EaseCubicActionInOut(); action.initWithAction(this._inner.clone()); return action; }, - /** - * Create a action. Opposite with the original motion trajectory. - * @return {cc.EaseCubicActionInOut} - */ reverse: function(){ return new cc.EaseCubicActionInOut(this._inner.reverse()); } }); -/** - * Creates the action.
- * Reference easeInOutCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @static - * - * @deprecated since v3.0
Please use action.easing(cc.easeCubicActionInOut()); - * - * @example - * //The old usage - * cc.EaseCubicActionInOut.create(action); - * //The new usage - * action.easing(cc.easeCubicActionInOut()); - * - * @param action - * @returns {cc.EaseCubicActionInOut} - */ cc.EaseCubicActionInOut.create = function(action){ return new cc.EaseCubicActionInOut(action); }; @@ -3671,8 +2483,8 @@ cc._easeCubicActionInOut = { /** * Creates the action easing object.
* Reference easeInOutCubic:
- * {@link http://www.zhihu.com/question/21981571/answer/19925418} - * @function + * http://www.zhihu.com/question/21981571/answer/19925418 + * @method cc.easeCubicActionInOut * @returns {Object} */ cc.easeCubicActionInOut = function(){ diff --git a/cocos2d/actions/CCActionInstant.js b/cocos2d/actions/CCActionInstant.js index 821d401679..3e492b911e 100644 --- a/cocos2d/actions/CCActionInstant.js +++ b/cocos2d/actions/CCActionInstant.js @@ -25,34 +25,23 @@ ****************************************************************************/ /** - * Instant actions are immediate actions. They don't have a duration like. - * the CCIntervalAction actions. - * @class - * @extends cc.FiniteTimeAction + * @module actions */ -cc.ActionInstant = cc.FiniteTimeAction.extend(/** @lends cc.ActionInstant# */{ - /** - * return true if the action has finished. - * @return {Boolean} - */ + +/** + * Instant actions are immediate actions. They don't have a duration like the ActionInterval actions. + * @class ActionInstant + * @extends FiniteTimeAction + */ +cc.ActionInstant = cc.FiniteTimeAction.extend({ isDone:function () { return true; }, - /** - * called every frame with it's delta time.
- * DON'T override unless you know what you are doing. - * @param {Number} dt - */ step:function (dt) { this.update(1); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { //nothing }, @@ -60,60 +49,38 @@ cc.ActionInstant = cc.FiniteTimeAction.extend(/** @lends cc.ActionInstant# */{ /** * returns a reversed action.
* For example:
- * - The action will be x coordinates of 0 move to 100.
+ * - The action is x coordinates of 0 move to 100.
* - The reversed action will be x of 100 move to 0. - * - Will be rewritten - * @returns {cc.Action} + * @returns {Action} */ reverse:function(){ return this.clone(); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.FiniteTimeAction} - */ clone:function(){ return new cc.ActionInstant(); } }); /** - * Show the node. - * @class - * @extends cc.ActionInstant + * @module actions */ -cc.Show = cc.ActionInstant.extend(/** @lends cc.Show# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ +/* + * Show the node. + * @class Show + * @extends ActionInstant + */ +cc.Show = cc.ActionInstant.extend({ + update:function (dt) { this.target.visible = true; }, - /** - * 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 - * @returns {cc.Hide} - */ reverse:function () { return new cc.Hide(); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.FiniteTimeAction} - */ clone:function(){ return new cc.Show(); } @@ -121,8 +88,8 @@ cc.Show = cc.ActionInstant.extend(/** @lends cc.Show# */{ /** * Show the Node. - * @function - * @return {cc.Show} + * @method cc.show + * @return {Show} * @example * // example * var showAction = cc.show(); @@ -131,48 +98,23 @@ cc.show = function () { return new cc.Show(); }; -/** - * Show the Node. Please use cc.show instead. - * @static - * @deprecated since v3.0
Please use cc.show instead. - * @return {cc.Show} - */ cc.Show.create = cc.show; -/** +/* * Hide the node. - * @class - * @extends cc.ActionInstant + * @class Hide + * @extends ActionInstant */ -cc.Hide = cc.ActionInstant.extend(/** @lends cc.Hide# */{ +cc.Hide = cc.ActionInstant.extend({ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this.target.visible = false; }, - /** - * 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 - * @returns {cc.Show} - */ reverse:function () { return new cc.Show(); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.Hide} - */ clone:function(){ return new cc.Hide(); } @@ -180,8 +122,8 @@ cc.Hide = cc.ActionInstant.extend(/** @lends cc.Hide# */{ /** * Hide the node. - * @function - * @return {cc.Hide} + * @method cc.hide + * @return {Hide} * @example * // example * var hideAction = cc.hide(); @@ -190,47 +132,23 @@ cc.hide = function () { return new cc.Hide(); }; -/** - * Hide the node. Please use cc.hide instead. - * @static - * @deprecated since v3.0
Please use cc.hide instead. - * @return {cc.Hide} - * @example - * // example - * var hideAction = cc.hide(); - */ cc.Hide.create = cc.hide; -/** +/* * Toggles the visibility of a node. - * @class - * @extends cc.ActionInstant + * @class ToggleVisibility + * @extends ActionInstant */ -cc.ToggleVisibility = cc.ActionInstant.extend(/** @lends cc.ToggleVisibility# */{ +cc.ToggleVisibility = cc.ActionInstant.extend({ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this.target.visible = !this.target.visible; }, - /** - * returns a reversed action. - * @returns {cc.ToggleVisibility} - */ reverse:function () { return new cc.ToggleVisibility(); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.ToggleVisibility} - */ clone:function(){ return new cc.ToggleVisibility(); } @@ -238,8 +156,8 @@ cc.ToggleVisibility = cc.ActionInstant.extend(/** @lends cc.ToggleVisibility# */ /** * Toggles the visibility of a node. - * @function - * @return {cc.ToggleVisibility} + * @method cc.toggleVisibility + * @return {ToggleVisibility} * @example * // example * var toggleVisibilityAction = cc.toggleVisibility(); @@ -248,18 +166,12 @@ cc.toggleVisibility = function () { return new cc.ToggleVisibility(); }; -/** - * Toggles the visibility of a node. Please use cc.toggleVisibility instead. - * @static - * @deprecated since v3.0
Please use cc.toggleVisibility instead. - * @return {cc.ToggleVisibility} - */ cc.ToggleVisibility.create = cc.toggleVisibility; -/** +/* * Delete self in the next frame. - * @class - * @extends cc.ActionInstant + * @class RemoveSelf + * @extends ActionInstant * @param {Boolean} [isNeedCleanUp=true] * * @example @@ -269,49 +181,25 @@ cc.ToggleVisibility.create = cc.toggleVisibility; cc.RemoveSelf = cc.ActionInstant.extend({ _isNeedCleanUp: true, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing. - * @param {Boolean} [isNeedCleanUp=true] - */ ctor:function(isNeedCleanUp){ cc.FiniteTimeAction.prototype.ctor.call(this); isNeedCleanUp !== undefined && this.init(isNeedCleanUp); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function(dt){ this.target.removeFromParent(this._isNeedCleanUp); }, - /** - * Initialization of the node, please do not call this function by yourself, you should pass the parameters to constructor to initialize it. - * @param isNeedCleanUp - * @returns {boolean} - */ init:function(isNeedCleanUp){ this._isNeedCleanUp = isNeedCleanUp; return true; }, - /** - * returns a reversed action. - */ reverse:function(){ return new cc.RemoveSelf(this._isNeedCleanUp); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.RemoveSelf} - */ clone:function(){ return new cc.RemoveSelf(this._isNeedCleanUp); } @@ -320,9 +208,9 @@ cc.RemoveSelf = cc.ActionInstant.extend({ /** * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing. * - * @function + * @method cc.removeSelf * @param {Boolean} [isNeedCleanUp=true] - * @return {cc.RemoveSelf} + * @return {RemoveSelf} * * @example * // example @@ -332,41 +220,27 @@ cc.removeSelf = function(isNeedCleanUp){ return new cc.RemoveSelf(isNeedCleanUp); }; -/** - * Please use cc.removeSelf instead. - * Create a RemoveSelf object with a flag indicate whether the target should be cleaned up while removing. - * - * @static - * @deprecated since v3.0
Please use cc.removeSelf instead. - * @param {Boolean} [isNeedCleanUp=true] - * @return {cc.RemoveSelf} - */ cc.RemoveSelf.create = cc.removeSelf; -/** +/* * Flips the sprite horizontally. - * @class - * @extends cc.ActionInstant + * @class FlipX + * @extends ActionInstant * @param {Boolean} flip Indicate whether the target should be flipped or not * * @example * var flipXAction = new cc.FlipX(true); */ -cc.FlipX = cc.ActionInstant.extend(/** @lends cc.FlipX# */{ +cc.FlipX = cc.ActionInstant.extend({ _flippedX:false, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Create a FlipX action to flip or unflip the target. - * @param {Boolean} flip Indicate whether the target should be flipped or not - */ ctor:function(flip){ cc.FiniteTimeAction.prototype.ctor.call(this); this._flippedX = false; flip !== undefined && this.initWithFlipX(flip); }, - /** + /* * initializes the action with a set flipX. * @param {Boolean} flip * @return {Boolean} @@ -376,29 +250,14 @@ cc.FlipX = cc.ActionInstant.extend(/** @lends cc.FlipX# */{ return true; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this.target.flippedX = this._flippedX; }, - /** - * returns a reversed action. - * @return {cc.FlipX} - */ reverse:function () { return new cc.FlipX(!this._flippedX); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.FiniteTimeAction} - */ clone:function(){ var action = new cc.FlipX(); action.initWithFlipX(this._flippedX); @@ -409,9 +268,9 @@ cc.FlipX = cc.ActionInstant.extend(/** @lends cc.FlipX# */{ /** * Create a FlipX action to flip or unflip the target. * - * @function + * @method cc.flipX * @param {Boolean} flip Indicate whether the target should be flipped or not - * @return {cc.FlipX} + * @return {FlipX} * @example * var flipXAction = cc.flipX(true); */ @@ -419,34 +278,19 @@ cc.flipX = function (flip) { return new cc.FlipX(flip); }; -/** - * Plese use cc.flipX instead. - * Create a FlipX action to flip or unflip the target - * - * @static - * @deprecated since v3.0
Plese use cc.flipX instead. - * @param {Boolean} flip Indicate whether the target should be flipped or not - * @return {cc.FlipX} - */ cc.FlipX.create = cc.flipX; -/** +/* * Flips the sprite vertically - * @class - * @extends cc.ActionInstant + * @class FlipY + * @extends ActionInstant * @param {Boolean} flip * @example * var flipYAction = new cc.FlipY(true); */ -cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{ +cc.FlipY = cc.ActionInstant.extend({ _flippedY:false, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Create a FlipY action to flip or unflip the target. - * - * @param {Boolean} flip - */ ctor: function(flip){ cc.FiniteTimeAction.prototype.ctor.call(this); this._flippedY = false; @@ -454,7 +298,7 @@ cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{ flip !== undefined && this.initWithFlipY(flip); }, - /** + /* * initializes the action with a set flipY. * @param {Boolean} flip * @return {Boolean} @@ -464,29 +308,14 @@ cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{ return true; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this.target.flippedY = this._flippedY; }, - /** - * returns a reversed action. - * @return {cc.FlipY} - */ reverse:function () { return new cc.FlipY(!this._flippedY); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.FlipY} - */ clone:function(){ var action = new cc.FlipY(); action.initWithFlipY(this._flippedY); @@ -497,9 +326,9 @@ cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{ /** * Create a FlipY action to flip or unflip the target. * - * @function + * @method cc.flipY * @param {Boolean} flip - * @return {cc.FlipY} + * @return {FlipY} * @example * var flipYAction = cc.flipY(true); */ @@ -507,37 +336,22 @@ cc.flipY = function (flip) { return new cc.FlipY(flip); }; -/** - * Please use cc.flipY instead - * Create a FlipY action to flip or unflip the target - * - * @static - * @deprecated since v3.0
Please use cc.flipY instead. - * @param {Boolean} flip - * @return {cc.FlipY} - */ cc.FlipY.create = cc.flipY; -/** +/* * Places the node in a certain position - * @class - * @extends cc.ActionInstant - * @param {cc.Vec2|Number} pos + * @class Place + * @extends ActionInstant + * @param {Vec2|Number} pos * @param {Number} [y] * @example * var placeAction = new cc.Place(cc.p(200, 200)); * var placeAction = new cc.Place(200, 200); */ -cc.Place = cc.ActionInstant.extend(/** @lends cc.Place# */{ +cc.Place = cc.ActionInstant.extend({ _x: 0, _y: 0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates a Place action with a position. - * @param {cc.Vec2|Number} pos - * @param {Number} [y] - */ ctor:function(pos, y){ cc.FiniteTimeAction.prototype.ctor.call(this); this._x = 0; @@ -552,7 +366,7 @@ cc.Place = cc.ActionInstant.extend(/** @lends cc.Place# */{ } }, - /** + /* * Initializes a Place action with a position * @param {number} x * @param {number} y @@ -564,21 +378,10 @@ cc.Place = cc.ActionInstant.extend(/** @lends cc.Place# */{ return true; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this.target.setPosition(this._x, this._y); }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.Place} - */ clone:function(){ var action = new cc.Place(); action.initWithPosition(this._x, this._y); @@ -588,10 +391,10 @@ cc.Place = cc.ActionInstant.extend(/** @lends cc.Place# */{ /** * Creates a Place action with a position. - * @function - * @param {cc.Vec2|Number} pos + * @method cc.place + * @param {Vec2|Number} pos * @param {Number} [y] - * @return {cc.Place} + * @return {Place} * @example * // example * var placeAction = cc.place(cc.p(200, 200)); @@ -601,22 +404,13 @@ cc.place = function (pos, y) { return new cc.Place(pos, y); }; -/** - * Please use cc.place instead. - * Creates a Place action with a position. - * @static - * @deprecated since v3.0
Please use cc.place instead. - * @param {cc.Vec2|Number} pos - * @param {Number} [y] - * @return {cc.Place} - */ cc.Place.create = cc.place; -/** +/* * Calls a 'callback'. - * @class - * @extends cc.ActionInstant + * @class CallFunc + * @extends ActionInstant * @param {function} selector * @param {object|null} [selectorTarget] * @param {*|null} [data] data for function, it accepts all data types. @@ -628,12 +422,12 @@ cc.Place.create = cc.place; * // CallFunc with data * var finish = new cc.CallFunc(this.removeFromParentAndCleanup, this, true); */ -cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ +cc.CallFunc = cc.ActionInstant.extend({ _selectorTarget:null, _function:null, _data:null, - /** + /* * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
* Creates a CallFunc action with the callback. * @param {function} selector @@ -646,7 +440,7 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ this.initWithFunction(selector, selectorTarget, data); }, - /** + /* * Initializes the action with a function or function and its target * @param {function} selector * @param {object|Null} selectorTarget @@ -666,7 +460,7 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ return true; }, - /** + /* * execute the function. */ execute:function () { @@ -675,16 +469,11 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ } }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * - * @param {Number} dt - */ update:function (dt) { this.execute(); }, - /** + /* * Get selectorTarget. * @return {object} */ @@ -692,7 +481,7 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ return this._selectorTarget; }, - /** + /* * Set selectorTarget. * @param {object} sel */ @@ -704,12 +493,6 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ } }, - /** - * to copy object with deep copy. - * returns a clone of action. - * - * @return {cc.CallFunc} - */ clone:function(){ var action = new cc.CallFunc(); action.initWithFunction(this._function, this._selectorTarget, this._data); @@ -719,11 +502,11 @@ cc.CallFunc = cc.ActionInstant.extend(/** @lends cc.CallFunc# */{ /** * Creates the action with the callback - * @function + * @method cc.callFunc * @param {function} selector * @param {object|null} [selectorTarget] * @param {*|null} [data] data for function, it accepts all data types. - * @return {cc.CallFunc} + * @return {CallFunc} * @example * // example * // CallFunc without data @@ -736,14 +519,4 @@ cc.callFunc = function (selector, selectorTarget, data) { return new cc.CallFunc(selector, selectorTarget, data); }; -/** - * Please use cc.callFunc instead. - * Creates the action with the callback. - * @static - * @deprecated since v3.0
Please use cc.callFunc instead. - * @param {function} selector - * @param {object|null} [selectorTarget] - * @param {*|null} [data] data for function, it accepts all data types. - * @return {cc.CallFunc} - */ cc.CallFunc.create = cc.callFunc; diff --git a/cocos2d/actions/CCActionInterval.js b/cocos2d/actions/CCActionInterval.js index 420c89fad6..9cde873298 100644 --- a/cocos2d/actions/CCActionInterval.js +++ b/cocos2d/actions/CCActionInterval.js @@ -24,6 +24,10 @@ THE SOFTWARE. ****************************************************************************/ +/** + * @module actions + */ + /** *

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
@@ -37,13 +41,11 @@ *

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

* - * @class - * @extends cc.FiniteTimeAction + * @class ActionInterval + * @extends FiniteTimeAction * @param {Number} d duration in seconds - * @example - * var actionInterval = new cc.ActionInterval(3); */ -cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ +cc.ActionInterval = cc.FiniteTimeAction.extend({ _elapsed:0, _firstTick:false, _easeList: null, @@ -53,10 +55,6 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ _speed: 1, _speedMethod: false,//Compatible with speed class, Discard after can be deleted - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} d duration in seconds - */ ctor:function (d) { this._speed = 1; this._timesForRepeat = 1; @@ -68,7 +66,7 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ d !== undefined && this.initWithDuration(d); }, - /** + /* * How many seconds had elapsed since the actions started to run. * @return {Number} */ @@ -76,7 +74,7 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return this._elapsed; }, - /** + /* * Initializes the action. * @param {Number} d duration in seconds * @return {Boolean} @@ -91,19 +89,10 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return true; }, - /** - * Returns true if the action has finished. - * @return {Boolean} - */ isDone:function () { return (this._elapsed >= this._duration); }, - /** - * Some additional parameters of cloning. - * @param {cc.Action} action - * @private - */ _cloneDecoration: function(action){ action._repeatForever = this._repeatForever; action._speed = this._speed; @@ -122,24 +111,20 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ } }, - /** - * Returns a new clone of the action. - * @returns {cc.ActionInterval} - */ clone:function () { var action = new cc.ActionInterval(this._duration); this._cloneDecoration(action); return action; }, - /** + /* * Implementation of ease motion. * * @example * //example * action.easeing(cc.easeIn(3.0)); * @param {Object} easeObj - * @returns {cc.ActionInterval} + * @returns {ActionInterval} */ easing: function (easeObj) { if (this._easeList) @@ -160,12 +145,6 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return dt; }, - /** - * called every frame with it's delta time.
- * DON'T override unless you know what you are doing. - * - * @param {Number} dt - */ step:function (dt) { if (this._firstTick) { this._firstTick = false; @@ -194,28 +173,18 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ } }, - /** - * Start this action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.Action.prototype.startWithTarget.call(this, target); this._elapsed = 0; this._firstTick = true; }, - /** - * returns a reversed action.
- * Will be overwrite. - * - * @return {null} - */ reverse:function () { cc.log("cc.IntervalAction: reverse not implemented."); return null; }, - /** + /* * Set amplitude rate. * @warning It should be overridden in subclass. * @param {Number} amp @@ -225,7 +194,7 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ cc.log("cc.ActionInterval.setAmplitudeRate(): it should be overridden in subclass."); }, - /** + /* * Get amplitude rate. * @warning It should be overridden in subclass. * @return {Number} 0 @@ -236,13 +205,13 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return 0; }, - /** + /* * 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. * * @param speed - * @returns {cc.Action} + * @returns {Action} */ speed: function(speed){ if(speed <= 0){ @@ -255,7 +224,7 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return this; }, - /** + /* * Get this action speed. * @return {Number} */ @@ -263,21 +232,21 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return this._speed; }, - /** + /* * Set this action speed. * @param {Number} speed - * @returns {cc.ActionInterval} + * @returns {ActionInterval} */ setSpeed: function(speed){ this._speed = speed; return this; }, - /** + /* * Repeats an action a number of times. * To repeat an action forever use the CCRepeatForever action. * @param times - * @returns {cc.ActionInterval} + * @returns {ActionInterval} */ repeat: function(times){ times = Math.round(times); @@ -290,10 +259,10 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ return this; }, - /** + /* * Repeats an action for ever.
* To repeat the an action for a limited number of times use the Repeat action.
- * @returns {cc.ActionInterval} + * @returns {ActionInterval} */ repeatForever: function(){ this._repeatMethod = true;//Compatible with repeat class, Discard after can be deleted @@ -303,34 +272,21 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{ } }); -/** - * An interval action is an action that takes place within a certain period of time. - * @function - * @param {Number} d duration in seconds - * @return {cc.ActionInterval} - * @example - * // example - * var actionInterval = cc.actionInterval(3); - */ cc.actionInterval = function (d) { return new cc.ActionInterval(d); }; -/** - * Please use cc.actionInterval instead. - * An interval action is an action that takes place within a certain period of time. - * @static - * @deprecated since v3.0
Please use cc.actionInterval instead. - * @param {Number} d duration in seconds - * @return {cc.ActionInterval} - */ cc.ActionInterval.create = cc.actionInterval; /** + * @module actions + */ + +/* * Runs actions sequentially, one after another. - * @class - * @extends cc.ActionInterval - * @param {Array|cc.FiniteTimeAction} tempArray + * @class Sequence + * @extends ActionInterval + * @param {Array|FiniteTimeAction} tempArray * @example * // create sequence with actions * var seq = new cc.Sequence(act1, act2); @@ -338,16 +294,11 @@ cc.ActionInterval.create = cc.actionInterval; * // create sequence with array * var seq = new cc.Sequence(actArray); */ -cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ +cc.Sequence = cc.ActionInterval.extend({ _actions:null, _split:null, _last:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Create an array of sequenceable actions. - * @param {Array|cc.FiniteTimeAction} tempArray - */ ctor:function (tempArray) { cc.ActionInterval.prototype.ctor.call(this); this._actions = []; @@ -369,10 +320,10 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ } }, - /** + /* * Initializes the action
- * @param {cc.FiniteTimeAction} actionOne - * @param {cc.FiniteTimeAction} actionTwo + * @param {FiniteTimeAction} actionOne + * @param {FiniteTimeAction} actionTwo * @return {Boolean} */ initWithTwoActions:function (actionOne, actionTwo) { @@ -387,10 +338,6 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ return true; }, - /** - * returns a new clone of the action - * @returns {cc.Sequence} - */ clone:function () { var action = new cc.Sequence(); this._cloneDecoration(action); @@ -398,19 +345,12 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._split = this._actions[0]._duration / this._duration; this._last = -1; }, - /** - * stop the action. - */ stop:function () { // Issue #1305 if (this._last !== -1) @@ -418,10 +358,6 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ cc.Action.prototype.stop.call(this); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { var new_t, found = 0; var locSplit = this._split, locActions = this._actions, locLast = this._last, actionFound; @@ -471,10 +407,6 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ this._last = found; }, - /** - * Returns a reversed action. - * @return {cc.Sequence} - */ reverse:function () { var action = cc.Sequence._actionOneTwo(this._actions[1].reverse(), this._actions[0].reverse()); this._cloneDecoration(action); @@ -483,10 +415,12 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{ } }); -/** helper constructor to create an array of sequenceable actions - * @function - * @param {Array|cc.FiniteTimeAction} tempArray - * @return {cc.Sequence} +/** + * Helper constructor to create an array of sequenceable actions + * The created action will run actions sequentially, one after another. + * @method cc.sequence + * @param {Array|FiniteTimeAction} tempArray + * @return {Sequence} * @example * // example * // create sequence with actions @@ -522,59 +456,39 @@ cc.sequence = function (/*Multiple Arguments*/tempArray) { return result; }; -/** - * Please use cc.sequence instead. - * helper constructor to create an array of sequenceable actions - * @static - * @deprecated since v3.0
Please use cc.sequence instead. - * @param {Array|cc.FiniteTimeAction} tempArray - * @return {cc.Sequence} - */ cc.Sequence.create = cc.sequence; -/** creates the action - * @param {cc.FiniteTimeAction} actionOne - * @param {cc.FiniteTimeAction} actionTwo - * @return {cc.Sequence} - * @private - */ cc.Sequence._actionOneTwo = function (actionOne, actionTwo) { var sequence = new cc.Sequence(); sequence.initWithTwoActions(actionOne, actionTwo); return sequence; }; -/** +/* * Repeats an action a number of times. * To repeat an action forever use the CCRepeatForever action. - * @class - * @extends cc.ActionInterval - * @param {cc.FiniteTimeAction} action + * @class Repeat + * @extends ActionInterval + * @param {FiniteTimeAction} action * @param {Number} times * @example * var rep = new cc.Repeat(cc.sequence(jump2, jump1), 5); */ -cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ +cc.Repeat = cc.ActionInterval.extend({ _times:0, _total:0, _nextDt:0, _actionInstant:false, _innerAction:null, //CCFiniteTimeAction - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30). - * @param {cc.FiniteTimeAction} action - * @param {Number} times - */ ctor: function (action, times) { cc.ActionInterval.prototype.ctor.call(this); times !== undefined && this.initWithAction(action, times); }, - /** - * @param {cc.FiniteTimeAction} action + /* + * @param {FiniteTimeAction} action * @param {Number} times * @return {Boolean} */ @@ -594,10 +508,6 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.Repeat} - */ clone:function () { var action = new cc.Repeat(); this._cloneDecoration(action); @@ -605,10 +515,6 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { this._total = 0; this._nextDt = this._innerAction._duration / this._duration; @@ -616,18 +522,11 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ this._innerAction.startWithTarget(target); }, - /** - * stop the action - */ stop:function () { this._innerAction.stop(); cc.Action.prototype.stop.call(this); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); var locInnerAction = this._innerAction; @@ -664,18 +563,10 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ } }, - /** - * Return true if the action has finished. - * @return {Boolean} - */ isDone:function () { return this._total === this._times; }, - /** - * returns a reversed action. - * @return {cc.Repeat} - */ reverse:function () { var action = new cc.Repeat(this._innerAction.reverse(), this._times); this._cloneDecoration(action); @@ -683,9 +574,9 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ return action; }, - /** + /* * Set inner Action. - * @param {cc.FiniteTimeAction} action + * @param {FiniteTimeAction} action */ setInnerAction:function (action) { if (this._innerAction !== action) { @@ -693,9 +584,9 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ } }, - /** + /* * Get inner Action. - * @return {cc.FiniteTimeAction} + * @return {FiniteTimeAction} */ getInnerAction:function () { return this._innerAction; @@ -704,10 +595,10 @@ cc.Repeat = cc.ActionInterval.extend(/** @lends cc.Repeat# */{ /** * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) - * @function - * @param {cc.FiniteTimeAction} action + * @method cc.repeat + * @param {FiniteTimeAction} action * @param {Number} times - * @return {cc.Repeat} + * @return {Repeat} * @example * // example * var rep = cc.repeat(cc.sequence(jump2, jump1), 5); @@ -716,35 +607,22 @@ cc.repeat = function (action, times) { return new cc.Repeat(action, times); }; -/** - * Please use cc.repeat instead - * Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) - * @static - * @deprecated since v3.0
Please use cc.repeat instead. - * @param {cc.FiniteTimeAction} action - * @param {Number} times - * @return {cc.Repeat} - */ cc.Repeat.create = cc.repeat; -/** Repeats an action for ever.
+/* + * Repeats an action for ever.
* To repeat the an action for a limited number of times use the Repeat action.
* @warning This action can't be Sequenceable because it is not an IntervalAction - * @class - * @extends cc.ActionInterval - * @param {cc.FiniteTimeAction} action + * @class RepeatForever + * @extends ActionInterval + * @param {FiniteTimeAction} action * @example * var rep = new cc.RepeatForever(cc.sequence(jump2, jump1), 5); */ -cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ +cc.RepeatForever = cc.ActionInterval.extend({ _innerAction:null, //CCActionInterval - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Create a acton which repeat forever. - * @param {cc.FiniteTimeAction} action - */ ctor:function (action) { cc.ActionInterval.prototype.ctor.call(this); this._innerAction = null; @@ -752,8 +630,8 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ action && this.initWithAction(action); }, - /** - * @param {cc.ActionInterval} action + /* + * @param {ActionInterval} action * @return {Boolean} */ initWithAction:function (action) { @@ -764,10 +642,6 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ return true; }, - /** - * returns a new clone of the action - * @returns {cc.RepeatForever} - */ clone:function () { var action = new cc.RepeatForever(); this._cloneDecoration(action); @@ -775,20 +649,11 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._innerAction.startWithTarget(target); }, - /** - * called every frame with it's delta time.
- * DON'T override unless you know what you are doing. - * @param dt delta time in seconds - */ step:function (dt) { var locInnerAction = this._innerAction; locInnerAction.step(dt); @@ -802,18 +667,10 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ } }, - /** - * Return true if the action has finished. - * @return {Boolean} - */ isDone:function () { return false; }, - /** - * Returns a reversed action. - * @return {cc.RepeatForever} - */ reverse:function () { var action = new cc.RepeatForever(this._innerAction.reverse()); this._cloneDecoration(action); @@ -821,9 +678,9 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ return action; }, - /** + /* * Set inner action. - * @param {cc.ActionInterval} action + * @param {ActionInterval} action */ setInnerAction:function (action) { if (this._innerAction !== action) { @@ -831,9 +688,9 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ } }, - /** + /* * Get inner action. - * @return {cc.ActionInterval} + * @return {ActionInterval} */ getInnerAction:function () { return this._innerAction; @@ -842,9 +699,9 @@ cc.RepeatForever = cc.ActionInterval.extend(/** @lends cc.RepeatForever# */{ /** * Create a acton which repeat forever - * @function - * @param {cc.FiniteTimeAction} action - * @return {cc.RepeatForever} + * @method cc.repeatForever + * @param {FiniteTimeAction} action + * @return {RepeatForever} * @example * // example * var repeat = cc.repeatForever(cc.rotateBy(1.0, 360)); @@ -853,32 +710,18 @@ cc.repeatForever = function (action) { return new cc.RepeatForever(action); }; -/** - * Please use cc.repeatForever instead - * Create a acton which repeat forever - * @static - * @deprecated since v3.0
Please use cc.repeatForever instead. - * @param {cc.FiniteTimeAction} action - * @return {cc.RepeatForever} - * @param {Array|cc.FiniteTimeAction} tempArray - * @example - * var action = new cc.Spawn(cc.jumpBy(2, cc.p(300, 0), 50, 4), cc.rotateBy(2, 720)); - */ cc.RepeatForever.create = cc.repeatForever; -/** Spawn a new action immediately - * @class - * @extends cc.ActionInterval +/* + * Spawn a new action immediately + * @class Spawn + * @extends ActionInterval */ -cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{ +cc.Spawn = cc.ActionInterval.extend({ _one:null, _two:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Array|cc.FiniteTimeAction} tempArray - */ ctor:function (tempArray) { cc.ActionInterval.prototype.ctor.call(this); this._one = null; @@ -901,9 +744,9 @@ cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{ } }, - /** initializes the Spawn action with the 2 actions to spawn - * @param {cc.FiniteTimeAction} action1 - * @param {cc.FiniteTimeAction} action2 + /* initializes the Spawn action with the 2 actions to spawn + * @param {FiniteTimeAction} action1 + * @param {FiniteTimeAction} action2 * @return {Boolean} */ initWithTwoActions:function (action1, action2) { @@ -930,10 +773,6 @@ cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{ return ret; }, - /** - * returns a new clone of the action - * @returns {cc.Spawn} - */ clone:function () { var action = new cc.Spawn(); this._cloneDecoration(action); @@ -941,29 +780,18 @@ cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._one.startWithTarget(target); this._two.startWithTarget(target); }, - /** - * Stop the action - */ stop:function () { this._one.stop(); this._two.stop(); cc.Action.prototype.stop.call(this); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this._one) @@ -972,10 +800,6 @@ cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{ this._two.update(dt); }, - /** - * Returns a reversed action. - * @return {cc.Spawn} - */ reverse:function () { var action = cc.Spawn._actionOneTwo(this._one.reverse(), this._two.reverse()); this._cloneDecoration(action); @@ -986,9 +810,9 @@ cc.Spawn = cc.ActionInterval.extend(/** @lends cc.Spawn# */{ /** * Create a spawn action which runs several actions in parallel. - * @function - * @param {Array|cc.FiniteTimeAction}tempArray - * @return {cc.FiniteTimeAction} + * @method cc.spawn + * @param {Array|FiniteTimeAction}tempArray + * @return {FiniteTimeAction} * @example * // example * var action = cc.spawn(cc.jumpBy(2, cc.p(300, 0), 50, 4), cc.rotateBy(2, 720)); @@ -1007,22 +831,8 @@ cc.spawn = function (/*Multiple Arguments*/tempArray) { return prev; }; -/** - * Please use cc.spawn instead. - * Create a spawn action which runs several actions in parallel. - * @static - * @deprecated since v3.0
Please use cc.spawn instead. - * @param {Array|cc.FiniteTimeAction}tempArray - * @return {cc.FiniteTimeAction} - */ cc.Spawn.create = cc.spawn; -/** - * @param {cc.FiniteTimeAction} action1 - * @param {cc.FiniteTimeAction} action2 - * @return {cc.Spawn} - * @private - */ cc.Spawn._actionOneTwo = function (action1, action2) { var pSpawn = new cc.Spawn(); pSpawn.initWithTwoActions(action1, action2); @@ -1030,19 +840,18 @@ cc.Spawn._actionOneTwo = function (action1, action2) { }; -/** - * Rotates a ccsg.Node object to a certain angle by modifying it's. - * rotation attribute.
+/* + * Rotates a Node object to a certain angle by modifying its rotation property.
* The direction will be decided by the shortest angle. - * @class - * @extends cc.ActionInterval + * @class RotateTo + * @extends ActionInterval * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees. * @param {Number} [deltaAngleY] deltaAngleY in degrees. * @example * var rotateTo = new cc.RotateTo(2, 61.0); */ -cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{ +cc.RotateTo = cc.ActionInterval.extend({ _dstAngleX:0, _startAngleX:0, _diffAngleX:0, @@ -1051,20 +860,13 @@ cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{ _startAngleY:0, _diffAngleY:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Creates a RotateTo action with x and y rotation angles. - * @param {Number} duration duration in seconds - * @param {Number} deltaAngleX deltaAngleX in degrees. - * @param {Number} [deltaAngleY] deltaAngleY in degrees. - */ ctor:function (duration, deltaAngleX, deltaAngleY) { cc.ActionInterval.prototype.ctor.call(this); deltaAngleX !== undefined && this.initWithDuration(duration, deltaAngleX, deltaAngleY); }, - /** + /* * Initializes the action. * @param {Number} duration * @param {Number} deltaAngleX @@ -1080,10 +882,6 @@ cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.RotateTo} - */ clone:function () { var action = new cc.RotateTo(); this._cloneDecoration(action); @@ -1091,10 +889,6 @@ cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); @@ -1118,18 +912,10 @@ cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{ this._diffAngleY = locDiffAngleY; }, - /** - * RotateTo reverse not implemented. - * Will be overridden. - */ reverse:function () { cc.log("cc.RotateTo.reverse(): it should be overridden in subclass."); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target) { @@ -1140,13 +926,13 @@ cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{ }); /** - * Creates a RotateTo action with separate rotation angles. - * To specify the angle of rotation. - * @function + * Rotates a Node object to a certain angle by modifying its rotation property.
+ * The direction will be decided by the shortest angle. + * @method cc.rotateTo * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees. * @param {Number} [deltaAngleY] deltaAngleY in degrees. - * @return {cc.RotateTo} + * @return {RotateTo} * @example * // example * var rotateTo = cc.rotateTo(2, 61.0); @@ -1155,50 +941,33 @@ cc.rotateTo = function (duration, deltaAngleX, deltaAngleY) { return new cc.RotateTo(duration, deltaAngleX, deltaAngleY); }; -/** - * Please use cc.rotateTo instead - * Creates a RotateTo action with separate rotation angles. - * To specify the angle of rotation. - * @static - * @deprecated since v3.0
Please use cc.rotateTo instead. - * @param {Number} duration duration in seconds - * @param {Number} deltaAngleX deltaAngleX in degrees. - * @param {Number} [deltaAngleY] deltaAngleY in degrees. - * @return {cc.RotateTo} - */ cc.RotateTo.create = cc.rotateTo; -/** - * Rotates a ccsg.Node object clockwise a number of degrees by modifying it's rotation attribute. +/* + * Rotates a Node object clockwise a number of degrees by modifying its rotation property. * Relative to its properties to modify. - * @class - * @extends cc.ActionInterval + * @class RotateBy + * @extends ActionInterval * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees * @param {Number} [deltaAngleY] deltaAngleY in degrees * @example * var actionBy = new cc.RotateBy(2, 360); */ -cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{ +cc.RotateBy = cc.ActionInterval.extend({ _angleX:0, _startAngleX:0, _angleY:0, _startAngleY:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - * @param {Number} deltaAngleX deltaAngleX in degrees - * @param {Number} [deltaAngleY] deltaAngleY in degrees - */ ctor: function (duration, deltaAngleX, deltaAngleY) { cc.ActionInterval.prototype.ctor.call(this); deltaAngleX !== undefined && this.initWithDuration(duration, deltaAngleX, deltaAngleY); }, - /** + /* * Initializes the action. * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees @@ -1214,10 +983,6 @@ cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.RotateBy} - */ clone:function () { var action = new cc.RotateBy(); this._cloneDecoration(action); @@ -1225,20 +990,12 @@ cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._startAngleX = target.rotationX; this._startAngleY = target.rotationY; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target) { @@ -1247,10 +1004,6 @@ cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{ } }, - /** - * Returns a reversed action. - * @return {cc.RotateBy} - */ reverse:function () { var action = new cc.RotateBy(this._duration, -this._angleX, -this._angleY); this._cloneDecoration(action); @@ -1260,13 +1013,13 @@ cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{ }); /** - * Rotates a ccsg.Node object clockwise a number of degrees by modifying it's rotation attribute. + * Rotates a Node object clockwise a number of degrees by modifying its rotation property. * Relative to its properties to modify. - * @function + * @method cc.rotateBy * @param {Number} duration duration in seconds * @param {Number} deltaAngleX deltaAngleX in degrees * @param {Number} [deltaAngleY] deltaAngleY in degrees - * @return {cc.RotateBy} + * @return {RotateBy} * @example * // example * var actionBy = cc.rotateBy(2, 360); @@ -1274,46 +1027,30 @@ cc.RotateBy = cc.ActionInterval.extend(/** @lends cc.RotateBy# */{ cc.rotateBy = function (duration, deltaAngleX, deltaAngleY) { return new cc.RotateBy(duration, deltaAngleX, deltaAngleY); }; -/** - * Please use cc.rotateBy instead. - * Rotates a ccsg.Node object clockwise a number of degrees by modifying it's rotation attribute. - * Relative to its properties to modify. - * @static - * @deprecated since v3.0
Please use cc.rotateBy instead. - * @param {Number} duration duration in seconds - * @param {Number} deltaAngleX deltaAngleX in degrees - * @param {Number} [deltaAngleY] deltaAngleY in degrees - * @return {cc.RotateBy} - */ + cc.RotateBy.create = cc.rotateBy; -/** +/* *

- * Moves a CCNode object x,y pixels by modifying it's position attribute.
- * x and y are relative to the position of the object.
- * Several CCMoveBy actions can be concurrently called, and the resulting
- * movement will be the sum of individual movements. + * 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. *

- * @class - * @extends cc.ActionInterval + * @class MoveBy + * @extends ActionInterval * @param {Number} duration duration in seconds - * @param {cc.Vec2|Number} deltaPos + * @param {Vec2|Number} deltaPos * @param {Number} [deltaY] * @example * var actionTo = cc.moveBy(2, cc.p(windowSize.width - 40, windowSize.height - 40)); */ -cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ +cc.MoveBy = cc.ActionInterval.extend({ _positionDelta:null, _startPosition:null, _previousPosition:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - * @param {cc.Vec2|Number} deltaPos - * @param {Number} [deltaY] - */ ctor:function (duration, deltaPos, deltaY) { cc.ActionInterval.prototype.ctor.call(this); @@ -1324,10 +1061,10 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ deltaPos !== undefined && this.initWithDuration(duration, deltaPos, deltaY); }, - /** + /* * Initializes the action. * @param {Number} duration duration in seconds - * @param {cc.Vec2} position + * @param {Vec2} position * @param {Number} [y] * @return {Boolean} */ @@ -1345,10 +1082,6 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.MoveBy} - */ clone:function () { var action = new cc.MoveBy(); this._cloneDecoration(action); @@ -1356,10 +1089,6 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); var locPosX = target.getPositionX(); @@ -1370,10 +1099,6 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ this._startPosition.y = locPosY; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target) { @@ -1398,10 +1123,6 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ } }, - /** - * MoveTo reverse is not implemented - * @return {cc.MoveBy} - */ reverse:function () { var action = new cc.MoveBy(this._duration, cc.p(-this._positionDelta.x, -this._positionDelta.y)); this._cloneDecoration(action); @@ -1411,13 +1132,15 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ }); /** - * Create the action. - * Relative to its coordinate moves a certain distance. - * @function + * 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. + * @method cc.moveBy * @param {Number} duration duration in seconds - * @param {cc.Vec2|Number} deltaPos + * @param {Vec2|Number} deltaPos * @param {Number} deltaY - * @return {cc.MoveBy} + * @return {MoveBy} * @example * // example * var actionTo = cc.moveBy(2, cc.p(windowSize.width - 40, windowSize.height - 40)); @@ -1425,40 +1148,25 @@ cc.MoveBy = cc.ActionInterval.extend(/** @lends cc.MoveBy# */{ cc.moveBy = function (duration, deltaPos, deltaY) { return new cc.MoveBy(duration, deltaPos, deltaY); }; -/** - * Please use cc.moveBy instead. - * Relative to its coordinate moves a certain distance. - * @static - * @deprecated since v3.0 please use cc.moveBy instead. - * @param {Number} duration duration in seconds - * @param {cc.Vec2|Number} deltaPos - * @param {Number} deltaY - * @return {cc.MoveBy} - */ + cc.MoveBy.create = cc.moveBy; -/** - * Moves a CCNode object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
- * Several CCMoveTo actions can be concurrently called, and the resulting
+/* + * 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. - * @class - * @extends cc.MoveBy + * @class MoveTo + * @extends MoveBy * @param {Number} duration duration in seconds - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} y * @example * var actionBy = new cc.MoveTo(2, cc.p(80, 80)); */ -cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{ +cc.MoveTo = cc.MoveBy.extend({ _endPosition:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - * @param {cc.Vec2|Number} position - * @param {Number} y - */ ctor:function (duration, position, y) { cc.MoveBy.prototype.ctor.call(this); this._endPosition = cc.p(0, 0); @@ -1466,10 +1174,10 @@ cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{ position !== undefined && this.initWithDuration(duration, position, y); }, - /** + /* * Initializes the action. * @param {Number} duration duration in seconds - * @param {cc.Vec2} position + * @param {Vec2} position * @param {Number} y * @return {Boolean} */ @@ -1487,10 +1195,6 @@ cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.MoveTo} - */ clone:function () { var action = new cc.MoveTo(); this._cloneDecoration(action); @@ -1498,10 +1202,6 @@ cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.MoveBy.prototype.startWithTarget.call(this, target); this._positionDelta.x = this._endPosition.x - target.getPositionX(); @@ -1510,13 +1210,14 @@ cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{ }); /** - * Create new action. - * Moving to the specified coordinates. - * @function + * 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. + * @method cc.moveTo * @param {Number} duration duration in seconds - * @param {cc.Vec2} position + * @param {Vec2} position * @param {Number} y - * @return {cc.MoveBy} + * @return {MoveBy} * @example * // example * var actionBy = cc.moveTo(2, cc.p(80, 80)); @@ -1524,29 +1225,20 @@ cc.MoveTo = cc.MoveBy.extend(/** @lends cc.MoveTo# */{ cc.moveTo = function (duration, position, y) { return new cc.MoveTo(duration, position, y); }; -/** - * Please use cc.moveTo instead. - * Moving to the specified coordinates. - * @static - * @deprecated since v3.0
Please use cc.moveTo instead. - * @param {Number} duration duration in seconds - * @param {cc.Vec2} position - * @param {Number} y - * @return {cc.MoveBy} - */ + cc.MoveTo.create = cc.moveTo; -/** - * Skews a ccsg.Node object to given angles by modifying it's skewX and skewY attributes - * @class - * @extends cc.ActionInterval +/* + * Skews a Node object to given angles by modifying its skewX and skewY properties + * @class SkewTo + * @extends ActionInterval * @param {Number} t time in seconds * @param {Number} sx * @param {Number} sy * @example * var actionTo = new cc.SkewTo(2, 37.2, -37.2); */ -cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{ +cc.SkewTo = cc.ActionInterval.extend({ _skewX:0, _skewY:0, _startSkewX:0, @@ -1556,19 +1248,13 @@ cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{ _deltaX:0, _deltaY:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} t time in seconds - * @param {Number} sx - * @param {Number} sy - */ ctor: function (t, sx, sy) { cc.ActionInterval.prototype.ctor.call(this); sy !== undefined && this.initWithDuration(t, sx, sy); }, - /** + /* * Initializes the action. * @param {Number} t time in seconds * @param {Number} sx @@ -1585,10 +1271,6 @@ cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{ return ret; }, - /** - * returns a new clone of the action - * @returns {cc.SkewTo} - */ clone:function () { var action = new cc.SkewTo(); this._cloneDecoration(action); @@ -1596,10 +1278,6 @@ cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); @@ -1618,25 +1296,21 @@ cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{ this._deltaY += 360; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); this.target.skewX = this._startSkewX + this._deltaX * dt; this.target.skewY = this._startSkewY + this._deltaY * dt; } }); + /** - * Create new action. - * Skews a ccsg.Node object to given angles by modifying it's skewX and skewY attributes. + * Create a action which skews a Node object to given angles by modifying its skewX and skewY properties. * Changes to the specified value. - * @function + * @method cc.skewTo * @param {Number} t time in seconds * @param {Number} sx * @param {Number} sy - * @return {cc.SkewTo} + * @return {SkewTo} * @example * // example * var actionTo = cc.skewTo(2, 37.2, -37.2); @@ -1644,42 +1318,26 @@ cc.SkewTo = cc.ActionInterval.extend(/** @lends cc.SkewTo# */{ cc.skewTo = function (t, sx, sy) { return new cc.SkewTo(t, sx, sy); }; -/** - * Please use cc.skewTo instead. - * Skews a ccsg.Node object to given angles by modifying it's skewX and skewY attributes。 - * Changes to the specified value. - * @static - * @deprecated since v3.0
Please use cc.skewTo instead. - * @param {Number} t time in seconds - * @param {Number} sx - * @param {Number} sy - * @return {cc.SkewTo} - */ + cc.SkewTo.create = cc.skewTo; -/** - * Skews a ccsg.Node object by skewX and skewY degrees. - * Relative to its attribute modification. - * @class - * @extends cc.SkewTo +/* + * Skews a Node object by skewX and skewY degrees. + * Relative to its property modification. + * @class SkewBy + * @extends SkewTo * @param {Number} t time in seconds * @param {Number} sx skew in degrees for X axis * @param {Number} sy skew in degrees for Y axis */ -cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{ +cc.SkewBy = cc.SkewTo.extend({ - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} t time in seconds - * @param {Number} sx skew in degrees for X axis - * @param {Number} sy skew in degrees for Y axis - */ ctor: function(t, sx, sy) { cc.SkewTo.prototype.ctor.call(this); sy !== undefined && this.initWithDuration(t, sx, sy); }, - /** + /* * Initializes the action. * @param {Number} t time in seconds * @param {Number} deltaSkewX skew in degrees for X axis @@ -1696,10 +1354,6 @@ cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{ return ret; }, - /** - * returns a new clone of the action - * @returns {cc.SkewBy} - */ clone:function () { var action = new cc.SkewBy(); this._cloneDecoration(action); @@ -1707,10 +1361,6 @@ cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{ return action; }, - /** - * Start the action width target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.SkewTo.prototype.startWithTarget.call(this, target); this._deltaX = this._skewX; @@ -1719,10 +1369,6 @@ cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{ this._endSkewY = this._startSkewY + this._deltaY; }, - /** - * Returns a reversed action. - * @return {cc.SkewBy} - */ reverse:function () { var action = new cc.SkewBy(this._duration, -this._skewX, -this._skewY); this._cloneDecoration(action); @@ -1732,13 +1378,13 @@ cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{ }); /** - * Skews a ccsg.Node object by skewX and skewY degrees.
- * Relative to its attribute modification. - * @function + * Skews a Node object by skewX and skewY degrees.
+ * Relative to its property modification. + * @method cc.skewBy * @param {Number} t time in seconds * @param {Number} sx sx skew in degrees for X axis * @param {Number} sy sy skew in degrees for Y axis - * @return {cc.SkewBy} + * @return {SkewBy} * @example * // example * var actionBy = cc.skewBy(2, 0, -90); @@ -1746,27 +1392,16 @@ cc.SkewBy = cc.SkewTo.extend(/** @lends cc.SkewBy# */{ cc.skewBy = function (t, sx, sy) { return new cc.SkewBy(t, sx, sy); }; -/** - * Please use cc.skewBy instead.
- * Skews a ccsg.Node object by skewX and skewY degrees.
- * Relative to its attribute modification. - * @static - * @deprecated since v3.0 please use cc.skewBy instead. - * @param {Number} t time in seconds - * @param {Number} sx sx skew in degrees for X axis - * @param {Number} sy sy skew in degrees for Y axis - * @return {cc.SkewBy} - */ cc.SkewBy.create = cc.skewBy; -/** - * Moves a ccsg.Node object simulating a parabolic jump movement by modifying it's position attribute. +/* + * Moves a Node object simulating a parabolic jump movement by modifying its position property. * Relative to its movement. - * @class - * @extends cc.ActionInterval + * @class JumpBy + * @extends ActionInterval * @param {Number} duration - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} [y] * @param {Number} height * @param {Number} jumps @@ -1774,21 +1409,13 @@ cc.SkewBy.create = cc.skewBy; * var actionBy = new cc.JumpBy(2, cc.p(300, 0), 50, 4); * var actionBy = new cc.JumpBy(2, 300, 0, 50, 4); */ -cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ +cc.JumpBy = cc.ActionInterval.extend({ _startPosition:null, _delta:null, _height:0, _jumps:0, _previousPosition:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration - * @param {cc.Vec2|Number} position - * @param {Number} [y] - * @param {Number} height - * @param {Number} jumps - */ ctor:function (duration, position, y, height, jumps) { cc.ActionInterval.prototype.ctor.call(this); this._startPosition = cc.p(0, 0); @@ -1797,10 +1424,10 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ height !== undefined && this.initWithDuration(duration, position, y, height, jumps); }, - /** + /* * Initializes the action. * @param {Number} duration - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} [y] * @param {Number} height * @param {Number} jumps @@ -1826,10 +1453,6 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.JumpBy} - */ clone:function () { var action = new cc.JumpBy(); this._cloneDecoration(action); @@ -1837,10 +1460,6 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); var locPosX = target.getPositionX(); @@ -1851,10 +1470,6 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ this._startPosition.y = locPosY; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target) { @@ -1882,10 +1497,6 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ } }, - /** - * Returns a reversed action. - * @return {cc.JumpBy} - */ reverse:function () { var action = new cc.JumpBy(this._duration, cc.p(-this._delta.x, -this._delta.y), this._height, this._jumps); this._cloneDecoration(action); @@ -1895,15 +1506,15 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ }); /** - * Moves a ccsg.Node object simulating a parabolic jump movement by modifying it's position attribute. + * Moves a Node object simulating a parabolic jump movement by modifying it's position property. * Relative to its movement. - * @function + * @method cc.jumpBy * @param {Number} duration - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} [y] * @param {Number} height * @param {Number} jumps - * @return {cc.JumpBy} + * @return {JumpBy} * @example * // example * var actionBy = cc.jumpBy(2, cc.p(300, 0), 50, 4); @@ -1912,28 +1523,15 @@ cc.JumpBy = cc.ActionInterval.extend(/** @lends cc.JumpBy# */{ cc.jumpBy = function (duration, position, y, height, jumps) { return new cc.JumpBy(duration, position, y, height, jumps); }; -/** - * Please use cc.jumpBy instead.
- * Moves a ccsg.Node object simulating a parabolic jump movement by modifying it's position attribute.
- * Relative to its movement. - * @static - * @deprecated since v3.0 please use cc.jumpBy instead. - * @param {Number} duration - * @param {cc.Vec2|Number} position - * @param {Number} [y] - * @param {Number} height - * @param {Number} jumps - * @return {cc.JumpBy} - */ cc.JumpBy.create = cc.jumpBy; -/** - * Moves a ccsg.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
+/* + * Moves a Node object to a parabolic position simulating a jump movement by modifying it's position property.
* Jump to the specified location. - * @class - * @extends cc.JumpBy + * @class JumpTo + * @extends JumpBy * @param {Number} duration - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} [y] * @param {Number} height * @param {Number} jumps @@ -1941,27 +1539,19 @@ cc.JumpBy.create = cc.jumpBy; * var actionTo = new cc.JumpTo(2, cc.p(300, 0), 50, 4); * var actionTo = new cc.JumpTo(2, 300, 0, 50, 4); */ -cc.JumpTo = cc.JumpBy.extend(/** @lends cc.JumpTo# */{ +cc.JumpTo = cc.JumpBy.extend({ _endPosition:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration - * @param {cc.Vec2|Number} position - * @param {Number} [y] - * @param {Number} height - * @param {Number} jumps - */ ctor:function (duration, position, y, height, jumps) { cc.JumpBy.prototype.ctor.call(this); this._endPosition = cc.p(0, 0); height !== undefined && this.initWithDuration(duration, position, y, height, jumps); }, - /** + /* * Initializes the action. * @param {Number} duration - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} [y] * @param {Number} height * @param {Number} jumps @@ -1982,20 +1572,13 @@ cc.JumpTo = cc.JumpBy.extend(/** @lends cc.JumpTo# */{ } return false; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ + startWithTarget:function (target) { cc.JumpBy.prototype.startWithTarget.call(this, target); this._delta.x = this._endPosition.x - this._startPosition.x; this._delta.y = this._endPosition.y - this._startPosition.y; }, - /** - * returns a new clone of the action - * @returns {cc.JumpTo} - */ clone:function () { var action = new cc.JumpTo(); this._cloneDecoration(action); @@ -2005,15 +1588,15 @@ cc.JumpTo = cc.JumpBy.extend(/** @lends cc.JumpTo# */{ }); /** - * Moves a ccsg.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
+ * Moves a Node object to a parabolic position simulating a jump movement by modifying its position property.
* Jump to the specified location. - * @function + * @method cc.jumpTo * @param {Number} duration - * @param {cc.Vec2|Number} position + * @param {Vec2|Number} position * @param {Number} [y] * @param {Number} height * @param {Number} jumps - * @return {cc.JumpTo} + * @return {JumpTo} * @example * // example * var actionTo = cc.jumpTo(2, cc.p(300, 300), 50, 4); @@ -2022,23 +1605,11 @@ cc.JumpTo = cc.JumpBy.extend(/** @lends cc.JumpTo# */{ cc.jumpTo = function (duration, position, y, height, jumps) { return new cc.JumpTo(duration, position, y, height, jumps); }; -/** - * Please use cc.jumpTo instead. - * Moves a ccsg.Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
- * Jump to the specified location. - * @static - * @deprecated since v3.0 please use cc.jumpTo instead. - * @param {Number} duration - * @param {cc.Vec2|Number} position - * @param {Number} [y] - * @param {Number} height - * @param {Number} jumps - * @return {cc.JumpTo} - */ + cc.JumpTo.create = cc.jumpTo; -/** - * @function +/* + * @method cc.bezierAt * @param {Number} a * @param {Number} b * @param {Number} c @@ -2053,26 +1624,21 @@ cc.bezierAt = function (a, b, c, d, t) { Math.pow(t, 3) * d ); }; -/** An action that moves the target with a cubic Bezier curve by a certain distance. +/* An action that moves the target with a cubic Bezier curve by a certain distance. * Relative to its movement. - * @class - * @extends cc.ActionInterval + * @class BezierBy + * @extends ActionInterval * @param {Number} t time in seconds * @param {Array} c Array of points * @example * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)]; * var bezierForward = new cc.BezierBy(3, bezier); */ -cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ +cc.BezierBy = cc.ActionInterval.extend({ _config:null, _startPosition:null, _previousPosition:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} t time in seconds - * @param {Array} c Array of points - */ ctor:function (t, c) { cc.ActionInterval.prototype.ctor.call(this); this._config = []; @@ -2082,7 +1648,7 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ c && this.initWithDuration(t, c); }, - /** + /* * Initializes the action. * @param {Number} t time in seconds * @param {Array} c Array of points @@ -2096,10 +1662,6 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.BezierBy} - */ clone:function () { var action = new cc.BezierBy(); this._cloneDecoration(action); @@ -2112,10 +1674,6 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); var locPosX = target.getPositionX(); @@ -2126,10 +1684,6 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ this._startPosition.y = locPosY; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target) { @@ -2166,10 +1720,6 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ } }, - /** - * Returns a reversed action. - * @return {cc.BezierBy} - */ reverse:function () { var locConfig = this._config; var r = [ @@ -2186,10 +1736,10 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ /** * An action that moves the target with a cubic Bezier curve by a certain distance. * Relative to its movement. - * @function + * @method cc.bezierBy * @param {Number} t time in seconds * @param {Array} c Array of points - * @return {cc.BezierBy} + * @return {BezierBy} * @example * // example * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)]; @@ -2198,44 +1748,28 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{ cc.bezierBy = function (t, c) { return new cc.BezierBy(t, c); }; -/** - * Please use cc.bezierBy instead. - * An action that moves the target with a cubic Bezier curve by a certain distance. - * Relative to its movement. - * @static - * @deprecated since v3.0 please use cc.bezierBy instead. - * @param {Number} t time in seconds - * @param {Array} c Array of points - * @return {cc.BezierBy} - */ cc.BezierBy.create = cc.bezierBy; -/** An action that moves the target with a cubic Bezier curve to a destination point. - * @class - * @extends cc.BezierBy +/* An action that moves the target with a cubic Bezier curve to a destination point. + * @class BezierTo + * @extends BezierBy * @param {Number} t * @param {Array} c array of points * @example * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)]; * var bezierTo = new cc.BezierTo(2, bezier); */ -cc.BezierTo = cc.BezierBy.extend(/** @lends cc.BezierTo# */{ +cc.BezierTo = cc.BezierBy.extend({ _toConfig:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} t - * @param {Array} c array of points - * var bezierTo = new cc.BezierTo(2, bezier); - */ ctor:function (t, c) { cc.BezierBy.prototype.ctor.call(this); this._toConfig = []; c && this.initWithDuration(t, c); }, - /** + /* * Initializes the action. * @param {Number} t time in seconds * @param {Array} c Array of points @@ -2249,10 +1783,6 @@ cc.BezierTo = cc.BezierBy.extend(/** @lends cc.BezierTo# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.BezierTo} - */ clone:function () { var action = new cc.BezierTo(); this._cloneDecoration(action); @@ -2260,10 +1790,6 @@ cc.BezierTo = cc.BezierBy.extend(/** @lends cc.BezierTo# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.BezierBy.prototype.startWithTarget.call(this, target); var locStartPos = this._startPosition; @@ -2277,10 +1803,10 @@ cc.BezierTo = cc.BezierBy.extend(/** @lends cc.BezierTo# */{ }); /** * An action that moves the target with a cubic Bezier curve to a destination point. - * @function + * @method cc.bezierTo * @param {Number} t * @param {Array} c array of points - * @return {cc.BezierTo} + * @return {BezierTo} * @example * // example * var bezier = [cc.p(0, windowSize.height / 2), cc.p(300, -windowSize.height / 2), cc.p(300, 100)]; @@ -2289,21 +1815,13 @@ cc.BezierTo = cc.BezierBy.extend(/** @lends cc.BezierTo# */{ cc.bezierTo = function (t, c) { return new cc.BezierTo(t, c); }; -/** - * Please use cc.bezierTo instead - * @static - * @deprecated since v3.0 please use cc.bezierTo instead. - * @param {Number} t - * @param {Array} c array of points - * @return {cc.BezierTo} - */ cc.BezierTo.create = cc.bezierTo; -/** Scales a ccsg.Node object to a zoom factor by modifying it's scale attribute. +/* Scales a Node object to a zoom factor by modifying it's scale property. * @warning This action doesn't support "reverse" - * @class - * @extends cc.ActionInterval + * @class ScaleTo + * @extends ActionInterval * @param {Number} duration * @param {Number} sx scale parameter in X * @param {Number} [sy] scale parameter in Y, if Null equal to sx @@ -2314,7 +1832,7 @@ cc.BezierTo.create = cc.bezierTo; * // It scales to 0.5 in x and 2 in Y * var actionTo = new cc.ScaleTo(2, 0.5, 2); */ -cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ +cc.ScaleTo = cc.ActionInterval.extend({ _scaleX:1, _scaleY:1, _startScaleX:1, @@ -2324,18 +1842,12 @@ cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ _deltaX:0, _deltaY:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration - * @param {Number} sx scale parameter in X - * @param {Number} [sy] scale parameter in Y, if Null equal to sx - */ ctor:function (duration, sx, sy) { cc.ActionInterval.prototype.ctor.call(this); sx !== undefined && this.initWithDuration(duration, sx, sy); }, - /** + /* * Initializes the action. * @param {Number} duration * @param {Number} sx @@ -2351,10 +1863,6 @@ cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.ScaleTo} - */ clone:function () { var action = new cc.ScaleTo(); this._cloneDecoration(action); @@ -2362,10 +1870,6 @@ cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._startScaleX = target.scaleX; @@ -2374,10 +1878,6 @@ cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ this._deltaY = this._endScaleY - this._startScaleY; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target) { @@ -2387,12 +1887,12 @@ cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ } }); /** - * Scales a ccsg.Node object to a zoom factor by modifying it's scale attribute. - * @function + * Scales a Node object to a zoom factor by modifying it's scale property. + * @method cc.scaleTo * @param {Number} duration * @param {Number} sx scale parameter in X * @param {Number} [sy] scale parameter in Y, if Null equal to sx - * @return {cc.ScaleTo} + * @return {ScaleTo} * @example * // example * // It scales to 0.5 in both X and Y. @@ -2404,39 +1904,21 @@ cc.ScaleTo = cc.ActionInterval.extend(/** @lends cc.ScaleTo# */{ cc.scaleTo = function (duration, sx, sy) { //function overload return new cc.ScaleTo(duration, sx, sy); }; -/** - * Please use cc.scaleTo instead. - * Scales a ccsg.Node object to a zoom factor by modifying it's scale attribute. - * @static - * @deprecated since v3.0 please use cc.scaleTo instead. - * @param {Number} duration - * @param {Number} sx scale parameter in X - * @param {Number} [sy] scale parameter in Y, if Null equal to sx - * @return {cc.ScaleTo} - */ cc.ScaleTo.create = cc.scaleTo; -/** Scales a ccsg.Node object a zoom factor by modifying it's scale attribute. +/* Scales a Node object a zoom factor by modifying it's scale property. * Relative to its changes. - * @class - * @extends cc.ScaleTo + * @class ScaleBy + * @extends ScaleTo */ -cc.ScaleBy = cc.ScaleTo.extend(/** @lends cc.ScaleBy# */{ - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ +cc.ScaleBy = cc.ScaleTo.extend({ startWithTarget:function (target) { cc.ScaleTo.prototype.startWithTarget.call(this, target); this._deltaX = this._startScaleX * this._endScaleX - this._startScaleX; this._deltaY = this._startScaleY * this._endScaleY - this._startScaleY; }, - /** - * Returns a reversed action. - * @return {cc.ScaleBy} - */ reverse:function () { var action = new cc.ScaleBy(this._duration, 1 / this._endScaleX, 1 / this._endScaleY); this._cloneDecoration(action); @@ -2444,10 +1926,6 @@ cc.ScaleBy = cc.ScaleTo.extend(/** @lends cc.ScaleBy# */{ return action; }, - /** - * returns a new clone of the action - * @returns {cc.ScaleBy} - */ clone:function () { var action = new cc.ScaleBy(); this._cloneDecoration(action); @@ -2456,13 +1934,13 @@ cc.ScaleBy = cc.ScaleTo.extend(/** @lends cc.ScaleBy# */{ } }); /** - * Scales a ccsg.Node object a zoom factor by modifying it's scale attribute. + * Scales a Node object a zoom factor by modifying it's scale property. * Relative to its changes. - * @function + * @method cc.scaleBy * @param {Number} duration duration in seconds * @param {Number} sx sx scale parameter in X * @param {Number|Null} [sy=] sy scale parameter in Y, if Null equal to sx - * @return {cc.ScaleBy} + * @return {ScaleBy} * @example * // example without sy, it scales by 2 both in X and Y * var actionBy = cc.scaleBy(2, 2); @@ -2473,42 +1951,26 @@ cc.ScaleBy = cc.ScaleTo.extend(/** @lends cc.ScaleBy# */{ cc.scaleBy = function (duration, sx, sy) { return new cc.ScaleBy(duration, sx, sy); }; -/** - * Please use cc.scaleBy instead. - * Scales a ccsg.Node object a zoom factor by modifying it's scale attribute. - * Relative to its changes. - * @static - * @deprecated since v3.0 please use cc.scaleBy() instead. - * @param {Number} duration duration in seconds - * @param {Number} sx sx scale parameter in X - * @param {Number|Null} [sy=] sy scale parameter in Y, if Null equal to sx - * @return {cc.ScaleBy} - */ cc.ScaleBy.create = cc.scaleBy; -/** Blinks a ccsg.Node object by modifying it's visible attribute - * @class - * @extends cc.ActionInterval +/* Blinks a Node object by modifying it's visible property + * @class Blink + * @extends ActionInterval * @param {Number} duration duration in seconds * @param {Number} blinks blinks in times * @example * var action = new cc.Blink(2, 10); */ -cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{ +cc.Blink = cc.ActionInterval.extend({ _times:0, _originalState:false, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - * @param {Number} blinks blinks in times - */ ctor:function (duration, blinks) { cc.ActionInterval.prototype.ctor.call(this); blinks !== undefined && this.initWithDuration(duration, blinks); }, - /** + /* * Initializes the action. * @param {Number} duration duration in seconds * @param {Number} blinks blinks in times @@ -2522,10 +1984,6 @@ cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.Blink} - */ clone:function () { var action = new cc.Blink(); this._cloneDecoration(action); @@ -2533,10 +1991,6 @@ cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{ return action; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt time in seconds - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this.target && !this.isDone()) { @@ -2546,27 +2000,16 @@ cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{ } }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._originalState = target.visible; }, - /** - * stop the action - */ stop:function () { this.target.visible = this._originalState; cc.ActionInterval.prototype.stop.call(this); }, - /** - * Returns a reversed action. - * @return {cc.Blink} - */ reverse:function () { var action = new cc.Blink(this._duration, this._times); this._cloneDecoration(action); @@ -2575,11 +2018,11 @@ cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{ } }); /** - * Blinks a ccsg.Node object by modifying it's visible attribute. - * @function + * Blinks a Node object by modifying it's visible property. + * @method cc.blink * @param {Number} duration duration in seconds * @param blinks blinks in times - * @return {cc.Blink} + * @return {Blink} * @example * // example * var action = cc.blink(2, 10); @@ -2587,41 +2030,27 @@ cc.Blink = cc.ActionInterval.extend(/** @lends cc.Blink# */{ cc.blink = function (duration, blinks) { return new cc.Blink(duration, blinks); }; -/** - * Please use cc.blink instead. - * Blinks a ccsg.Node object by modifying it's visible attribute. - * @static - * @deprecated since v3.0 please use cc.blink instead. - * @param {Number} duration duration in seconds - * @param blinks blinks in times - * @return {cc.Blink} - */ cc.Blink.create = cc.blink; -/** Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one. +/* Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one. * @warning This action doesn't support "reverse" - * @class - * @extends cc.ActionInterval + * @class FadeTo + * @extends ActionInterval * @param {Number} duration * @param {Number} opacity 0-255, 0 is transparent * @example * var action = new cc.FadeTo(1.0, 0); */ -cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{ +cc.FadeTo = cc.ActionInterval.extend({ _toOpacity:0, _fromOpacity:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration - * @param {Number} opacity 0-255, 0 is transparent - */ ctor:function (duration, opacity) { cc.ActionInterval.prototype.ctor.call(this); opacity !== undefined && this.initWithDuration(duration, opacity); }, - /** + /* * Initializes the action. * @param {Number} duration duration in seconds * @param {Number} opacity @@ -2635,10 +2064,6 @@ cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.FadeTo} - */ clone:function () { var action = new cc.FadeTo(); this._cloneDecoration(action); @@ -2646,20 +2071,12 @@ cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{ return action; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} time time in seconds - */ update:function (time) { time = this._computeEaseTime(time); var fromOpacity = this._fromOpacity !== undefined ? this._fromOpacity : 255; this.target.opacity = fromOpacity + (this._toOpacity - fromOpacity) * time; }, - /** - * Start this action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._fromOpacity = target.opacity; @@ -2668,10 +2085,10 @@ cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{ /** * Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one. - * @function + * @method cc.fadeTo * @param {Number} duration * @param {Number} opacity 0-255, 0 is transparent - * @return {cc.FadeTo} + * @return {FadeTo} * @example * // example * var action = cc.fadeTo(1.0, 0); @@ -2679,30 +2096,17 @@ cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{ cc.fadeTo = function (duration, opacity) { return new cc.FadeTo(duration, opacity); }; -/** - * Please use cc.fadeTo instead. - * Fades an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from the current value to a custom one. - * @static - * @deprecated since v3.0 please use cc.fadeTo instead. - * @param {Number} duration - * @param {Number} opacity 0-255, 0 is transparent - * @return {cc.FadeTo} - */ cc.FadeTo.create = cc.fadeTo; -/** Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
+/* Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255.
* The "reverse" of this action is FadeOut - * @class - * @extends cc.FadeTo + * @class FadeIn + * @extends FadeTo * @param {Number} duration duration in seconds */ -cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{ +cc.FadeIn = cc.FadeTo.extend({ _reverseAction: null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - */ ctor:function (duration) { cc.FadeTo.prototype.ctor.call(this); if (duration == null) @@ -2710,10 +2114,6 @@ cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{ this.initWithDuration(duration, 255); }, - /** - * Returns a reversed action. - * @return {cc.FadeOut} - */ reverse:function () { var action = new cc.FadeOut(); action.initWithDuration(this._duration, 0); @@ -2722,10 +2122,6 @@ cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{ return action; }, - /** - * returns a new clone of the action - * @returns {cc.FadeIn} - */ clone:function () { var action = new cc.FadeIn(); this._cloneDecoration(action); @@ -2733,10 +2129,6 @@ cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { if(this._reverseAction) this._toOpacity = this._reverseAction._fromOpacity; @@ -2746,9 +2138,9 @@ cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{ /** * Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255. - * @function + * @method cc.fadeIn * @param {Number} duration duration in seconds - * @return {cc.FadeIn} + * @return {FadeIn} * @example * //example * var action = cc.fadeIn(1.0); @@ -2756,29 +2148,17 @@ cc.FadeIn = cc.FadeTo.extend(/** @lends cc.FadeIn# */{ cc.fadeIn = function (duration) { return new cc.FadeIn(duration); }; -/** - * Please use cc.fadeIn instead. - * Fades In an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 0 to 255. - * @static - * @deprecated since v3.0 please use cc.fadeIn() instead. - * @param {Number} duration duration in seconds - * @return {cc.FadeIn} - */ cc.FadeIn.create = cc.fadeIn; -/** Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0. +/* Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0. * The "reverse" of this action is FadeIn - * @class - * @extends cc.FadeTo + * @class FadeOut + * @extends FadeTo * @param {Number} duration duration in seconds */ -cc.FadeOut = cc.FadeTo.extend(/** @lends cc.FadeOut# */{ +cc.FadeOut = cc.FadeTo.extend({ - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - */ ctor:function (duration) { cc.FadeTo.prototype.ctor.call(this); if (duration == null) @@ -2786,10 +2166,6 @@ cc.FadeOut = cc.FadeTo.extend(/** @lends cc.FadeOut# */{ this.initWithDuration(duration, 0); }, - /** - * Returns a reversed action. - * @return {cc.FadeIn} - */ reverse:function () { var action = new cc.FadeIn(); action._reverseAction = this; @@ -2799,10 +2175,6 @@ cc.FadeOut = cc.FadeTo.extend(/** @lends cc.FadeOut# */{ return action; }, - /** - * returns a new clone of the action - * @returns {cc.FadeOut} - */ clone:function () { var action = new cc.FadeOut(); this._cloneDecoration(action); @@ -2813,9 +2185,9 @@ cc.FadeOut = cc.FadeTo.extend(/** @lends cc.FadeOut# */{ /** * Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0. - * @function + * @method cc.fadeOut * @param {Number} d duration in seconds - * @return {cc.FadeOut} + * @return {FadeOut} * @example * // example * var action = cc.fadeOut(1.0); @@ -2823,20 +2195,12 @@ cc.FadeOut = cc.FadeTo.extend(/** @lends cc.FadeOut# */{ cc.fadeOut = function (d) { return new cc.FadeOut(d); }; -/** - * Please use cc.fadeOut instead. - * Fades Out an object that implements the cc.RGBAProtocol protocol. It modifies the opacity from 255 to 0. - * @static - * @deprecated since v3.0 please use cc.fadeOut instead. - * @param {Number} d duration in seconds - * @return {cc.FadeOut} - */ cc.FadeOut.create = cc.fadeOut; -/** Tints a ccsg.Node that implements the cc.NodeRGB protocol from current tint to a custom one. +/* Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. * @warning This action doesn't support "reverse" - * @class - * @extends cc.ActionInterval + * @class TintTo + * @extends ActionInterval * @param {Number} duration * @param {Number} red 0-255 * @param {Number} green 0-255 @@ -2844,17 +2208,10 @@ cc.FadeOut.create = cc.fadeOut; * @example * var action = new cc.TintTo(2, 255, 0, 255); */ -cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{ +cc.TintTo = cc.ActionInterval.extend({ _to:null, _from:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration - * @param {Number} red 0-255 - * @param {Number} green 0-255 - * @param {Number} blue 0-255 - */ ctor:function (duration, red, green, blue) { cc.ActionInterval.prototype.ctor.call(this); this._to = cc.color(0, 0, 0); @@ -2863,7 +2220,7 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{ blue !== undefined && this.initWithDuration(duration, red, green, blue); }, - /** + /* * Initializes the action. * @param {Number} duration * @param {Number} red 0-255 @@ -2879,10 +2236,6 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.TintTo} - */ clone:function () { var action = new cc.TintTo(); this._cloneDecoration(action); @@ -2891,20 +2244,12 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._from = this.target.color; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt time in seconds - */ update:function (dt) { dt = this._computeEaseTime(dt); var locFrom = this._from, locTo = this._to; @@ -2920,13 +2265,13 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{ }); /** - * Tints a ccsg.Node that implements the cc.NodeRGB protocol from current tint to a custom one. - * @function + * Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. + * @method cc.tintTo * @param {Number} duration * @param {Number} red 0-255 * @param {Number} green 0-255 * @param {Number} blue 0-255 - * @return {cc.TintTo} + * @return {TintTo} * @example * // example * var action = cc.tintTo(2, 255, 0, 255); @@ -2934,24 +2279,13 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{ cc.tintTo = function (duration, red, green, blue) { return new cc.TintTo(duration, red, green, blue); }; -/** - * Please use cc.tintTo instead. - * Tints a ccsg.Node that implements the cc.NodeRGB protocol from current tint to a custom one. - * @static - * @deprecated since v3.0 please use cc.tintTo instead. - * @param {Number} duration - * @param {Number} red 0-255 - * @param {Number} green 0-255 - * @param {Number} blue 0-255 - * @return {cc.TintTo} - */ cc.TintTo.create = cc.tintTo; -/** Tints a ccsg.Node that implements the cc.NodeRGB protocol from current tint to a custom one. +/* Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. * Relative to their own color change. - * @class - * @extends cc.ActionInterval + * @class TintBy + * @extends ActionInterval * @param {Number} duration duration in seconds * @param {Number} deltaRed * @param {Number} deltaGreen @@ -2959,7 +2293,7 @@ cc.TintTo.create = cc.tintTo; * @example * var action = new cc.TintBy(2, -127, -255, -127); */ -cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ +cc.TintBy = cc.ActionInterval.extend({ _deltaR:0, _deltaG:0, _deltaB:0, @@ -2968,19 +2302,12 @@ cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ _fromG:0, _fromB:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {Number} duration duration in seconds - * @param {Number} deltaRed - * @param {Number} deltaGreen - * @param {Number} deltaBlue - */ ctor:function (duration, deltaRed, deltaGreen, deltaBlue) { cc.ActionInterval.prototype.ctor.call(this); deltaBlue !== undefined && this.initWithDuration(duration, deltaRed, deltaGreen, deltaBlue); }, - /** + /* * Initializes the action. * @param {Number} duration * @param {Number} deltaRed 0-255 @@ -2998,10 +2325,6 @@ cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.TintBy} - */ clone:function () { var action = new cc.TintBy(); this._cloneDecoration(action); @@ -3009,10 +2332,6 @@ cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); @@ -3020,26 +2339,16 @@ cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ this._fromR = color.r; this._fromG = color.g; this._fromB = color.b; - }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt time in seconds - */ update:function (dt) { dt = this._computeEaseTime(dt); this.target.color = cc.color(this._fromR + this._deltaR * dt, this._fromG + this._deltaG * dt, this._fromB + this._deltaB * dt); - }, - /** - * Returns a reversed action. - * @return {cc.TintBy} - */ reverse:function () { var action = new cc.TintBy(this._duration, -this._deltaR, -this._deltaG, -this._deltaB); this._cloneDecoration(action); @@ -3049,14 +2358,14 @@ cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ }); /** - * Tints a ccsg.Node that implements the cc.NodeRGB protocol from current tint to a custom one. + * Tints a Node that implements the cc.NodeRGB protocol from current tint to a custom one. * Relative to their own color change. - * @function + * @method cc.tintBy * @param {Number} duration duration in seconds * @param {Number} deltaRed * @param {Number} deltaGreen * @param {Number} deltaBlue - * @return {cc.TintBy} + * @return {TintBy} * @example * // example * var action = cc.tintBy(2, -127, -255, -127); @@ -3064,36 +2373,15 @@ cc.TintBy = cc.ActionInterval.extend(/** @lends cc.TintBy# */{ cc.tintBy = function (duration, deltaRed, deltaGreen, deltaBlue) { return new cc.TintBy(duration, deltaRed, deltaGreen, deltaBlue); }; -/** - * Please use cc.tintBy instead. - * Tints a ccsg.Node that implements the cc.NodeRGB protocol from current tint to a custom one. - * Relative to their own color change. - * @static - * @deprecated since v3.0 please use cc.tintBy instead. - * @param {Number} duration duration in seconds - * @param {Number} deltaRed - * @param {Number} deltaGreen - * @param {Number} deltaBlue - * @return {cc.TintBy} - */ cc.TintBy.create = cc.tintBy; -/** Delays the action a certain amount of seconds - * @class - * @extends cc.ActionInterval +/* Delays the action a certain amount of seconds + * @class DelayTime + * @extends ActionInterval */ -cc.DelayTime = cc.ActionInterval.extend(/** @lends cc.DelayTime# */{ - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * Will be overwrite. - * @param {Number} dt time in seconds - */ +cc.DelayTime = cc.ActionInterval.extend({ update:function (dt) {}, - /** - * Returns a reversed action. - * @return {cc.DelayTime} - */ reverse:function () { var action = new cc.DelayTime(this._duration); this._cloneDecoration(action); @@ -3101,10 +2389,6 @@ cc.DelayTime = cc.ActionInterval.extend(/** @lends cc.DelayTime# */{ return action; }, - /** - * returns a new clone of the action - * @returns {cc.DelayTime} - */ clone:function () { var action = new cc.DelayTime(); this._cloneDecoration(action); @@ -3115,9 +2399,9 @@ cc.DelayTime = cc.ActionInterval.extend(/** @lends cc.DelayTime# */{ /** * Delays the action a certain amount of seconds - * @function + * @method cc.delayTime * @param {Number} d duration in seconds - * @return {cc.DelayTime} + * @return {DelayTime} * @example * // example * var delay = cc.delayTime(1); @@ -3125,36 +2409,24 @@ cc.DelayTime = cc.ActionInterval.extend(/** @lends cc.DelayTime# */{ cc.delayTime = function (d) { return new cc.DelayTime(d); }; -/** - * Please use cc.delayTime instead. - * Delays the action a certain amount of seconds - * @static - * @deprecated since v3.0 please use cc.delaTime instead. - * @param {Number} d duration in seconds - * @return {cc.DelayTime} - */ cc.DelayTime.create = cc.delayTime; -/** +/* *

* Executes an action in reverse order, from time=duration to time=0
* @warning Use this action carefully. This action is not sequenceable.
* Use it as the default "reversed" method of your own actions, but using it outside the "reversed"
* scope is not recommended. *

- * @class - * @extends cc.ActionInterval - * @param {cc.FiniteTimeAction} action + * @class ReverseTime + * @extends ActionInterval + * @param {FiniteTimeAction} action * @example * var reverse = new cc.ReverseTime(this); */ -cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{ +cc.ReverseTime = cc.ActionInterval.extend({ _other:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. - * @param {cc.FiniteTimeAction} action - */ ctor:function (action) { cc.ActionInterval.prototype.ctor.call(this); this._other = null; @@ -3162,8 +2434,8 @@ cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{ action && this.initWithAction(action); }, - /** - * @param {cc.FiniteTimeAction} action + /* + * @param {FiniteTimeAction} action * @return {Boolean} */ initWithAction:function (action) { @@ -3180,10 +2452,6 @@ cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.ReverseTime} - */ clone:function () { var action = new cc.ReverseTime(); this._cloneDecoration(action); @@ -3191,36 +2459,21 @@ cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._other.startWithTarget(target); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt time in seconds - */ update:function (dt) { dt = this._computeEaseTime(dt); if (this._other) this._other.update(1 - dt); }, - /** - * Returns a reversed action. - * @return {cc.ActionInterval} - */ reverse:function () { return this._other.clone(); }, - /** - * Stop the action - */ stop:function () { this._other.stop(); cc.Action.prototype.stop.call(this); @@ -3229,9 +2482,9 @@ cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{ /** * Executes an action in reverse order, from time=duration to time=0. - * @function - * @param {cc.FiniteTimeAction} action - * @return {cc.ReverseTime} + * @method cc.reverseTime + * @param {FiniteTimeAction} action + * @return {ReverseTime} * @example * // example * var reverse = cc.reverseTime(this); @@ -3239,26 +2492,18 @@ cc.ReverseTime = cc.ActionInterval.extend(/** @lends cc.ReverseTime# */{ cc.reverseTime = function (action) { return new cc.ReverseTime(action); }; -/** - * Please use cc.reverseTime instead. - * Executes an action in reverse order, from time=duration to time=0. - * @static - * @deprecated since v3.0 please use cc.reverseTime instead. - * @param {cc.FiniteTimeAction} action - * @return {cc.ReverseTime} - */ cc.ReverseTime.create = cc.reverseTime; -/** Animates a sprite given the name of an Animation - * @class - * @extends cc.ActionInterval - * @param {cc.SpriteFrameAnimation} animation +/* Animates a sprite given the name of an Animation + * @class Animate + * @extends ActionInterval + * @param {SpriteFrameAnimation} animation * @example * // create the animation with animation * var anim = new cc.Animate(dance_grey); */ -cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ +cc.Animate = cc.ActionInterval.extend({ _animation:null, _nextFrame:0, _origFrame:null, @@ -3266,11 +2511,6 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ _splitTimes: null, _currFrameIndex:0, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * create the animate with animation. - * @param {cc.SpriteFrameAnimation} animation - */ ctor:function (animation) { cc.ActionInterval.prototype.ctor.call(this); this._splitTimes = []; @@ -3278,21 +2518,21 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ animation && this.initWithAnimation(animation); }, - /** - * @return {cc.SpriteFrameAnimation} + /* + * @return {SpriteFrameAnimation} */ getAnimation:function () { return this._animation; }, - /** - * @param {cc.SpriteFrameAnimation} animation + /* + * @param {SpriteFrameAnimation} animation */ setAnimation:function (animation) { this._animation = animation; }, - /** + /* * Gets the index of sprite frame currently displayed. * @return {Number} */ @@ -3300,8 +2540,8 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ return this._currFrameIndex; }, - /** - * @param {cc.SpriteFrameAnimation} animation + /* + * @param {SpriteFrameAnimation} animation * @return {Boolean} */ initWithAnimation:function (animation) { @@ -3334,10 +2574,6 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.Animate} - */ clone:function () { var action = new cc.Animate(); this._cloneDecoration(action); @@ -3345,10 +2581,6 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Sprite} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); if (this._animation.getRestoreOriginalFrame()) @@ -3357,10 +2589,6 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ this._executedLoops = 0; }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); // if t==1, ignore. Animation should finish with t==1 @@ -3392,10 +2620,6 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ } }, - /** - * Returns a reversed action. - * @return {cc.Animate} - */ reverse:function () { var locAnimation = this._animation; var oldArray = locAnimation.getFrames(); @@ -3418,9 +2642,6 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ return action; }, - /** - * stop the action - */ stop:function () { if (this._animation.getRestoreOriginalFrame() && this.target) this.target.setSpriteFrame(this._origFrame); @@ -3430,9 +2651,9 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ /** * create the animate with animation - * @function - * @param {cc.SpriteFrameAnimation} animation - * @return {cc.Animate} + * @method cc.animate + * @param {SpriteFrameAnimation} animation + * @return {Animate} * @example * // example * // create the animation with animation @@ -3441,45 +2662,31 @@ cc.Animate = cc.ActionInterval.extend(/** @lends cc.Animate# */{ cc.animate = function (animation) { return new cc.Animate(animation); }; -/** - * Please use cc.animate instead - * create the animate with animation - * @static - * @deprecated since v3.0 please use cc.animate instead. - * @param {cc.SpriteFrameAnimation} animation - * @return {cc.Animate} - */ cc.Animate.create = cc.animate; -/** +/* *

- * Overrides the target of an action so that it always runs on the target
- * specified at action creation rather than the one specified by runAction. + * Overrides the target of an action so that it always runs on the target
+ * specified at action creation rather than the one specified by runAction. *

- * @class - * @extends cc.ActionInterval - * @param {_ccsg.Node} target - * @param {cc.FiniteTimeAction} action + * @class TargetedAction + * @extends ActionInterval + * @param {Node} target + * @param {FiniteTimeAction} action */ -cc.TargetedAction = cc.ActionInterval.extend(/** @lends cc.TargetedAction# */{ +cc.TargetedAction = cc.ActionInterval.extend({ _action:null, _forcedTarget:null, - /** - * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
- * Create an action with the specified action and forced target. - * @param {_ccsg.Node} target - * @param {cc.FiniteTimeAction} action - */ ctor: function (target, action) { cc.ActionInterval.prototype.ctor.call(this); action && this.initWithTarget(target, action); }, - /** + /* * Init an action with the specified action and forced target - * @param {_ccsg.Node} target - * @param {cc.FiniteTimeAction} action + * @param {Node} target + * @param {FiniteTimeAction} action * @return {Boolean} */ initWithTarget:function (target, action) { @@ -3491,10 +2698,6 @@ cc.TargetedAction = cc.ActionInterval.extend(/** @lends cc.TargetedAction# */{ return false; }, - /** - * returns a new clone of the action - * @returns {cc.TargetedAction} - */ clone:function () { var action = new cc.TargetedAction(); this._cloneDecoration(action); @@ -3502,42 +2705,31 @@ cc.TargetedAction = cc.ActionInterval.extend(/** @lends cc.TargetedAction# */{ return action; }, - /** - * Start the action with target. - * @param {_ccsg.Node} target - */ startWithTarget:function (target) { cc.ActionInterval.prototype.startWithTarget.call(this, target); this._action.startWithTarget(this._forcedTarget); }, - /** - * stop the action - */ stop:function () { this._action.stop(); }, - /** - * Called once per frame. Time is the number of seconds of a frame interval. - * @param {Number} dt - */ update:function (dt) { dt = this._computeEaseTime(dt); this._action.update(dt); }, - /** + /* * return the target that the action will be forced to run with - * @return {_ccsg.Node} + * @return {Node} */ getForcedTarget:function () { return this._forcedTarget; }, - /** + /* * set the target that the action will be forced to run with - * @param {_ccsg.Node} forcedTarget + * @param {Node} forcedTarget */ setForcedTarget:function (forcedTarget) { if (this._forcedTarget !== forcedTarget) @@ -3547,21 +2739,12 @@ cc.TargetedAction = cc.ActionInterval.extend(/** @lends cc.TargetedAction# */{ /** * Create an action with the specified action and forced target - * @function - * @param {_ccsg.Node} target - * @param {cc.FiniteTimeAction} action - * @return {cc.TargetedAction} + * @method cc.targetedAction + * @param {Node} target + * @param {FiniteTimeAction} action + * @return {TargetedAction} */ cc.targetedAction = function (target, action) { return new cc.TargetedAction(target, action); }; -/** - * Please use cc.targetedAction instead - * Create an action with the specified action and forced target - * @static - * @deprecated since v3.0 please use cc.targetedAction instead. - * @param {_ccsg.Node} target - * @param {cc.FiniteTimeAction} action - * @return {cc.TargetedAction} - */ cc.TargetedAction.create = cc.targetedAction; diff --git a/cocos2d/actions/CCActionTween.js b/cocos2d/actions/CCActionTween.js index 1e5fb82be7..777760ab07 100644 --- a/cocos2d/actions/CCActionTween.js +++ b/cocos2d/actions/CCActionTween.js @@ -27,7 +27,7 @@ /** * * @class - * @extends cc._Class + * @extends _Class */ cc.ActionTweenDelegate = cc._Class.extend(/** @lends cc.ActionTweenDelegate */{ @@ -44,7 +44,7 @@ cc.ActionTweenDelegate = cc._Class.extend(/** @lends cc.ActionTweenDelegate */{ * cc.ActionTween is an action that lets you update any property of an object. * * @class - * @extends cc.ActionInterval + * @extends ActionInterval * @example * //For example, if you want to modify the "width" property of a target from 200 to 300 in 2 seconds, then: * var modifyWidth = cc.actionTween(2,"width",200,300) @@ -100,7 +100,7 @@ cc.ActionTween = cc.ActionInterval.extend(/** @lends cc.ActionTween */{ /** * Start this tween with target. - * @param {cc.ActionTweenDelegate} target + * @param {ActionTweenDelegate} target */ startWithTarget:function (target) { if(!target || !target.updateTweenAction) @@ -120,7 +120,7 @@ cc.ActionTween = cc.ActionInterval.extend(/** @lends cc.ActionTween */{ /** * returns a reversed action. - * @return {cc.ActionTween} + * @return {ActionTween} */ reverse:function () { return new cc.ActionTween(this.duration, this.key, this.to, this.from); @@ -130,7 +130,7 @@ cc.ActionTween = cc.ActionInterval.extend(/** @lends cc.ActionTween */{ * to copy object with deep copy. * returns a clone of action. * - * @return {cc.ActionTween} + * @return {ActionTween} */ clone:function(){ var action = new cc.ActionTween(); @@ -141,12 +141,12 @@ cc.ActionTween = cc.ActionInterval.extend(/** @lends cc.ActionTween */{ /** * Creates an initializes the action with the property name (key), and the from and to parameters. - * @function + * @method * @param {Number} duration * @param {String} key * @param {Number} from * @param {Number} to - * @return {cc.ActionTween} + * @return {ActionTween} */ cc.actionTween = function (duration, key, from, to) { return new cc.ActionTween(duration, key, from, to); @@ -161,6 +161,6 @@ cc.actionTween = function (duration, key, from, to) { * @param {String} key * @param {Number} from * @param {Number} to - * @return {cc.ActionTween} + * @return {ActionTween} */ cc.ActionTween.create = cc.actionTween; \ No newline at end of file diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index a87ab7191d..0cb540a607 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -929,7 +929,6 @@ var Node = cc.Class({ } cc.eventManager.removeListener(this._touchListener); - this._touchListener.release(); this._touchListener = null; } }, @@ -942,7 +941,6 @@ var Node = cc.Class({ } cc.eventManager.removeListener(this._mouseListener); - this._mouseListener.release(); this._mouseListener = null; } }, @@ -1107,12 +1105,16 @@ if (cc.sys.isNative) { }, function (value) { this.__sgNode = value; if (this._touchListener) { + this._touchListener.retain(); cc.eventManager.removeListener(this._touchListener); cc.eventManager.addListener(this._touchListener, this); + this._touchListener.release(); } if (this._mouseListener) { + this._mouseListener.retain(); cc.eventManager.removeListener(this._mouseListener); cc.eventManager.addListener(this._mouseListener, this); + this._mouseListener.release(); } }, true); } diff --git a/cocos2d/core/label/CCSGLabel.js b/cocos2d/core/label/CCSGLabel.js index 81c1eed3d0..65dd0fe6f1 100644 --- a/cocos2d/core/label/CCSGLabel.js +++ b/cocos2d/core/label/CCSGLabel.js @@ -256,20 +256,41 @@ _ccsg.Label = _ccsg.Node.extend({ return this._fontSize; }, - setOverflow: function(overflow) { - if (this._overFlow === overflow) return; - this._overFlow = overflow; - if (this._overFlow === _ccsg.Label.Overflow.RESIZE_HEIGHT) { - this._setDimensions(this._labelDimensions.width, 0); + _updateWrapText: function(overflow){ + if ( overflow === _ccsg.Label.Overflow.RESIZE_HEIGHT) { this._isWrapText = true; } - if (this._overFlow === _ccsg.Label.Overflow.NONE) { + if (overflow === _ccsg.Label.Overflow.NONE) { this._isWrapText = false; - this._setDimensions(0, 0); } + }, + + + _setOverflowBMFont: function () { + if (this._labelType === _ccsg.Label.Type.BMFont) { + + if ( this._overFlow === _ccsg.Label.Overflow.RESIZE_HEIGHT) { + this._setDimensions(this._labelDimensions.width, 0); + } + + if (this._overFlow === _ccsg.Label.Overflow.NONE) { + this._setDimensions(0, 0); + } + + this._rescaleWithOriginalFontSize(); + } + }, + + setOverflow: function(overflow) { + if (this._overFlow === overflow) return; + + this._overFlow = overflow; + + this._updateWrapText(this._overFlow); + + this._setOverflowBMFont(); - this._rescaleWithOriginalFontSize(); this._notifyLabelSkinDirty(); }, @@ -325,9 +346,6 @@ _ccsg.Label = _ccsg.Node.extend({ //todo add bmfont here this._labelType = _ccsg.Label.Type.BMFont; this._initBMFontWithString(this._string, fontHandle); - if(this._overFlow === _ccsg.Label.Overflow.RESIZE_HEIGHT) { - this._setDimensions(this._labelDimensions.width, 0); - } } }, @@ -382,37 +400,7 @@ _ccsg.Label = _ccsg.Node.extend({ return; } - var oldWidth = this._contentSize.width; - var oldHeight = this._contentSize.height; - if (this._labelType === _ccsg.Label.Type.TTF || - this._labelType === _ccsg.Label.Type.SystemFont) { - _ccsg.Node.prototype.setContentSize.call(this, size, height); - if (oldWidth === this._contentSize.width && oldHeight === this._contentSize.height) { - return; - } - var newWidth = size.width || size; - var newHeight = size.height || height; - this._labelWidth = newWidth; - this._labelHeight = newHeight; - this._labelDimensions.width = newWidth; - this._labelDimensions.height = newHeight; - - this._maxLineWidth = newWidth; - - this._notifyLabelSkinDirty(); - } else if (this._labelType === _ccsg.Label.Type.BMFont) { - if (!height) { - if (oldWidth === size.width && oldHeight === size.height) { - return; - } - this._setDimensions(size.width, size.height); - } else { - if (oldWidth === size && oldHeight === height) { - return; - } - this._setDimensions(size, height); - } - } + this._setDimensions(size, height); }, setBlendFunc: function(src, dst) { @@ -625,18 +613,35 @@ cc.BMFontHelper = { this._lettersInfo[letterIndex]._positionY = letterPosition.y; }, - _setDimensions: function(width, height) { - if (this._overFlow === _ccsg.Label.Overflow.RESIZE_HEIGHT) { - height = 0; - } - if (height !== this._labelHeight || width !== this._labelWidth) { - this._labelWidth = width; - this._labelHeight = height; - this._labelDimensions.width = width; - this._labelDimensions.height = height; + _setDimensions: function(size, height) { + var newWidth = size.width || size; + var newHeight = size.height || height; - this._maxLineWidth = width; - if (this._overFlow === _ccsg.Label.Overflow.SHRINK) { + _ccsg.Node.prototype.setContentSize.call(this, size, height); + + if (this._labelType === _ccsg.Label.Type.BMFont) { + + if (this._overFlow === _ccsg.Label.Overflow.RESIZE_HEIGHT) { + newHeight = 0; + } + + if (this._overFlow === _ccsg.Label.Overflow.NONE) { + newWidth = 0; + newHeight = 0; + } + } + + + if (newHeight !== this._labelHeight || newWidth !== this._labelWidth) { + + this._labelWidth = newWidth; + this._labelHeight = newHeight; + this._labelDimensions.width = newWidth; + this._labelDimensions.height = newHeight; + + this._maxLineWidth = newWidth; + + if (this._labelType === _ccsg.Label.Type.BMFont && this._overFlow === _ccsg.Label.Overflow.SHRINK) { if (this._bmFontSize > 0) { this._restoreFontSize(); } diff --git a/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js b/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js index 2a889f1c2c..7b8de1232f 100644 --- a/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js +++ b/cocos2d/core/label/CCSGLabelCanvasRenderCmd.js @@ -214,11 +214,11 @@ this._splitedStrings = this._splitedStrings.concat(this._fragmentText(paragraphedStrings[i], canvasSizeX, ctx)); } canvasSizeY = this._splitedStrings.length * this._getLineHeight(); - node.setContentSize(cc.size(canvasSizeX, canvasSizeY)); + node._setDimensions(cc.size(canvasSizeX, canvasSizeY)); } else { this._splitedStrings = paragraphedStrings; canvasSizeY = this._splitedStrings.length * this._getLineHeight(); - node.setContentSize(cc.size(canvasSizeX, canvasSizeY)); + node._setDimensions(cc.size(canvasSizeX, canvasSizeY)); } } else if(_ccsg.Label.Overflow.SHRINK === node._overFlow) { this._splitedStrings = paragraphedStrings; @@ -252,12 +252,14 @@ } } else if(_ccsg.Label.Overflow.NONE == node._overFlow) { this._splitedStrings = paragraphedStrings; + canvasSizeX = 0; + canvasSizeY = 0; for (var i = 0; i < paragraphedStrings.length; ++i) { var paraLength = ctx.measureText(paragraphedStrings[i]).width; canvasSizeX = canvasSizeX > paraLength ? canvasSizeX : paraLength; } canvasSizeY = this._splitedStrings.length * this._getLineHeight(); - node.setContentSize(cc.size(canvasSizeX, canvasSizeY)); + node._setDimensions(cc.size(canvasSizeX, canvasSizeY)); } else { //others treat it as clamp if (node._isWrapText) { diff --git a/cocos2d/core/platform/CCClass.js b/cocos2d/core/platform/CCClass.js index 28a1adfc8f..3086afde75 100644 --- a/cocos2d/core/platform/CCClass.js +++ b/cocos2d/core/platform/CCClass.js @@ -1,7 +1,7 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2015 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. http://www.cocos2d-x.org @@ -66,10 +66,6 @@ var _appendProp = function (cls, name/*, isGetter*/) { if (index < 0) { cls.__props__.push(name); } - // 这里不进行报错,因为重写 prop 可以是一个合法的行为,可以用于设置新的默认值。 - //else { - // cc.error(cc.getClassName(cls) + '.' + name + ' is already defined!'); - //} }; var _metaClass = { @@ -171,10 +167,6 @@ var _metaClass = { 'every getter is actually non-serialized.', JS.getClassName(this), name); } - if (attr.hasOwnProperty('default')) { - cc.error('%s: Can not set default value of a getter!', JS.getClassName(this)); - return this; - } } } } @@ -250,7 +242,7 @@ var _metaClass = { */ extend: function (options) { options.extends = this; - return FireClass(options); + return CCClass(options); } }; @@ -428,7 +420,7 @@ function define (className, baseClasses, mixins, constructor, options) { function _checkCtor (ctor) { if (CC_DEV) { - if (FireClass._isCCClass(ctor)) { + if (CCClass._isCCClass(ctor)) { cc.error("Constructor can not be another CCClass"); return; } @@ -437,8 +429,8 @@ function _checkCtor (ctor) { return; } if (ctor.length > 0) { - // fireball-x/dev#138: To make a unified FireClass serialization process, - // we don't allow parameters for constructor when creating instances of FireClass. + // fireball-x/dev#138: To make a unified CCClass serialization process, + // we don't allow parameters for constructor when creating instances of CCClass. // For advance user, construct arguments can still get from 'arguments'. cc.warn("Can not instantiate CCClass with arguments."); return; @@ -506,7 +498,7 @@ function _createCtor (ctor, baseClass, mixins, className, options) { for (var b = 0; b < baseOrMixins.length; b++) { var baseOrMixin = baseOrMixins[b]; if (baseOrMixin) { - if (FireClass._isCCClass(baseOrMixin)) { + if (CCClass._isCCClass(baseOrMixin)) { var baseCtors = baseOrMixin.__ctors__; if (baseCtors) { ctors = ctors.concat(baseCtors); @@ -632,8 +624,8 @@ function boundSuperCalls (baseClass, options) { } /** - * !#en Defines a FireClass using the given specification, please see [Class](/en/scripting/class/) for details. - * !#zh 定义一个 FireClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/zh/scripting/class/)。 + * !#en Defines a CCClass using the given specification, please see [Class](/en/scripting/class/) for details. + * !#zh 定义一个 CCClass,传入参数必须是一个包含类型参数的字面量对象,具体用法请查阅[类型定义](/zh/scripting/class/)。 * * @class Class * @param {Object} options @@ -684,7 +676,7 @@ function boundSuperCalls (baseClass, options) { // ... }; */ -function FireClass (options) { +function CCClass (options) { if (arguments.length === 0) { return define(); } @@ -796,7 +788,7 @@ function FireClass (options) { * @return {Boolean} * @private */ -FireClass._isCCClass = function (constructor) { +CCClass._isCCClass = function (constructor) { return !!constructor && (constructor.prop === _metaClass.prop); }; @@ -805,7 +797,7 @@ FireClass._isCCClass = function (constructor) { // @param {Function} constructor // @private // -//FireClass._convertToFireClass = function (constructor) { +//CCClass._convertToFireClass = function (constructor) { // constructor.prop = _metaClass.prop; //}; @@ -823,7 +815,7 @@ function fastDefine (className, constructor, serializableFields) { } } -FireClass.attr = Attr.attr; +CCClass.attr = Attr.attr; var tmpAttrs = []; function parseAttributes (attrs, className, propName) { @@ -985,26 +977,6 @@ function parseAttributes (attrs, className, propName) { } } - if (CC_DEV) { - var watch = attrs.watch; - if (watch) { - if (typeof watch === 'object') { - for (var watchKey in watch) { - var watchCallback = watch[watchKey]; - if (typeof watchCallback === 'function') { - result.push(Attr.Watch(watchKey.split(' '), watchCallback)); - } - else { - cc.error(ERR_Type, 'value', 'watch object', 'function'); - } - } - } - else { - cc.error(ERR_Type, 'watch', className + '.' + propName, 'object'); - } - } - } - return result; } @@ -1013,9 +985,9 @@ function parseAttributes (attrs, className, propName) { * @return {Function} * @deprecated */ -FireClass.extend = FireClass; +CCClass.extend = CCClass; -cc.Class = FireClass; +cc.Class = CCClass; module.exports = { instantiateProps: instantiateProps, diff --git a/cocos2d/core/platform/CCLoader.js b/cocos2d/core/platform/CCLoader.js index b6dc664f78..2ffc05afae 100644 --- a/cocos2d/core/platform/CCLoader.js +++ b/cocos2d/core/platform/CCLoader.js @@ -300,43 +300,49 @@ cc.loader = cc.loader || (function () { callback = option; url = urlAppendTimestamp(url); - + var isNew = false; var img = this.getRes(url); if (!img) { img = new Image(); + isNew = true; if (opt.isCrossOrigin && location.origin !== "file://") img.crossOrigin = "Anonymous"; - img.src = url; } - if (img.complete && img.naturalWidth > 0) { + if (!isNew && img.complete && img.naturalWidth > 0) { callback && callback(null, img); - } else { - var loadCallback = function () { - img.removeEventListener('load', loadCallback, false); - img.removeEventListener('error', errorCallback, false); + } + else { + function loadCallback () { + img.removeEventListener('load', loadCallback); + img.removeEventListener('error', errorCallback); if (callback) callback(null, img); - }; + } var self = this; - var errorCallback = function () { - img.removeEventListener('load', loadCallback, false); - img.removeEventListener('error', errorCallback, false); + function errorCallback () { + img.removeEventListener('load', loadCallback); + img.removeEventListener('error', errorCallback); - if(img.crossOrigin && img.crossOrigin.toLowerCase() === "anonymous"){ + if (img.crossOrigin && img.crossOrigin.toLowerCase() === "anonymous") { opt.isCrossOrigin = false; self.release(url); cc.loader.loadImg(url, opt, callback); - }else{ + } + else { typeof callback === "function" && callback("load image failed"); } - }; + } img.addEventListener("load", loadCallback); img.addEventListener("error", errorCallback); } + + if (isNew) { + img.src = url; + } return img; }, diff --git a/cocos2d/core/platform/attribute.js b/cocos2d/core/platform/attribute.js index ec5cbbd172..7419870b0c 100644 --- a/cocos2d/core/platform/attribute.js +++ b/cocos2d/core/platform/attribute.js @@ -1,7 +1,7 @@ /**************************************************************************** Copyright (c) 2008-2010 Ricardo Quesada Copyright (c) 2011-2012 cocos2d-x.org - Copyright (c) 2013-2014 Chukong Technologies Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. http://www.cocos2d-x.org @@ -27,6 +27,10 @@ var JS = require('./js'); var isPlainEmptyObj = require('./utils').isPlainEmptyObj_DEV; +/** + * @class Class + */ + /** * Tag the class with any meta attributes, then return all current attributes assigned to it. * This function holds only the attributes, not their implementations. @@ -36,6 +40,8 @@ var isPlainEmptyObj = require('./utils').isPlainEmptyObj_DEV; * @param {String} propertyName - the name of property or function, used to retrieve the attributes * @param {Object} [attributes] - the attribute table to mark, new attributes will merged with existed attributes. Attribute whose key starts with '_' will be ignored. * @return {Object|Undefined} return all attributes associated with the property. if none undefined will be returned + * @static + * @private * @example {@link utils/api/engine/docs/cocos2d/core/platform/attribute/attr.js} */ function attr (constructor, propertyName, attributes) { @@ -101,6 +107,39 @@ function attr (constructor, propertyName, attributes) { } } +/** + * @module cc + */ + +/** + * Specify that the input value must be integer in Inspector. + * Also used to indicates that the elements in array should be type integer. + * @property {string} Integer + * @readonly + */ +cc.Integer = 'Integer'; + +/** + * Indicates that the elements in array should be type double. + * @property {string} Float + * @readonly + */ +cc.Float = 'Float'; + +/** + * Indicates that the elements in array should be type boolean. + * @property {string} Boolean + * @readonly + */ +cc.Boolean = 'Boolean'; + +/** + * Indicates that the elements in array should be type string. + * @property {string} String + * @readonly + */ +cc.String = 'String'; + /* BuiltinAttributes: { default: defaultValue, @@ -267,22 +306,6 @@ function Nullable (boolPropName, hasValueByDefault) { }; } -// -// @method Watch -// @param {String} names - the name of target property to watch, array is also acceptable. -// @param {Function} callback - the callback function to invoke when target property(s) is changed. -// @param {Object} callback.param object - the instance object which contains watching property(s). -// @param {Object} callback.param element - the property element which displays watching property(s). -// @return {object} the attribute -// @private -// -function Watch (names, callback) { - return { - watch: [].concat(names), // array of property name to watch - watchCallback: callback - }; -} - function Range (min, max) { return { min: min, max: max }; } @@ -296,6 +319,5 @@ module.exports = { RawType: RawType, ScriptUuid: {}, // the value will be represented as a uuid string Nullable: Nullable, - Watch: Watch, Range: Range }; diff --git a/cocos2d/core/platform/deserialize.js b/cocos2d/core/platform/deserialize.js index 52848feb44..8bcb17f172 100644 --- a/cocos2d/core/platform/deserialize.js +++ b/cocos2d/core/platform/deserialize.js @@ -402,7 +402,7 @@ var _Deserializer = (function () { var klass = null; if (serialized.__type__) { - // Type Object (including FireClass) + // Type Object (including CCClass) klass = self._classFinder(serialized.__type__); if (!klass) { diff --git a/cocos2d/core/platform/preprocess-attrs.js b/cocos2d/core/platform/preprocess-attrs.js index 359779bf54..3241821cf8 100644 --- a/cocos2d/core/platform/preprocess-attrs.js +++ b/cocos2d/core/platform/preprocess-attrs.js @@ -26,7 +26,7 @@ var Attr = require('./attribute'); -// 增加预处理属性这个步骤的目的是降低 FireClass 的实现难度,将比较稳定的通用逻辑和一些需求比较灵活的属性需求分隔开。 +// 增加预处理属性这个步骤的目的是降低 CCClass 的实现难度,将比较稳定的通用逻辑和一些需求比较灵活的属性需求分隔开。 var SerializableAttrs = { url: { @@ -193,6 +193,14 @@ module.exports = function (properties, className, cls) { properties[propName] = val; } if (val) { + if (CC_EDITOR && 'default' in val) { + if (val.get) { + cc.error('The "default" value of "%s.%s" should not be used with a "get" function.', className, propName); + } + else if (val.set) { + cc.error('The "default" value of "%s.%s" should not be used with a "set" function.', className, propName); + } + } if (!val.override && cls.__props__.indexOf(propName) !== -1 && CC_DEV) { // check override var baseClass = cc.js.getClassName(getBaseClassWherePropertyDefined(propName, cls)); diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 28b5ca8a8b..b9f61ae231 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -597,7 +597,17 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ }); var sgNode = this._sgNode = new _ccsg.Node(); - sgNode.retain(); + if (cc.sys.isNative) { + sgNode.retain(); + var entity = this; + sgNode.onEnter = function () { + _ccsg.Node.prototype.onEnter.call(this); + if (!entity._active) { + cc.director.getActionManager().pauseTarget(this); + cc.eventManager.pauseTarget(this); + } + }; + } if (!cc.game._isCloning) { sgNode.cascadeOpacity = true; } diff --git a/jsb/jsb-director.js b/jsb/jsb-director.js index d5a9ef5bfd..61471966b6 100644 --- a/jsb/jsb-director.js +++ b/jsb/jsb-director.js @@ -141,7 +141,10 @@ cc.js.mixin(cc.director, { this.runWithScene(sgScene); } else { - this.replaceScene(sgScene); + // Delay to avoid issues like transition in event callback + this.once(cc.Director.EVENT_AFTER_DRAW, function () { + this.replaceScene(sgScene); + }); } // Activate