返回介绍

Animation.CrossFadeQueued

发布于 2019-12-18 15:37:09 字数 5509 浏览 915 评论 0 收藏 0

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

C# => public AnimationState CrossFadeQueued(string animation, float fadeLength = 0.3F, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);
C# => public AnimationState CrossFadeQueued(string animation, float fadeLength = 0.3F, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);
C# => public AnimationState CrossFadeQueued(string animation, float fadeLength = 0.3F, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);
C# => public AnimationState CrossFadeQueued(string animation, float fadeLength = 0.3F, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);

Description 描述

Cross fades an animation after previous animations has finished playing.

在前一个动画播放完成之后淡入淡出下一个动画。

For example you might play a specific sequence 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.

动画播放完成后它将自动清除它自己。在它播放完成后使用赋值的动画将导致一个异常。

JavaScript:

var anim: Animation;
 
function Start() {
	anim = GetComponent.<Animation>();
}
 
 
function Update () {
	if (Input.GetButtonDown("Fire1"))	
		anim.CrossFadeQueued("shoot", 0.3, QueueMode.PlayNow);
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public Animation anim;
    void Start() {
        anim = GetComponent<Animation>();
    }
    void Update() {
        if (Input.GetButtonDown("Fire1"))
            anim.CrossFadeQueued("shoot", 0.3F, QueueMode.PlayNow);
 
    }
}

Animation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文