AnimationState
Class
Extends Playable
Module: cc
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.
Index
Properties
animator
AnimationAnimator
curves
Object[]
The curves list.delay
Number
The start delay which represents the number of seconds from an animation's start time to the start of the active interval.repeatCount
Number
The animation's iteration count property.
A real number greater than or equal to zero (including positive infinity) representing the number of times to repeat the animation node.
Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model calculations.
duration
Number
The iteration duration of this animation in seconds. (length)speed
Number
The animation's playback speed. 1 is normal playback speed.wrapMode
WrapMode
Wrapping mode of the playing animation. Notice : dynamic change wrapMode will reset time and repeatCount propertytime
Number
The current time of this animation in seconds.clip
AnimationClip
The clip that is being played by this animation state.name
String
The name of the playing animation.isPlaying
Boolean
Is playing or paused in play mode?isPaused
Boolean
Is currently paused? This can be true even if in edit mode(isPlaying == false).
Methods
constructor
onPlay
onPause
onResume
onStop
onError
play
Play this animation.stop
Stop this animation.pause
Pause this animation.resume
Resume this animation.step
Perform a single frame step.
Details
Properties
animator
meta | description |
---|---|
Type | AnimationAnimator |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:49 |
curves
The curves list.
meta | description |
---|---|
Type | Object[] |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:55 |
delay
The start delay which represents the number of seconds from an animation's start time to the start of the active interval.
meta | description |
---|---|
Type | Number |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:65 |
repeatCount
The animation's iteration count property.
A real number greater than or equal to zero (including positive infinity) representing the number of times to repeat the animation node.
Values less than zero and NaN values are treated as the value 1.0 for the purpose of timing model calculations.
meta | description |
---|---|
Type | Number |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:76 |
duration
The iteration duration of this animation in seconds. (length)
meta | description |
---|---|
Type | Number |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:93 |
speed
The animation's playback speed. 1 is normal playback speed.
meta | description |
---|---|
Type | Number |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:103 |
wrapMode
Wrapping mode of the playing animation. Notice : dynamic change wrapMode will reset time and repeatCount property
meta | description |
---|---|
Type | WrapMode |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:112 |
time
The current time of this animation in seconds.
meta | description |
---|---|
Type | Number |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:126 |
clip
The clip that is being played by this animation state.
meta | description |
---|---|
Type | AnimationClip |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:377 |
name
The name of the playing animation.
meta | description |
---|---|
Type | String |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:388 |
isPlaying
Is playing or paused in play mode?
meta | description |
---|---|
Type | Boolean |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:18 |
isPaused
Is currently paused? This can be true even if in edit mode(isPlaying == false).
meta | description |
---|---|
Type | Boolean |
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:30 |
Methods
constructor
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:25 |
Parameters
clip
AnimationClipname
String
onPlay
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:45 |
onPause
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:50 |
onResume
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:55 |
onStop
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:60 |
onError
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:65 |
Parameters
errorCode
string
play
Play this animation.
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:74 |
stop
Stop this animation.
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:95 |
pause
Pause this animation.
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:110 |
resume
Resume this animation.
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:122 |
step
Perform a single frame step.
meta | description |
---|---|
Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:134 |