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
animatorAnimationAnimatorcurvesObject[]The curves list.delayNumberThe start delay which represents the number of seconds from an animation's start time to the start of the active interval.repeatCountNumberThe 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.
durationNumberThe iteration duration of this animation in seconds. (length)speedNumberThe animation's playback speed. 1 is normal playback speed.wrapModeWrapModeWrapping mode of the playing animation. Notice : dynamic change wrapMode will reset time and repeatCount propertytimeNumberThe current time of this animation in seconds.clipAnimationClipThe clip that is being played by this animation state.nameStringThe name of the playing animation.isPlayingBooleanIs playing or paused in play mode?isPausedBooleanIs currently paused? This can be true even if in edit mode(isPlaying == false).
Methods
constructoronPlayonPauseonResumeonStoponErrorplayPlay this animation.stopStop this animation.pausePause this animation.resumeResume this animation.stepPerform 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
clipAnimationClipnameString
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
errorCodestring
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 |