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

スクリプト言語

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

AnimationCurve.keys

マニュアルに切り替える
public Keyframe[] keys;

説明

アニメーションカーブで定義されるすべてのキー。

これは配列からいくつかのキーを追加や削除することができます。 もし時間を基準としたソートが行われていない場合、自動的にソートが行われます。

配列は"値"による配列ということに注意してください。例えば取得するキーはすべてのキーのコピー カーブの中に設定されているキーのコピーを返しています。

関連項目: Keyframe 構造体、AddKeyRemoveKey 関数 .

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private AnimationCurve anim; private Keyframe[] ks; void Start() { ks = new Keyframe[50]; int i = 0; while (i < ks.Length) { ks[i] = new Keyframe(i, i * i); i++; } anim = new AnimationCurve(ks); } void Update() { transform.position = new Vector3(Time.time, anim.Evaluate(Time.time), 0); } }