言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Animation.Play

Switch to Manual
public function Play(animation: string, mode: PlayMode = PlayMode.StopSameLayer): bool;

Description

アニメーションをブレンドせずに再生します。

Play() は /animation/ の名前からアニメーションを再生するか、デフォルトアニメーションを再生します。 アニメーションはブレンドをせずに急に再生を行います。 PlayMode.StopSameLayerの場合、同じレイヤーのアニメーション全てが停止します。 PlayMode.StopAllの場合、現在再生中の全てのアニメーションを停止します。 アニメーションが既に再生中の場合、他のアニメーションは停止しますが 再生中のアニメーションは巻き戻されることはありません。 アニメーションがループ設定になっていない場合、アニメーションを再生した後は再生位置は初期位置に戻り停止します。 Play() はもしアニメーションが再生できなかった場合(アニメーションクリップが無い、またはデフォルトアニメーションがない)、falseを返します。

	// Plays the default animation
	animation.Play();

具体的なアニメーションとするために、こうすることでうまくアニメーションを呼び出すことが出来ます。

	// Plays the walk animation - stops all other animations in the same layer
	animation.Play("walk");
	// Plays the walk animation - stops all other animations
	animation.Play("walk", PlayMode.StopAll);

Description