From bf21367874ac82f129beda6ebd35ad03afcdfe5f Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 22 Mar 2016 16:12:49 +0800 Subject: [PATCH 1/3] update animation all api --- cocos2d/animation/animation-clip.js | 90 ++++--------------- cocos2d/animation/animation-state.js | 11 ++- cocos2d/animation/playable.js | 21 +++-- cocos2d/animation/types.js | 26 +++--- cocos2d/core/components/CCAnimation.js | 58 +++++++++--- cocos2d/core/sprites/CCAnimationCache.js | 6 +- .../cocos2d/core/animation-clip/curve-data.js | 57 ++++++++++++ .../cocos2d/core/animation-clip/event-data.js | 8 ++ extensions/spine/index.js | 11 ++- 9 files changed, 176 insertions(+), 112 deletions(-) create mode 100644 docs/cocos2d/core/animation-clip/curve-data.js create mode 100644 docs/cocos2d/core/animation-clip/event-data.js diff --git a/cocos2d/animation/animation-clip.js b/cocos2d/animation/animation-clip.js index fb54f0a619..8652e096b9 100644 --- a/cocos2d/animation/animation-clip.js +++ b/cocos2d/animation/animation-clip.js @@ -1,6 +1,7 @@ /** - * Class for animation data handling. + * !#en Class for animation data handling. + * !#zh 动画剪辑,用于动画数据处理。 * @class AnimationClip * @extends Asset * @constructor @@ -16,7 +17,8 @@ var AnimationClip = cc.Class({ }, /** - * Duration of this animation + * !#en Duration of this animation. + * !#zh 动画的持续时间。 * @property duration * @type {Number} */ @@ -25,7 +27,8 @@ var AnimationClip = cc.Class({ }, /** - * FrameRate of this animation + * !#en FrameRate of this animation. + * !#zh 动画的帧速率。 * @property sample * @type {Number} */ @@ -34,7 +37,8 @@ var AnimationClip = cc.Class({ }, /** - * Speed of this animation + * !#en Speed of this animation. + * !#zh 动画的播放速度。 * @property speed * @type {Number} */ @@ -43,7 +47,8 @@ var AnimationClip = cc.Class({ }, /** - * WrapMode of this animation + * !#en WrapMode of this animation. + * !#zh 在动画状态设置使用的默认循环模式。 * @property wrapMode * @type {WrapMode} */ @@ -52,67 +57,11 @@ var AnimationClip = cc.Class({ }, /** - * Curve data + * !#en Curve data. + * !#zh 曲线数据。 * @property curveData * @type {Object} - * @example - * { - * // 根节点不用查找路径 - * // root properties - * props: { - * x: [ - * { frame: 0, value: 0, curve: [0,0.5,0.5,1] }, - * { frame: 1, value: 200, curve: null } - * ] - * }, - * comps: { - * // component - * 'comp-1': { - * // component properties - * 'prop-1': [ - * { frame: 0, value: 10, curve: [0,0.5,0.5,1] }, - * { frame: 1, value: 20, curve: null } - * ] - * } - * }, - * paths: { - * // key 为节点到root的路径名, 通过cc.find找到 - * 'foo/bar': { - * // node properties - * props: { - * x: [ - * { frame: 0, value: 0, curve: [0,0.5,0.5,1] }, - * { frame: 1, value: 200, curve: null } - * ] - * }, - * comps: { - * // component - * 'comp-1': { - * // component property - * 'prop-1': [ - * { frame: 0, value: 10, curve: [0,0.5,0.5,1] }, - * { frame: 1, value: 20, curve: null } - * ] - * } - * } - * }, - * 'hello': { - * props: { - * position: [ - * { - * frame: 0, - * value: [0,0], - * motionPath: [ - * [320, 240, 0, 240, 640, 240], - * [640, 0, 400, 0, 1000, 0] - * ] - * }, - * { frame: 5, value: [640, 480] } - * ] - * } - * } - * } - * } + * @example {@link utils/api/engine/docs/cocos2d/core/animation-clip/curve-data.js} */ curveData: { default: {}, @@ -120,18 +69,11 @@ var AnimationClip = cc.Class({ }, /** - * Event data + * !#en Event data. + * !#zh 事件数据。 * @property events * @type {Array} - * @example - * [ - * frame: 0, func: 'onAnimationEvent1', params:['param-1', 'param-2'] - * frame: 2, func: 'onAnimationEvent3', params:['param-1', 'param-2'] - * frame: 3, func: 'onAnimationEvent2', params:['param-1'] - * // The second event at frame 3 - * frame: 3, func: 'onAnimationEvent4', params:['param-1'] - * frame: 4, func: 'onAnimationEvent4', params:['param-1'] - * ] + * @example {@link utils/api/engine/docs/cocos2d/core/animation-clip/event-data.js} */ events: { default: [], diff --git a/cocos2d/animation/animation-state.js b/cocos2d/animation/animation-state.js index 53d5658e2e..a77830ff25 100644 --- a/cocos2d/animation/animation-state.js +++ b/cocos2d/animation/animation-state.js @@ -3,9 +3,12 @@ var JS = cc.js; var AnimationNode = require('./types').AnimationNode; /** + * !#en * The AnimationState gives full control over animation playback process. * In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control. - * + * !#zh + * AnimationState 完全控制动画播放过程。
+ * 在大多数情况下动画界面是足够易于使用。如果您需要完全控制动画融合的任何过程,请使用 AnimationState。 * @class AnimationState * @extends AnimationNode * @constructor @@ -30,7 +33,8 @@ JS.extend(AnimationState, AnimationNode); var state = AnimationState.prototype; /** - * The clip that is being played by this animation state. + * !#en The clip that is being played by this animation state. + * !#zh 此动画状态正在播放的剪辑。 * @property clip * @type {AnimationClip} * @final @@ -40,7 +44,8 @@ JS.get(state, 'clip', function () { }); /** - * The name of the playing animation. + * !#en The name of the playing animation. + * !#zh 动画的名字 * @property name * @type {String} * @readOnly diff --git a/cocos2d/animation/playable.js b/cocos2d/animation/playable.js index 7a3fed11c9..68d42a8df8 100644 --- a/cocos2d/animation/playable.js +++ b/cocos2d/animation/playable.js @@ -13,7 +13,8 @@ function Playable () { var prototype = Playable.prototype; /** - * Is playing or paused in play mode? + * !#en Is playing or paused in play mode? + * !#zh 当前是否正在播放。 * @property isPlaying * @type {boolean} * @default false @@ -24,7 +25,8 @@ JS.get(prototype, 'isPlaying', function () { }, true); /** - * Is currently paused? This can be true even if in edit mode(isPlaying == false). + * !#en Is currently paused? This can be true even if in edit mode(isPlaying == false). + * !#zh 当前是否正在暂停,如果为 true,那么在编辑模式下 isPlaying 就为 false。 * @property isPaused * @type {boolean} * @default false @@ -67,7 +69,8 @@ prototype.onError = virtual; // public /** - * Play this animation + * !#en Play this animation. + * !#zh 播放动画。 * @method play */ prototype.play = function () { @@ -87,7 +90,8 @@ prototype.play = function () { }; /** - * Stop this animation + * !#en Stop this animation. + * !#zh 停止动画播放。 * @method stop */ prototype.stop = function () { @@ -99,7 +103,8 @@ prototype.stop = function () { }; /** - * Pause this animation + * !#en Pause this animation. + * !#zh 暂停动画。 * @method pause */ prototype.pause = function () { @@ -108,7 +113,8 @@ prototype.pause = function () { }; /** - * Resume this animation + * !#en Resume this animation. + * !#zh 重新播放动画。 * @method resume */ prototype.resume = function () { @@ -117,7 +123,8 @@ prototype.resume = function () { }; /** - * Perform a single frame step. + * !#en Perform a single frame step. + * !#zh 执行一帧动画。 * @method step */ prototype.step = function () { diff --git a/cocos2d/animation/types.js b/cocos2d/animation/types.js index a1a12b47de..76de3f53e9 100644 --- a/cocos2d/animation/types.js +++ b/cocos2d/animation/types.js @@ -10,7 +10,8 @@ var WrapModeMask = { }; /** - * Specifies how time is treated when it is outside of the keyframe range of an Animation. + * !#en Specifies how time is treated when it is outside of the keyframe range of an Animation. + * !#zh 动画状态使用的循环模式。 * @enum WrapMode * @memberof cc */ @@ -73,7 +74,8 @@ cc.WrapMode = WrapMode; /** - * The abstract interface for all playing animation. + * !#en The abstract interface for all playing animation. + * !#zh 所有播放动画的抽象接口。 * @class AnimationNodeBase * @constructor * @extends Playable @@ -92,8 +94,9 @@ JS.extend(AnimationNodeBase, Playable); AnimationNodeBase.prototype.update = function (deltaTime) {}; -/** - * The collection and instance of playing animations created by entity.animate. +/* + * !#en The collection and instance of playing animations. + * !#zh 动画曲线的集合,根据当前时间计算出每条曲线的状态。 * @class AnimationNode * @extends AnimationNodeBase * @constructor @@ -107,6 +110,8 @@ function AnimationNode (animator, curves, timingInput) { this.animator = animator; /** + * !#en The curves list. + * !#zh 曲线列表。 * @property curves * @type {AnimCurve[]} */ @@ -117,7 +122,7 @@ function AnimationNode (animator, curves, timingInput) { /** * !#en The start delay which represents the number of seconds from an animation's start time to the start of * the active interval. - * !#zh 延迟多少秒播放 + * !#zh 延迟多少秒播放。 * * @property delay * @type {Number} @@ -134,7 +139,7 @@ function AnimationNode (animator, curves, timingInput) { * Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model * calculations. * - * !#zh 迭代次数, 指动画播放多少次后结束, normalize time. 如 2.5 ( 2次半 ) + * !#zh 迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半) * * @property repeatCount * @type {Number} @@ -144,7 +149,7 @@ function AnimationNode (animator, curves, timingInput) { /** * !#en The iteration duration of this animation in seconds. (length) - * !#zh 单次动画的持续时间, 秒 + * !#zh 单次动画的持续时间,秒。 * * @property duration * @type {Number} @@ -154,7 +159,7 @@ function AnimationNode (animator, curves, timingInput) { /** * !#en The animation's playback speed. 1 is normal playback speed. - * !#zh 播放速率 + * !#zh 播放速率。 * @property speed * @type {Number} * @default: 1.0 @@ -163,7 +168,7 @@ function AnimationNode (animator, curves, timingInput) { /** * !#en Wrapping mode of the playing animation. - * !#zh 动画循环方式 + * !#zh 动画循环方式。 * * @property wrapMode * @type {WrapMode} @@ -206,7 +211,8 @@ function AnimationNode (animator, curves, timingInput) { } /** - * The current time of this animation in seconds. + * !#en The current time of this animation in seconds. + * !#zh 动画当前的时间,秒。 * @property time * @type {Number} * @default 0 diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js index f0091467cb..712b046eed 100644 --- a/cocos2d/core/components/CCAnimation.js +++ b/cocos2d/core/components/CCAnimation.js @@ -35,6 +35,8 @@ function equalClips (clip1, clip2) { } /** + * !#en The animation component is used to play back animations. + * !#zh Animation 组件用于播放动画。你能指定动画剪辑到动画组件并从脚本控制播放。 * @class Animation * @extends CCComponent */ @@ -66,7 +68,8 @@ var Animation = cc.Class({ }, /** - * Animation will play the default clip when start game + * !#en Animation will play the default clip when start game. + * !#zh 在勾选自动播放或调用 play() 时默认播放的动画 clip。 * @property defaultClip * @type {AnimationClip} */ @@ -101,7 +104,8 @@ var Animation = cc.Class({ }, /** - * Current played clip + * !#en Current played clip. + * !#zh 当前播放的动画剪辑。 * @property currentClip * @type {AnimationClip} */ @@ -121,7 +125,8 @@ var Animation = cc.Class({ }, /** - * All the clips used in this animation + * !#en All the clips used in this animation. + * !#zh 通过脚本可以访问并播放的 AnimationClip 列表。 * @property _clips * @type {AnimationClip[]} * @private @@ -134,7 +139,8 @@ var Animation = cc.Class({ }, /** - * Whether the animation should auto play the default clip when start game. + * !#en Whether the animation should auto play the default clip when start game. + * !#zh 是否在运行游戏后自动播放默认动画 clip。 * @property playOnLoad * @type {Boolean} * @default true @@ -169,7 +175,8 @@ var Animation = cc.Class({ /////////////////////////////////////////////////////////////////////////////// /** - * Get all the clips used in this animation + * !#en Get all the clips used in this animation. + * !#zh 获取动画组件上的所有 clip。 * @method getClips * @return {AnimationClip[]} */ @@ -178,11 +185,15 @@ var Animation = cc.Class({ }, /** - * Plays an animation and stop other animations. + * !#en Plays an animation and stop other animations. + * !#zh 播放当前或者指定的动画 clip,并且停止当前正在播放动画 clip。 * @method play * @param {String} [name] - The name of animation to play. If no name is supplied then the default animation will be played. * @param {Number} [startTime] - play an animation from startTime * @return {AnimationState} - The AnimationState of playing animation. In cases where the animation can't be played (ie, there is no default animation or no animation with the specified name), the function will return null. + * @example + * var animCtrl = this.node.getComponent(cc.Animation); + * animCtrl.play("linear"); */ play: function (name, startTime) { var state = this.playAdditive(name, startTime); @@ -200,12 +211,19 @@ var Animation = cc.Class({ }, /** + * !#en * Plays an additive animation, it will not stop other animations. * If there are other animations playing, then will play several animations at the same time. + * !#zh 播放当前或者指定的动画 clip(将不会停止当前播放的动画)。 * @method playAdditive * @param {String} [name] - The name of animation to play. If no name is supplied then the default animation will be played. * @param {Number} [startTime] - play an animation from startTime * @return {AnimationState} - The AnimationState of playing animation. In cases where the animation can't be played (ie, there is no default animation or no animation with the specified name), the function will return null. + * @example + * // linear_1 and linear_2 at the same time playing. + * var animCtrl = this.node.getComponent(cc.Animation); + * animCtrl.playAdditive("linear_1"); + * animCtrl.playAdditive("linear_2"); */ playAdditive: function (name, startTime) { this._init(); @@ -232,8 +250,9 @@ var Animation = cc.Class({ }, /** - * Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. + * !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation.
* Stopping an animation also Rewinds it to the Start. + * !#zh 停止当前或者指定的动画 clip。 * @method stop * @param {String} [name] - The animation to stop, if not supplied then stops all playing animations. */ @@ -253,7 +272,8 @@ var Animation = cc.Class({ }, /** - * Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation. + * !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation. + * !#zh 暂停当前或者指定的动画 clip。 * @method pause * @param {String} [name] - The animation to pauses, if not supplied then pauses all playing animations. */ @@ -273,7 +293,8 @@ var Animation = cc.Class({ }, /** - * Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation. + * !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation. + * !#zh 重新播放当前或者指定的动画 clip。 * @method resume * @param {String} [name] - The animation to resumes, if not supplied then resumes all paused animations. */ @@ -293,7 +314,8 @@ var Animation = cc.Class({ }, /** - * Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time. + * !#en Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time. + * !#zh 设置当前或者指定动画 clip 的播放时间。 * @method setCurrentTime * @param {Number} [time] - The time to go to * @param {String} [name] - Specified animation name, if not supplied then make all animations go to the time. @@ -315,7 +337,8 @@ var Animation = cc.Class({ }, /** - * Returns the animation state named name. If no animation with the specified name, the function will return null. + * !#en Returns the animation state named name. If no animation with the specified name, the function will return null. + * !#zh 获取当前或者指定的动画状态,如果未找到指定动画 clip 则返回 null。 * @method getAnimationState * @param {String} name * @return {AnimationState} @@ -343,7 +366,8 @@ var Animation = cc.Class({ }, /** - * Adds a clip to the animation with name newName. If a clip with that name already exists it will be replaced with the new clip. + * !#en Adds a clip to the animation with name newName. If a clip with that name already exists it will be replaced with the new clip. + * !#zh 添加动画 clip,并且可以重新设置该动画 clip 的名称。 * @method addClip * @param {AnimationClip} clip - the clip to add * @param {String} [newName] @@ -393,7 +417,11 @@ var Animation = cc.Class({ }, /** - * Remove clip from the animation list. This will remove the clip and any animation states based on it. + * !#en Remove clip from the animation list. This will remove the clip and any animation states based on it. + * !#zh + * 从动画列表中移除指定的动画 clip,
+ * 如果动画 clip 正在播放并且 force 参数为 true,这会停止该动画 clip,然后在移除该动画 clip,
+ * 反之为 false,这不会删除该动画 clip。 * @method removeClip * @param {AnimationClip} clip * @param {Boolean} force If force is true, then will always remove the clip and any animation states based on it. @@ -420,8 +448,10 @@ var Animation = cc.Class({ }, /** - * Samples animations at the current state. + * !#en + * Samples animations at the current state.
* This is useful when you explicitly want to set up some animation state, and sample it once. + * !#zh 对当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。 * @method sample */ sample: function () { diff --git a/cocos2d/core/sprites/CCAnimationCache.js b/cocos2d/core/sprites/CCAnimationCache.js index 7297f19402..8844fee578 100644 --- a/cocos2d/core/sprites/CCAnimationCache.js +++ b/cocos2d/core/sprites/CCAnimationCache.js @@ -29,9 +29,9 @@ * cc.spriteFrameAnimationCache is a singleton object that manages the Animations.
* It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
*
- * example
- * cc.spriteFrameAnimationCache.addAnimation(animation,"animation1");
- *

+ * example + * cc.spriteFrameAnimationCache.addAnimation(animation,"animation1"); + * * @class * @name cc.spriteFrameAnimationCache */ diff --git a/docs/cocos2d/core/animation-clip/curve-data.js b/docs/cocos2d/core/animation-clip/curve-data.js new file mode 100644 index 0000000000..d5cab21e77 --- /dev/null +++ b/docs/cocos2d/core/animation-clip/curve-data.js @@ -0,0 +1,57 @@ +{ + // 根节点不用查找路径 + // root properties + props: { + x: [ + { frame: 0, value: 0, curve: [0,0.5,0.5,1] }, + { frame: 1, value: 200, curve: null } + ] + }, + comps: { + // component + 'comp-1': { + // component properties + 'prop-1': [ + { frame: 0, value: 10, curve: [0,0.5,0.5,1] }, + { frame: 1, value: 20, curve: null } + ] + } + }, + paths: { + // key 为节点到root的路径名, 通过cc.find找到 + 'foo/bar': { + // node properties + props: { + x: [ + { frame: 0, value: 0, curve: [0,0.5,0.5,1] + { frame: 1, value: 200, curve: null } + ] + }, + comps: { + // component + 'comp-1': { + // component property + 'prop-1': [ + { frame: 0, value: 10, curve: [0,0.5,0. + { frame: 1, value: 20, curve: null } + ] + } + } + }, + 'hello': { + props: { + position: [ + { + frame: 0, + value: [0,0], + motionPath: [ + [320, 240, 0, 240, 640, 240], + [640, 0, 400, 0, 1000, 0] + ] + }, + { frame: 5, value: [640, 480] } + ] + } + } + } + } \ No newline at end of file diff --git a/docs/cocos2d/core/animation-clip/event-data.js b/docs/cocos2d/core/animation-clip/event-data.js new file mode 100644 index 0000000000..0687288c7b --- /dev/null +++ b/docs/cocos2d/core/animation-clip/event-data.js @@ -0,0 +1,8 @@ +[ + frame: 0, func: 'onAnimationEvent1', params:['param-1', 'param-2'] +frame: 2, func: 'onAnimationEvent3', params:['param-1', 'param-2'] +frame: 3, func: 'onAnimationEvent2', params:['param-1'] +// The second event at frame 3 +frame: 3, func: 'onAnimationEvent4', params:['param-1'] +frame: 4, func: 'onAnimationEvent4', params:['param-1'] +] \ No newline at end of file diff --git a/extensions/spine/index.js b/extensions/spine/index.js index c8da7c1536..adc089ccfb 100644 --- a/extensions/spine/index.js +++ b/extensions/spine/index.js @@ -58,23 +58,32 @@ sp.ATTACHMENT_TYPE = { }; /** - * The event type of spine skeleton animation. + * !#en The event type of spine skeleton animation. + * !#zh 骨骼动画事件类型。 * @enum AnimationEventType */ sp.AnimationEventType = cc.Enum({ /** + * !#en The play spine skeleton animation start type. + * !#zh 开始播放骨骼动画类型。 * @property {Number} START */ START: 0, /** + * !#en The play spine skeleton animation finish type. + * !#zh 播放骨骼动画结束类型。 * @property {Number} END */ END: 1, /** + * !#en The play spine skeleton animation complete type. + * !#zh 播放骨骼动画完成类型。 * @property {Number} COMPLETE */ COMPLETE: 2, /** + * !#en The spine skeleton animation event type. + * !#zh 骨骼动画事件类型 * @property {Number} EVENT */ EVENT: 3 From a5ef25e29f437643b16265216d0c545b0cdc14b0 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 22 Mar 2016 17:32:41 +0800 Subject: [PATCH 2/3] fix Animation api --- cocos2d/animation/animation-clip.js | 4 +-- cocos2d/animation/animation-state.js | 2 +- cocos2d/animation/types.js | 2 +- cocos2d/core/components/CCAnimation.js | 28 +++++++++---------- cocos2d/core/sprites/CCAnimationCache.js | 2 +- .../cocos2d/core/animation-clip/curve-data.js | 3 +- .../cocos2d/core/animation-clip/event-data.js | 10 +++---- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/cocos2d/animation/animation-clip.js b/cocos2d/animation/animation-clip.js index 8652e096b9..680149737f 100644 --- a/cocos2d/animation/animation-clip.js +++ b/cocos2d/animation/animation-clip.js @@ -1,7 +1,7 @@ /** * !#en Class for animation data handling. - * !#zh 动画剪辑,用于动画数据处理。 + * !#zh 动画剪辑,用于存储动画数据。 * @class AnimationClip * @extends Asset * @constructor @@ -48,7 +48,7 @@ var AnimationClip = cc.Class({ /** * !#en WrapMode of this animation. - * !#zh 在动画状态设置使用的默认循环模式。 + * !#zh 动画的循环模式。 * @property wrapMode * @type {WrapMode} */ diff --git a/cocos2d/animation/animation-state.js b/cocos2d/animation/animation-state.js index a77830ff25..a1f8d08926 100644 --- a/cocos2d/animation/animation-state.js +++ b/cocos2d/animation/animation-state.js @@ -8,7 +8,7 @@ var AnimationNode = require('./types').AnimationNode; * In most cases the Animation Component is sufficient and easier to use. Use the AnimationState if you need full control. * !#zh * AnimationState 完全控制动画播放过程。
- * 在大多数情况下动画界面是足够易于使用。如果您需要完全控制动画融合的任何过程,请使用 AnimationState。 + * 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。 * @class AnimationState * @extends AnimationNode * @constructor diff --git a/cocos2d/animation/types.js b/cocos2d/animation/types.js index 76de3f53e9..146499e5bf 100644 --- a/cocos2d/animation/types.js +++ b/cocos2d/animation/types.js @@ -11,7 +11,7 @@ var WrapModeMask = { /** * !#en Specifies how time is treated when it is outside of the keyframe range of an Animation. - * !#zh 动画状态使用的循环模式。 + * !#zh 动画使用的循环模式。 * @enum WrapMode * @memberof cc */ diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js index 712b046eed..5e30737d6a 100644 --- a/cocos2d/core/components/CCAnimation.js +++ b/cocos2d/core/components/CCAnimation.js @@ -69,7 +69,7 @@ var Animation = cc.Class({ /** * !#en Animation will play the default clip when start game. - * !#zh 在勾选自动播放或调用 play() 时默认播放的动画 clip。 + * !#zh 在勾选自动播放或调用 play() 时默认播放的动画剪辑。 * @property defaultClip * @type {AnimationClip} */ @@ -140,7 +140,7 @@ var Animation = cc.Class({ /** * !#en Whether the animation should auto play the default clip when start game. - * !#zh 是否在运行游戏后自动播放默认动画 clip。 + * !#zh 是否在运行游戏后自动播放默认动画剪辑。 * @property playOnLoad * @type {Boolean} * @default true @@ -176,7 +176,7 @@ var Animation = cc.Class({ /** * !#en Get all the clips used in this animation. - * !#zh 获取动画组件上的所有 clip。 + * !#zh 获取动画组件上的所有动画剪辑。 * @method getClips * @return {AnimationClip[]} */ @@ -186,7 +186,7 @@ var Animation = cc.Class({ /** * !#en Plays an animation and stop other animations. - * !#zh 播放当前或者指定的动画 clip,并且停止当前正在播放动画 clip。 + * !#zh 播放当前或者指定的动画剪辑,并且停止当前正在播放动画剪辑。 * @method play * @param {String} [name] - The name of animation to play. If no name is supplied then the default animation will be played. * @param {Number} [startTime] - play an animation from startTime @@ -214,7 +214,7 @@ var Animation = cc.Class({ * !#en * Plays an additive animation, it will not stop other animations. * If there are other animations playing, then will play several animations at the same time. - * !#zh 播放当前或者指定的动画 clip(将不会停止当前播放的动画)。 + * !#zh 播放当前或者指定的动画剪辑(将不会停止当前播放的动画)。 * @method playAdditive * @param {String} [name] - The name of animation to play. If no name is supplied then the default animation will be played. * @param {Number} [startTime] - play an animation from startTime @@ -252,7 +252,7 @@ var Animation = cc.Class({ /** * !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation.
* Stopping an animation also Rewinds it to the Start. - * !#zh 停止当前或者指定的动画 clip。 + * !#zh 停止当前或者指定的动画剪辑。 * @method stop * @param {String} [name] - The animation to stop, if not supplied then stops all playing animations. */ @@ -273,7 +273,7 @@ var Animation = cc.Class({ /** * !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation. - * !#zh 暂停当前或者指定的动画 clip。 + * !#zh 暂停当前或者指定的动画剪辑。 * @method pause * @param {String} [name] - The animation to pauses, if not supplied then pauses all playing animations. */ @@ -294,7 +294,7 @@ var Animation = cc.Class({ /** * !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation. - * !#zh 重新播放当前或者指定的动画 clip。 + * !#zh 重新播放当前或者指定的动画剪辑。 * @method resume * @param {String} [name] - The animation to resumes, if not supplied then resumes all paused animations. */ @@ -315,7 +315,7 @@ var Animation = cc.Class({ /** * !#en Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time. - * !#zh 设置当前或者指定动画 clip 的播放时间。 + * !#zh 设置当前或者指定动画剪辑的播放时间。 * @method setCurrentTime * @param {Number} [time] - The time to go to * @param {String} [name] - Specified animation name, if not supplied then make all animations go to the time. @@ -338,7 +338,7 @@ var Animation = cc.Class({ /** * !#en Returns the animation state named name. If no animation with the specified name, the function will return null. - * !#zh 获取当前或者指定的动画状态,如果未找到指定动画 clip 则返回 null。 + * !#zh 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 null。 * @method getAnimationState * @param {String} name * @return {AnimationState} @@ -367,7 +367,7 @@ var Animation = cc.Class({ /** * !#en Adds a clip to the animation with name newName. If a clip with that name already exists it will be replaced with the new clip. - * !#zh 添加动画 clip,并且可以重新设置该动画 clip 的名称。 + * !#zh 添加动画剪辑,并且可以重新设置该动画剪辑的名称。 * @method addClip * @param {AnimationClip} clip - the clip to add * @param {String} [newName] @@ -419,9 +419,9 @@ var Animation = cc.Class({ /** * !#en Remove clip from the animation list. This will remove the clip and any animation states based on it. * !#zh - * 从动画列表中移除指定的动画 clip,
- * 如果动画 clip 正在播放并且 force 参数为 true,这会停止该动画 clip,然后在移除该动画 clip,
- * 反之为 false,这不会删除该动画 clip。 + * 从动画列表中移除指定的动画剪辑,
+ * 如果动画剪辑正在播放并且 force 参数为 true,这会停止该动画剪辑,然后在移除该动画剪辑,
+ * 反之为 false,这不会删除该动画剪辑。 * @method removeClip * @param {AnimationClip} clip * @param {Boolean} force If force is true, then will always remove the clip and any animation states based on it. diff --git a/cocos2d/core/sprites/CCAnimationCache.js b/cocos2d/core/sprites/CCAnimationCache.js index 8844fee578..61157d9991 100644 --- a/cocos2d/core/sprites/CCAnimationCache.js +++ b/cocos2d/core/sprites/CCAnimationCache.js @@ -29,7 +29,7 @@ * cc.spriteFrameAnimationCache is a singleton object that manages the Animations.
* It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
*
- * example + * @example * cc.spriteFrameAnimationCache.addAnimation(animation,"animation1"); * * @class diff --git a/docs/cocos2d/core/animation-clip/curve-data.js b/docs/cocos2d/core/animation-clip/curve-data.js index d5cab21e77..5ad9672332 100644 --- a/docs/cocos2d/core/animation-clip/curve-data.js +++ b/docs/cocos2d/core/animation-clip/curve-data.js @@ -54,4 +54,5 @@ } } } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/docs/cocos2d/core/animation-clip/event-data.js b/docs/cocos2d/core/animation-clip/event-data.js index 0687288c7b..d49fabd517 100644 --- a/docs/cocos2d/core/animation-clip/event-data.js +++ b/docs/cocos2d/core/animation-clip/event-data.js @@ -1,8 +1,8 @@ [ frame: 0, func: 'onAnimationEvent1', params:['param-1', 'param-2'] -frame: 2, func: 'onAnimationEvent3', params:['param-1', 'param-2'] -frame: 3, func: 'onAnimationEvent2', params:['param-1'] -// The second event at frame 3 -frame: 3, func: 'onAnimationEvent4', params:['param-1'] -frame: 4, func: 'onAnimationEvent4', params:['param-1'] + frame: 2, func: 'onAnimationEvent3', params:['param-1', 'param-2'] + frame: 3, func: 'onAnimationEvent2', params:['param-1'] + // The second event at frame 3 + frame: 3, func: 'onAnimationEvent4', params:['param-1'] + frame: 4, func: 'onAnimationEvent4', params:['param-1'] ] \ No newline at end of file From 7757ac7ae280ef9b29caea16fc66158401d6d275 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Tue, 22 Mar 2016 18:07:00 +0800 Subject: [PATCH 3/3] fix Animation api --- cocos2d/animation/playable.js | 2 +- cocos2d/core/components/CCAnimation.js | 15 +++++++-------- cocos2d/core/sprites/CCAnimationCache.js | 5 ++--- extensions/spine/index.js | 8 ++++---- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cocos2d/animation/playable.js b/cocos2d/animation/playable.js index 68d42a8df8..4c959a20bc 100644 --- a/cocos2d/animation/playable.js +++ b/cocos2d/animation/playable.js @@ -26,7 +26,7 @@ JS.get(prototype, 'isPlaying', function () { /** * !#en Is currently paused? This can be true even if in edit mode(isPlaying == false). - * !#zh 当前是否正在暂停,如果为 true,那么在编辑模式下 isPlaying 就为 false。 + * !#zh 当前是否正在暂停 * @property isPaused * @type {boolean} * @default false diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js index 5e30737d6a..154f57b034 100644 --- a/cocos2d/core/components/CCAnimation.js +++ b/cocos2d/core/components/CCAnimation.js @@ -186,7 +186,7 @@ var Animation = cc.Class({ /** * !#en Plays an animation and stop other animations. - * !#zh 播放当前或者指定的动画剪辑,并且停止当前正在播放动画剪辑。 + * !#zh 播放当前或者指定的动画,并且停止当前正在播放动画。 * @method play * @param {String} [name] - The name of animation to play. If no name is supplied then the default animation will be played. * @param {Number} [startTime] - play an animation from startTime @@ -214,7 +214,7 @@ var Animation = cc.Class({ * !#en * Plays an additive animation, it will not stop other animations. * If there are other animations playing, then will play several animations at the same time. - * !#zh 播放当前或者指定的动画剪辑(将不会停止当前播放的动画)。 + * !#zh 播放当前或者指定的动画(将不会停止当前播放的动画)。 * @method playAdditive * @param {String} [name] - The name of animation to play. If no name is supplied then the default animation will be played. * @param {Number} [startTime] - play an animation from startTime @@ -252,7 +252,7 @@ var Animation = cc.Class({ /** * !#en Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation.
* Stopping an animation also Rewinds it to the Start. - * !#zh 停止当前或者指定的动画剪辑。 + * !#zh 停止当前或者指定的动画。如果没有指定名字,则停止所有动画。 * @method stop * @param {String} [name] - The animation to stop, if not supplied then stops all playing animations. */ @@ -273,7 +273,7 @@ var Animation = cc.Class({ /** * !#en Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation. - * !#zh 暂停当前或者指定的动画剪辑。 + * !#zh 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。 * @method pause * @param {String} [name] - The animation to pauses, if not supplied then pauses all playing animations. */ @@ -294,7 +294,7 @@ var Animation = cc.Class({ /** * !#en Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation. - * !#zh 重新播放当前或者指定的动画剪辑。 + * !#zh 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。 * @method resume * @param {String} [name] - The animation to resumes, if not supplied then resumes all paused animations. */ @@ -315,7 +315,7 @@ var Animation = cc.Class({ /** * !#en Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time. - * !#zh 设置当前或者指定动画剪辑的播放时间。 + * !#zh 设置指定动画的播放时间。如果没有指定名字,则设置所有动画的播放时间。 * @method setCurrentTime * @param {Number} [time] - The time to go to * @param {String} [name] - Specified animation name, if not supplied then make all animations go to the time. @@ -420,8 +420,7 @@ var Animation = cc.Class({ * !#en Remove clip from the animation list. This will remove the clip and any animation states based on it. * !#zh * 从动画列表中移除指定的动画剪辑,
- * 如果动画剪辑正在播放并且 force 参数为 true,这会停止该动画剪辑,然后在移除该动画剪辑,
- * 反之为 false,这不会删除该动画剪辑。 + * 如果动画剪辑正在播放并且 force 参数为 true,这会停止该动画剪辑,然后在移除该动画剪辑,反之为 false,则会停止该动画。 * @method removeClip * @param {AnimationClip} clip * @param {Boolean} force If force is true, then will always remove the clip and any animation states based on it. diff --git a/cocos2d/core/sprites/CCAnimationCache.js b/cocos2d/core/sprites/CCAnimationCache.js index 61157d9991..1cc5074630 100644 --- a/cocos2d/core/sprites/CCAnimationCache.js +++ b/cocos2d/core/sprites/CCAnimationCache.js @@ -29,11 +29,10 @@ * cc.spriteFrameAnimationCache is a singleton object that manages the Animations.
* It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
*
- * @example - * cc.spriteFrameAnimationCache.addAnimation(animation,"animation1"); - * * @class * @name cc.spriteFrameAnimationCache + * @example + * cc.spriteFrameAnimationCache.addAnimation(animation,"animation1"); */ cc.spriteFrameAnimationCache = { _animations: {}, diff --git a/extensions/spine/index.js b/extensions/spine/index.js index adc089ccfb..aafb6c6800 100644 --- a/extensions/spine/index.js +++ b/extensions/spine/index.js @@ -65,25 +65,25 @@ sp.ATTACHMENT_TYPE = { sp.AnimationEventType = cc.Enum({ /** * !#en The play spine skeleton animation start type. - * !#zh 开始播放骨骼动画类型。 + * !#zh 开始播放骨骼动画。 * @property {Number} START */ START: 0, /** * !#en The play spine skeleton animation finish type. - * !#zh 播放骨骼动画结束类型。 + * !#zh 播放骨骼动画结束。 * @property {Number} END */ END: 1, /** * !#en The play spine skeleton animation complete type. - * !#zh 播放骨骼动画完成类型。 + * !#zh 播放骨骼动画完成。 * @property {Number} COMPLETE */ COMPLETE: 2, /** * !#en The spine skeleton animation event type. - * !#zh 骨骼动画事件类型 + * !#zh 骨骼动画事件。 * @property {Number} EVENT */ EVENT: 3