Exemplo n.º 1
0
    public static IEnumerator _LerpColor(System.Action <Color> callback, Color a, Color b, float length)
    {
        AnimationCurve curve = AnimationCurveExtensions.EaseInOut();

        for (float i = 0; i <= 1f; i += Time.deltaTime / length)
        {
            Color value = Color.Lerp(a, b, curve.Evaluate(i)); //Sub with a curve later

            if (callback != null)
            {
                callback(value);
            }

            yield return(null);
        }

        if (callback != null)
        {
            callback(b);
        }
    }
Exemplo n.º 2
0
    public static IEnumerator _LFloat(System.Action <float> callback, float a, float b, float length)
    {
        AnimationCurve curve = AnimationCurveExtensions.EaseInOut();

        for (float i = 0; i <= 1f; i += Time.deltaTime / length)
        {
            //Use Clamp01
            float value = Mathf.Lerp(a, b, curve.Evaluate(i)); //Sub with a curve later

            if (callback != null)
            {
                callback(value);
            }

            yield return(null);
        }

        if (callback != null)
        {
            callback(b);
        }
    }
Exemplo n.º 3
0
    public static IEnumerator _LerpTransform(Transform t, Vector3 b, float length)
    {
        AnimationCurve curve = AnimationCurveExtensions.EaseInOut();

        yield return(_LerpTransform(t, b, length, curve));
    }
Exemplo n.º 4
0
    public static Coroutine LerpTransform(MonoBehaviour mono, Transform t, Vector3 b, float length)
    {
        AnimationCurve curve = AnimationCurveExtensions.EaseInOut();

        return(mono.StartCoroutine(_LerpTransform(t, b, length, curve)));
    }