LoginSignup
0
0

More than 5 years have passed since last update.

UnityEditor.AnimatedValues

Posted at

Lerp関数のラッパーのようなもの。以下の4つが用意されています。

AnimFloatを使ってみる

NmcQxkHY5s.gif

using UnityEngine;
using UnityEditor;
using UnityEditor.AnimatedValues;

public class NewBehaviourScript : EditorWindow
{
    //初期化
    AnimFloat animFloat = new AnimFloat (0);

    void OnGUI ()
    {
        if (GUILayout.Button ("Start")) {
            // 初期化。 valueが変更されるたびにコールバックが呼ばれる。
            animFloat = new AnimFloat (0, () => {
                // EditorWindowを再描画
                Repaint();
            });

            // 目標値
            animFloat.target = 1;

            // Leap のスピード
            animFloat.speed = 1;
        }

        EditorGUILayout.LabelField ("value: " + animFloat.value);
    }

    [MenuItem("Window/Example")]
    static void Open ()
    {
        GetWindow<NewBehaviourScript> ();
    }
}

GUI にある Fade で使うと便利かも。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0