Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Animation.CrossFade

マニュアルに切り替える
public void CrossFade(string animation, float fadeLength = 0.3F, PlayMode mode = PlayMode.StopSameLayer);
public void CrossFade(string animation, float fadeLength = 0.3F, PlayMode mode = PlayMode.StopSameLayer);
public void CrossFade(string animation, float fadeLength = 0.3F, PlayMode mode = PlayMode.StopSameLayer);

パラメーター

説明

time 秒に渡り他のアニメーションをフェードアウトさせながら animation という名のアニメーションをフェードインさせます。

PlayMode.StopSameLayer の場合、animation と同じレイヤーのアニメーションは animation がフェードインしている間フェードアウトします。 PlayMode.StopAll の場合、animation がフェードインしている間すべてのアニメーションはフェードアウトされます。

If the animation is not set to be looping it will be stopped and rewound after playing.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Animation anim; void Start() { anim = GetComponent<Animation>(); } void Update() { if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1F) anim.CrossFade("Run"); else anim.CrossFade("Idle"); } }