コード例 #1
0
    // ----------------------------------------------------------------------------
    // Easing equation Vector2.
    //
    // param t  Current time (in frames or seconds).
    // param b  Starting value.
    // param c  Target value.
    // param d  Expected easing duration (in frames or seconds).
    // return   The correct value.
    // ----------------------------------------------------------------------------
    public static Vector2 Ease(float t, ref Vector2 b, ref Vector2 c, float d, Easing.Method method)
    {
        EaseingDelgate func = delgates[(int)method];

        float x = func(t, b.x, c.x, d);
        float y = func(t, b.y, c.y, d);

        return(new Vector2(x, y));
    }
コード例 #2
0
    // ----------------------------------------------------------------------------
    // Easing equation Vector3.
    //
    // param t  Current time (in frames or seconds).
    // param b  Starting value.
    // param c  Target value.
    // param d  Expected easing duration (in frames or seconds).
    // return   The correct value.
    // ----------------------------------------------------------------------------
    public static Vector3 Ease(float t, ref Vector3 b, ref Vector3 c, float d, Easing.Method method)
    {
        EaseingDelgate func = delgates[(int)method];

        float x = func(t, b.x, c.x, d);
        float y = func(t, b.y, c.y, d);
        float z = func(t, b.z, c.z, d);

        return(new Vector3(x, y, z));
    }
コード例 #3
0
    // ----------------------------------------------------------------------------
    // Easing equation Color.
    //
    // param t  Current time (in frames or seconds).
    // param b  Starting value.
    // param c  Target value.
    // param d  Expected easing duration (in frames or seconds).
    // return   The correct value.
    // ----------------------------------------------------------------------------
    public static Color Ease(float t, ref Color b, ref Color c, float d, Easing.Method method)
    {
        EaseingDelgate func = delgates[(int)method];

        float cr = func(t, b.r, c.r, d);
        float cg = func(t, b.g, c.g, d);
        float cb = func(t, b.b, c.b, d);
        float ca = func(t, b.a, c.a, d);

        return(new Color(cr, cg, cb, ca));
    }
コード例 #4
0
    // ----------------------------------------------------------------------------
    // Easing equation Vector4.
    //
    // param t  Current time (in frames or seconds).
    // param b  Starting value.
    // param c  Target value.
    // param d  Expected easing duration (in frames or seconds).
    // return   The correct value.
    // ----------------------------------------------------------------------------
    public static Vector4 Ease(float t, Vector4 b, Vector4 c, float d, Easing.Method method)
    {
        EaseingDelgate func = delgates[(int)method];

        float x = func(t, b.x, c.x, d);
        float y = func(t, b.y, c.y, d);
        float z = func(t, b.z, c.z, d);
        float w = func(t, b.w, c.w, d);

        return(new Vector4(x, y, z, w));
    }
コード例 #5
0
    // Update is called once per frame
    void Update()
    {
        Easing.Method easingMethod = Easing.Method.Linear;

        switch (state)
        {
        case State.IN:
            easingMethod = easingMethodIn;
            tick        += Time.deltaTime;
            if (tick > easingDuration)
            {
                tick  = easingDuration;
                state = State.IDLE;
            }
            break;

        case State.OUT:
            easingMethod = easingMethodOut;
            tick        -= Time.deltaTime;
            if (tick < 0)
            {
                tick = 0;
                Destroy(gameObject);
            }
            break;

        case State.IDLE:
            if (Input.anyKeyDown)
            {
                state = State.OUT;
                if (exitAction == ExitAction.RELOAD)
                {
                    Application.LoadLevel(Application.loadedLevel);
                }
            }
            break;
        }

        float ease = Easing.Ease(tick, 1, 0, easingDuration, easingMethod);

        Vector2 pos = dir * ease;

        topTexture.transform.localPosition    = new Vector3(pos.x, pos.y, transform.position.z);
        bottomTexture.transform.localPosition = new Vector3(-pos.x, -pos.y, transform.position.z);
    }
コード例 #6
0
    // ----------------------------------------------------------------------------
    // Easing equation float.
    //
    // param t  Current time (in frames or seconds).
    // param b  Starting value.
    // param c  Target value.
    // param d  Expected easing duration (in frames or seconds).
    // return   The correct value.
    // ----------------------------------------------------------------------------
    public static float Ease(float t, float b, float c, float d, Easing.Method method)
    {
        EaseingDelgate func = delgates[(int)method];

        return(func(t, b, c, d));
    }
コード例 #7
0
 // ----------------------------------------------------------------------------
 // Get a cached easing delegate
 // ----------------------------------------------------------------------------
 public static EaseingDelgate GetEasingFunction(Easing.Method method)
 {
     return(delgates[(int)method]);
 }
コード例 #8
0
ファイル: Easing.cs プロジェクト: Almax27/Collectathon
    // ----------------------------------------------------------------------------
    // Easing equation float.
    //
    // param t  Current tval to ease
    // return   The correct value.
    // ----------------------------------------------------------------------------
    public static float Ease01(float t, Easing.Method method)
    {
        EaseingDelgate func = delgates[(int)method];

        return(func(t, 0, 1, 1));
    }