format
typescript
Animation.CrossFadeQueued(name, normalized_duration, queue_mode, mode)class: Animation
description
Cross-fades the animation after the previous animation has finished playing.
For example, you may want to play animations one after another in a specified sequence. The animation will self-replicate before playing, so you can cross-fade between the same animation. This can be used to override two identical animations. For example, you may have a sword swinging animation. After the player swings the sword back and forth, they quickly make two powerful strikes. You can play the animation in reverse, starting from the beginning, but you will see frame skipping after that.
parameter
| param_name | type | description |
|---|---|---|
| name | string | The name of the animation to play. |
| normalized_duration | number | The duration of the cross-fade in and out (in seconds). |
| queue_mode | AnimationQueueMode | The queue mode for playing the animation. |
| mode | AnimationPlayMode | The mode for playing the animation. |
reture
| type | description |
|---|---|
AnimationState | The animation state. |
code example
typescript
let obj = new GameObject();
let animation = obj.AddComponent<Animation>(Animation);
let uuid = "31A9092E1264B19BBFD9D5FCD75AA49";
let clip = Resources.Load<AnimationClip>(AnimationClip, uuid);
animation.CrossFadeQueued(clip.name, Math.random(), AnimationQueueMode.CompleteOthers, AnimationPlayMode.StopAll);