Animation
extends Component
The Animation class is used to control the playback of animations.
You can assign animation clips (AnimationClip) to the Animation component and control the playback through scripts.
typescript
let obj = new GameObject();
let animation = obj.AddComponent<Animation>(Animation);
let uuid = "31A9092E126B4B19BBFD9D5FCD75AA49";
let clip = Resources.Load<AnimationClip>(AnimationClip, uuid);
animation.AddClip(clip,"newClip")成员变量
Animation.clip : AnimationClip|null |
| Default animation. |
Animation.clipCount : number |
| The number of clips currently assigned to this animation. |
Animation.isPlaying : boolean |
| (Read Only) Indicates whether the current animation is playing. |
Animation.localBounds : Bounds |
| The current bounding box of the Animation component in local space. |
Animation.playAutomatically : boolean |
| Whether the default animation clip should automatically start playing on startup. |
Animation.wrapMode : WrapMode |
| The looping mode of the animation. |
Animation.setting : `` |
| Configuration for playing animations. |
成员方法
Animation.AddClip ( clip : AnimationClip , name : string , setting : AnimationPlaySetting? ) : void |
| Add an animation clip (AnimationClip) to the Animation component. |
Animation.Blend ( name : string , weight : number , normalized_duration : number , mode : AnimationPlayMode ) : void |
| Blends the current animation with the animation named "name". Other animations are not affected. |
Animation.GetClips ( ) : AnimationClipItem [] |
| Get multiple animation clips. |
Animation.CrossFade ( name : string , normalized_duration : number ) : void |
Animation.CrossFadeQueued ( name : string , normalized_duration : number , queue_mode : AnimationQueueMode , mode : AnimationPlayMode ) : AnimationState |
| Cross-fades the animation after the previous animation has finished playing. |
Animation.GetState ( name : string ) : AnimationState |
| Get the animation state of the animation clip named "name". |
Animation.GetClip ( name : string ) : AnimationClip |
| Get a single animation clip. |
Animation.IsPlaying ( name : string ) : boolean |
| Check if the animation with the given name is currently playing. |
Animation.Play ( name : string , mode : AnimationPlayMode ) : boolean |
| Plays an animation clip named "name" directly without any blending or fading. |
Animation.PlayQueued ( name : string , queue_mode : AnimationQueueMode , mode : AnimationPlayMode ) : void |
| Add an animation clip named 'name' to the animation play list and play it after the current animation clip finishes playing. |
Animation.RemoveClip ( clip : AnimationClip ) : void |
| Remove the specified animation clip. |
Animation.RemoveClipByName ( name : string ) : void |
| Remove an animation clip based on its name. |
Animation.Rewind ( name : string ) : void |
| Rewinds the animation clip named "name" to its starting frame. |
Animation.Sample ( ) : void |
| Samples the animation clip in the current state. |
Animation.Stop ( name : string ) : void |
| Stops the currently playing animation clip. |
Animation.SetClips ( clips : AnimationClipItem[] ) : void |
| Sets the animation clips controlled by this Animation component. |
Animation.SyncLayer ( layer : number ) : void |
| Synchronizes the animation states in the specified layer. |
