Properties

defaultClip AnimationClip

Animation will play the default clip when start game.
当游戏启动时,动画默认播放剪辑。

currentClip AnimationClip

Current played clip.
当前播放剪辑。

playOnLoad Bool

Whether the animation should auto play the default clip when start game.
当游戏启动时,动画是否默认自动播放剪辑。

Methods

getClips ( ) returns AnimationClip[]

Get all the clips used in this animation。
获得动画所有剪辑.

play ( [name ] [startTime ] ) returns AnimationState

Plays an animation.
播放一个动画。

`name`: The name of animation to play. If no name is supplied then the default animation will be played.
动画名称。若未提供,将播放默认动画。

`startTime`: play an animation from startTime.
从startTime时刻开始播放。

`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.
播放动画的状态.在动画不能播放的情况下(例如,没有默认动画或没有指定的动画),该函数将返回空。

stop ( [name ] )

Stops an animation named name. If no name is supplied then stops all playing animations that were started with this Animation. Stopping an animation also Rewinds it to the Start.
停止播放名为`name`的动画。如果没有提供名称,则停止所有播放动画的动画。停止动画会倒回动画的开始。

`name`: The animation to stop, if not supplied then stops all playing animations.
停止动画`name`,若未提供,将停止所有正在播放的动画。

pause ( [name ] )

Pauses an animation named name. If no name is supplied then pauses all playing animations that were started with this Animation.
暂停播放名为`name`的动画。如果没有提供名称,则暂停所有播放动画的动画。再次播放时,以当前动画播放。

`name`:  The animation to pauses, if not supplied then pauses all playing animations.
暂停动画`name`,若未提供,将暂停所有正在播放的动画。

resume( [name ] )

Resumes an animation named name. If no name is supplied then resumes all paused animations that were started with this Animation.
暂停播放名为`name`的动画。如果没有提供名称,则恢复所有播放动画。再次播放时,以当前动画播放。

`name`: The animation to resumes, if not supplied then resumes all paused animations.
恢复动画`name`,若未提供,将恢复所有播放的动画。

setCurrentTime ( [time ] [name ] )

Make an animation named name go to the specified time. If no name is supplied then make all animations go to the specified time.
使一个名为`name`动画到指定的时间。如果没有提供名称,则所有动画都要到指定的时间。

getAnimationState ( name ) returns AnimationState

Returns the animation state named name. If no animation with the specified name, the function will return null.
返回动画`name`状态。如果没有指定名称的动画,该函数将返回空.

addClip ( clip, [newName ] ) returns AnimationState

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.
添加一个名称为`newName`的动画剪辑。如果名称已经存在,它将被替换为新的剪辑。

`AnimationState`: The AnimationState which gives full control over the animation clip.
`我不会了。`

removeClip ( clip, force )

Remove clip from the animation list. This will remove the clip and any animation states based on it.
从动画列表移除剪辑。这将去掉剪辑和所有基于这个剪辑的动画状态。

`force`:If force is true, then will always remove the clip and any animation states based on it.
若为true,将总是去掉剪辑和所有基于这个剪辑的动画状态。

sample ( )

Samples animations at the current state. This is useful when you explicitly want to set up some animation state, and sample it once.
在当前状态对动画进行采样。当你明确想设置一些动画状态并且对它取样一次的时候有用。