AnimationState 类型
继承于 Playable
模块: cc
AnimationState 完全控制动画播放过程。
大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。
索引
属性(properties)
animatorAnimationAnimatorcurvesObject[]曲线列表。delayNumber延迟多少秒播放。repeatCountNumber迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半)durationNumber单次动画的持续时间,秒。speedNumber播放速率。wrapModeWrapMode动画循环方式。 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCounttimeNumber动画当前的时间,秒。clipAnimationClip此动画状态正在播放的剪辑。nameString动画的名字isPlayingBoolean当前是否正在播放。isPausedBoolean当前是否正在暂停
方法
constructoronPlayonPauseonResumeonStoponErrorplay播放动画。stop停止动画播放。pause暂停动画。resume重新播放动画。step执行一帧动画。
Details
属性(properties)
animator
| meta | description |
|---|---|
| 类型 | AnimationAnimator |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:49 |
curves
曲线列表。
| meta | description |
|---|---|
| 类型 | Object[] |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:55 |
delay
延迟多少秒播放。
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:65 |
repeatCount
迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半)
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:76 |
duration
单次动画的持续时间,秒。
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:93 |
speed
播放速率。
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:103 |
wrapMode
动画循环方式。 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount
| meta | description |
|---|---|
| 类型 | WrapMode |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:112 |
time
动画当前的时间,秒。
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:126 |
clip
此动画状态正在播放的剪辑。
| meta | description |
|---|---|
| 类型 | AnimationClip |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:377 |
name
动画的名字
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:388 |
isPlaying
当前是否正在播放。
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:18 |
isPaused
当前是否正在暂停
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:30 |
方法
constructor
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/animation-state.js:25 |
参数列表
clipAnimationClipnameString
onPlay
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:45 |
onPause
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:50 |
onResume
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:55 |
onStop
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:60 |
onError
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:65 |
参数列表
errorCodestring
play
播放动画。
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:74 |
stop
停止动画播放。
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:95 |
pause
暂停动画。
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:110 |
resume
重新播放动画。
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:122 |
step
执行一帧动画。
| meta | description |
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/animation/playable.js:134 |