AnimationState 类型
继承于 Playable
模块: cc
AnimationState 完全控制动画播放过程。
大多数情况下 动画组件 是足够和易于使用的。如果您需要更多的动画控制接口,请使用 AnimationState。
索引
属性(properties)
animatorAnimationAnimatorcurvesObject[]曲线列表。delayNumber延迟多少秒播放。repeatCountNumber迭代次数,指动画播放多少次后结束, normalize time。durationNumber单次动画的持续时间,秒。speedNumber播放速率。wrapModeWrapMode动画循环方式。timeNumber动画当前的时间,秒。clipAnimationClip此动画状态正在播放的剪辑。nameString动画的名字isPlayingBoolean当前是否正在播放。isPausedBoolean当前是否正在暂停
方法
constructoronPlayonPauseonResumeonStoponErrorplay播放动画。stop停止动画播放。pause暂停动画。resume重新播放动画。step执行一帧动画。
Details
属性(properties)
animator
| meta | description | 
|---|---|
| 类型 | AnimationAnimator | 
| 定义于 | cocos2d/animation/animation-state.js:74 | 
curves
曲线列表。
| meta | description | 
|---|---|
| 类型 | Object[] | 
| 定义于 | cocos2d/animation/animation-state.js:80 | 
delay
延迟多少秒播放。
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/animation/animation-state.js:90 | 
repeatCount
迭代次数,指动画播放多少次后结束, normalize time。 如 2.5(2次半)
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/animation/animation-state.js:101 | 
duration
单次动画的持续时间,秒。
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/animation/animation-state.js:118 | 
speed
播放速率。
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/animation/animation-state.js:128 | 
wrapMode
动画循环方式。 需要注意的是,动态修改 wrapMode 时,会重置 time 以及 repeatCount
| meta | description | 
|---|---|
| 类型 | WrapMode | 
| 定义于 | cocos2d/animation/animation-state.js:137 | 
time
动画当前的时间,秒。
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | cocos2d/animation/animation-state.js:151 | 
clip
此动画状态正在播放的剪辑。
| meta | description | 
|---|---|
| 类型 | AnimationClip | 
| 定义于 | cocos2d/animation/animation-state.js:402 | 
name
动画的名字
| meta | description | 
|---|---|
| 类型 | String | 
| 定义于 | cocos2d/animation/animation-state.js:413 | 
isPlaying
当前是否正在播放。
| meta | description | 
|---|---|
| 类型 | Boolean | 
| 定义于 | cocos2d/animation/playable.js:43 | 
isPaused
当前是否正在暂停
| meta | description | 
|---|---|
| 类型 | Boolean | 
| 定义于 | cocos2d/animation/playable.js:55 | 
方法
constructor
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/animation-state.js:50 | 
参数列表
clipAnimationClipnameString
onPlay
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:70 | 
onPause
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:75 | 
onResume
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:80 | 
onStop
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:85 | 
onError
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:90 | 
参数列表
errorCodestring
play
播放动画。
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:99 | 
stop
停止动画播放。
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:120 | 
pause
暂停动画。
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:135 | 
resume
重新播放动画。
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:147 | 
step
执行一帧动画。
| meta | description | 
|---|---|
| 定义于 | cocos2d/animation/playable.js:159 |