mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
@@ -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: [],
|
||||
|
||||
@@ -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 完全控制动画播放过程。<br/>
|
||||
* 大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 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
|
||||
|
||||
@@ -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 当前是否正在暂停
|
||||
* @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 () {
|
||||
|
||||
+16
-10
@@ -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
|
||||
|
||||
@@ -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() 时默认播放的动画剪辑。
|
||||
* @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 是否在运行游戏后自动播放默认动画剪辑。
|
||||
* @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 获取动画组件上的所有动画剪辑。
|
||||
* @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 播放当前或者指定的动画,并且停止当前正在播放动画。
|
||||
* @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 播放当前或者指定的动画(将不会停止当前播放的动画)。
|
||||
* @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. <br/>
|
||||
* Stopping an animation also Rewinds it to the Start.
|
||||
* !#zh 停止当前或者指定的动画。如果没有指定名字,则停止所有动画。
|
||||
* @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 暂停当前或者指定的动画。如果没有指定名字,则暂停当前正在播放的动画。
|
||||
* @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 重新播放指定的动画,如果没有指定名字,则重新播放当前正在播放的动画。
|
||||
* @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 设置指定动画的播放时间。如果没有指定名字,则设置所有动画的播放时间。
|
||||
* @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 获取当前或者指定的动画状态,如果未找到指定动画剪辑则返回 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 添加动画剪辑,并且可以重新设置该动画剪辑的名称。
|
||||
* @method addClip
|
||||
* @param {AnimationClip} clip - the clip to add
|
||||
* @param {String} [newName]
|
||||
@@ -393,7 +417,10 @@ 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
|
||||
* 从动画列表中移除指定的动画剪辑,<br/>
|
||||
* 如果动画剪辑正在播放并且 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.
|
||||
@@ -420,8 +447,10 @@ var Animation = cc.Class({
|
||||
},
|
||||
|
||||
/**
|
||||
* Samples animations at the current state.
|
||||
* !#en
|
||||
* Samples animations at the current state.<br/>
|
||||
* This is useful when you explicitly want to set up some animation state, and sample it once.
|
||||
* !#zh 对当前动画进行采样。你可以手动将动画设置到某一个状态,然后采样一次。
|
||||
* @method sample
|
||||
*/
|
||||
sample: function () {
|
||||
|
||||
@@ -29,11 +29,10 @@
|
||||
* cc.spriteFrameAnimationCache is a singleton object that manages the Animations.<br/>
|
||||
* It saves in a cache the animations. You should use this class if you want to save your animations in a cache.<br/>
|
||||
* <br/>
|
||||
* example<br/>
|
||||
* cc.spriteFrameAnimationCache.addAnimation(animation,"animation1");<br/>
|
||||
* </p>
|
||||
* @class
|
||||
* @name cc.spriteFrameAnimationCache
|
||||
* @example
|
||||
* cc.spriteFrameAnimationCache.addAnimation(animation,"animation1");
|
||||
*/
|
||||
cc.spriteFrameAnimationCache = {
|
||||
_animations: {},
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
// 根节点不用查找路径
|
||||
// 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] }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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']
|
||||
]
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user