Animation.CrossFadeQueued 淡入淡出队列

function CrossFadeQueued (animation : string, fadeLength : float = 0.3F, queue : QueueMode = QueueMode.CompleteOthers, mode : PlayMode = PlayMode.StopSameLayer) : AnimationState


Cross fades an animation after previous animations has finished playing.


For example you might play a specific sequeue of animations after each other.


The animation duplicates itself before playing thus you can fade between the same animation. This can be used to overlay two same animations. For example you might have a sword swing animation. The player slashes two times quickly after each other. You could rewind the animation and play from the beginning but then you will get a jump in the animation.

动画在播放前复制自身,因此你可以再相同的动画间渐变,这可用来重叠两个相 同的动画。例如你可能有一个挥剑的动画,玩家快速挥动了2次,你可以回放这个动画并从开始播放它,但会跳帧。

The following queue modes are available: If queue is QueueMode.CompleteOthers this animation will only start once all other animations have stopped playing. If queue is QueueMode.PlayNow this animation will start playing immediately on a duplicated animation state.

下面是可用的queue modes:

After the animation has finished playing it will automatically clean itself up. Using the duplicated animation state after it has finished will result in an exception.


using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Update() {
		if (Input.GetButtonDown("Fire1"))
			animation.CrossFadeQueued("shoot", 0.3F, QueueMode.PlayNow);

function Update () {
	if (Input.GetButtonDown("Fire1"))
		animation.CrossFadeQueued("shoot", 0.3, QueueMode.PlayNow);
Page last updated: 2011-1-12