Animation.CrossFadeQueued 淡入淡出队列

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

Description描述

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:
如果queue为QueueMode.CompleteOthers这个动画只在所有其他动画都停止播放时才开始。
如果queue为QueueMode.PlayNow这个动画将以一个复制的动画状态立即开始播放。

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);
}
最后修改:2011年1月12日 Wednesday 23:33

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。