Exemplo n.º 1
0
 public static float EaseInOut(float time, float duration, float unusedOvershootOrAmplitude, float unusedPeriod)
 {
     if (time < duration * 0.5f)
     {
         return(Bounce.EaseIn(time * 2f, duration, -1f, -1f) * 0.5f);
     }
     return(Bounce.EaseOut(time * 2f - duration, duration, -1f, -1f) * 0.5f + 0.5f);
 }
Exemplo n.º 2
0
 public static float EaseInOut(float t, float b, float c, float d)
 {
     if (t < d / 2)
     {
         return(Bounce.EaseIn(t * 2, 0, c, d) * .5f + b);
     }
     else
     {
         return(Bounce.EaseOut(t * 2 - d, 0, c, d) * .5f + c * .5f + b);
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Calculate a Ease In from a pourcent
    /// </summary>
    /// <param name="linearStep">Pourcent on the ease</param>
    /// <param name="type">Easing Type</param>
    public static float EaseIn(float linearStep, EasingType type)
    {
        switch (type)
        {
        case EasingType.Step:
            return(Mathf.Round(linearStep));

        default:
        case EasingType.Linear:
            return(linearStep);

        case EasingType.Sine:
            return(Sine.EaseIn(linearStep));

        case EasingType.Quadratic:
            return(Power.EaseIn(linearStep, 2));

        case EasingType.Cubic:
            return(Power.EaseIn(linearStep, 3));

        case EasingType.Quartic:
            return(Power.EaseIn(linearStep, 4));

        case EasingType.Quintic:
            return(Power.EaseIn(linearStep, 5));

        case EasingType.Elastic:
            return(Elastic.EaseIn(linearStep));

        case EasingType.Bounce:
            return(Bounce.EaseIn(linearStep));

        case EasingType.Back:
            return(Back.EaseIn(linearStep));

        case EasingType.Expo:
            return(Expo.EaseIn(linearStep));

        case EasingType.Circ:
            return(Circ.EaseIn(linearStep));
        }
    }
Exemplo n.º 4
0
    public static float EaseIn(float linearStep, EaseType type)
    {
        switch (type)
        {
        case EaseType.None:
            return(1);

        case EaseType.Linear:
            return(linearStep);

        case EaseType.Sine:
            return(Sine.EaseIn(linearStep));

        case EaseType.Quad:
            return(Power.EaseIn(linearStep, 2));

        case EaseType.Cubic:
            return(Power.EaseIn(linearStep, 3));

        case EaseType.Quartic:
            return(Power.EaseIn(linearStep, 4));

        case EaseType.Quintic:
            return(Power.EaseIn(linearStep, 5));

        case EaseType.Circ:
            return(Circ.EaseIn(linearStep));

        case EaseType.Bounce:
            return(Bounce.EaseIn(linearStep));

        case EaseType.Back:
            return(Back.EaseIn(linearStep));

        case EaseType.Elastic:
            return(Elastic.EaseIn(linearStep));
        }
        Debug.LogError("Um.");
        return(0);
    }
        /// <summary>
        /// Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected
        /// </summary>
        internal static float Evaluate(EaseType easeType, float time, float duration, float overshootOrAmplitude, float period)
        {
            if (duration <= 0)
            {
                return(1);
            }

            switch (easeType)
            {
            case EaseType.Linear:
                return(time / duration);

            case EaseType.SineIn:
                return(-(float)Math.Cos(time / duration * _PiOver2) + 1);

            case EaseType.SineOut:
                return((float)Math.Sin(time / duration * _PiOver2));

            case EaseType.SineInOut:
                return(-0.5f * ((float)Math.Cos(Mathf.PI * time / duration) - 1));

            case EaseType.QuadIn:
                return((time /= duration) * time);

            case EaseType.QuadOut:
                return(-(time /= duration) * (time - 2));

            case EaseType.QuadInOut:
                if ((time /= duration * 0.5f) < 1)
                {
                    return(0.5f * time * time);
                }
                return(-0.5f * ((--time) * (time - 2) - 1));

            case EaseType.CubicIn:
                return((time /= duration) * time * time);

            case EaseType.CubicOut:
                return((time = time / duration - 1) * time * time + 1);

            case EaseType.CubicInOut:
                if ((time /= duration * 0.5f) < 1)
                {
                    return(0.5f * time * time * time);
                }
                return(0.5f * ((time -= 2) * time * time + 2));

            case EaseType.QuartIn:
                return((time /= duration) * time * time * time);

            case EaseType.QuartOut:
                return(-((time = time / duration - 1) * time * time * time - 1));

            case EaseType.QuartInOut:
                if ((time /= duration * 0.5f) < 1)
                {
                    return(0.5f * time * time * time * time);
                }
                return(-0.5f * ((time -= 2) * time * time * time - 2));

            case EaseType.QuintIn:
                return((time /= duration) * time * time * time * time);

            case EaseType.QuintOut:
                return((time = time / duration - 1) * time * time * time * time + 1);

            case EaseType.QuintInOut:
                if ((time /= duration * 0.5f) < 1)
                {
                    return(0.5f * time * time * time * time * time);
                }
                return(0.5f * ((time -= 2) * time * time * time * time + 2));

            case EaseType.ExpoIn:
                return((time == 0) ? 0 : (float)Math.Pow(2, 10 * (time / duration - 1)));

            case EaseType.ExpoOut:
                if (time == duration)
                {
                    return(1);
                }
                return(-(float)Math.Pow(2, -10 * time / duration) + 1);

            case EaseType.ExpoInOut:
                if (time == 0)
                {
                    return(0);
                }
                if (time == duration)
                {
                    return(1);
                }
                if ((time /= duration * 0.5f) < 1)
                {
                    return(0.5f * (float)Math.Pow(2, 10 * (time - 1)));
                }
                return(0.5f * (-(float)Math.Pow(2, -10 * --time) + 2));

            case EaseType.CircIn:
                return(-((float)Math.Sqrt(1 - (time /= duration) * time) - 1));

            case EaseType.CircOut:
                return((float)Math.Sqrt(1 - (time = time / duration - 1) * time));

            case EaseType.CircInOut:
                if ((time /= duration * 0.5f) < 1)
                {
                    return(-0.5f * ((float)Math.Sqrt(1 - time * time) - 1));
                }
                return(0.5f * ((float)Math.Sqrt(1 - (time -= 2) * time) + 1));

            case EaseType.ElasticIn:
                float s0;
                if (time == 0)
                {
                    return(0);
                }
                if ((time /= duration) == 1)
                {
                    return(1);
                }
                if (period == 0)
                {
                    period = duration * 0.3f;
                }
                if (overshootOrAmplitude < 1)
                {
                    overshootOrAmplitude = 1;
                    s0 = period / 4;
                }
                else
                {
                    s0 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude);
                }
                return(-(overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s0) * _TwoPi / period)));

            case EaseType.ElasticOut:
                float s1;
                if (time == 0)
                {
                    return(0);
                }
                if ((time /= duration) == 1)
                {
                    return(1);
                }
                if (period == 0)
                {
                    period = duration * 0.3f;
                }
                if (overshootOrAmplitude < 1)
                {
                    overshootOrAmplitude = 1;
                    s1 = period / 4;
                }
                else
                {
                    s1 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude);
                }
                return(overshootOrAmplitude * (float)Math.Pow(2, -10 * time) * (float)Math.Sin((time * duration - s1) * _TwoPi / period) + 1);

            case EaseType.ElasticInOut:
                float s;
                if (time == 0)
                {
                    return(0);
                }
                if ((time /= duration * 0.5f) == 2)
                {
                    return(1);
                }
                if (period == 0)
                {
                    period = duration * (0.3f * 1.5f);
                }
                if (overshootOrAmplitude < 1)
                {
                    overshootOrAmplitude = 1;
                    s = period / 4;
                }
                else
                {
                    s = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude);
                }
                if (time < 1)
                {
                    return(-0.5f * (overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period)));
                }
                return(overshootOrAmplitude * (float)Math.Pow(2, -10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period) * 0.5f + 1);

            case EaseType.BackIn:
                return((time /= duration) * time * ((overshootOrAmplitude + 1) * time - overshootOrAmplitude));

            case EaseType.BackOut:
                return((time = time / duration - 1) * time * ((overshootOrAmplitude + 1) * time + overshootOrAmplitude) + 1);

            case EaseType.BackInOut:
                if ((time /= duration * 0.5f) < 1)
                {
                    return(0.5f * (time * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time - overshootOrAmplitude)));
                }
                return(0.5f * ((time -= 2) * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time + overshootOrAmplitude) + 2));

            case EaseType.BounceIn:
                return(Bounce.EaseIn(time, duration));

            case EaseType.BounceOut:
                return(Bounce.EaseOut(time, duration));

            case EaseType.BounceInOut:
                return(Bounce.EaseInOut(time, duration));

            default:
                return(-(time /= duration) * (time - 2));
            }
        }
Exemplo n.º 6
0
    /// <summary>
    /// Returns a value between 0 and 1 (inclusive) based on the elapsed time and ease selected
    /// </summary>
    public static float Evaluate(Ease easeType, EaseFunction customEase, float time, float duration, float overshootOrAmplitude, float period)
    {
        switch (easeType)
        {
        case Ease.Linear:
            return(time / duration);

        case Ease.InSine:
            return(-(float)Math.Cos(time / duration * _PiOver2) + 1);

        case Ease.OutSine:
            return((float)Math.Sin(time / duration * _PiOver2));

        case Ease.InOutSine:
            return(-0.5f * ((float)Math.Cos(Mathf.PI * time / duration) - 1));

        case Ease.InQuad:
            return((time /= duration) * time);

        case Ease.OutQuad:
            return(-(time /= duration) * (time - 2));

        case Ease.InOutQuad:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time);
            }
            return(-0.5f * ((--time) * (time - 2) - 1));

        case Ease.InCubic:
            return((time /= duration) * time * time);

        case Ease.OutCubic:
            return((time = time / duration - 1) * time * time + 1);

        case Ease.InOutCubic:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time * time);
            }
            return(0.5f * ((time -= 2) * time * time + 2));

        case Ease.InQuart:
            return((time /= duration) * time * time * time);

        case Ease.OutQuart:
            return(-((time = time / duration - 1) * time * time * time - 1));

        case Ease.InOutQuart:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time * time * time);
            }
            return(-0.5f * ((time -= 2) * time * time * time - 2));

        case Ease.InQuint:
            return((time /= duration) * time * time * time * time);

        case Ease.OutQuint:
            return((time = time / duration - 1) * time * time * time * time + 1);

        case Ease.InOutQuint:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time * time * time * time);
            }
            return(0.5f * ((time -= 2) * time * time * time * time + 2));

        case Ease.InExpo:
            return((time == 0) ? 0 : (float)Math.Pow(2, 10 * (time / duration - 1)));

        case Ease.OutExpo:
            if (time == duration)
            {
                return(1);
            }
            return(-(float)Math.Pow(2, -10 * time / duration) + 1);

        case Ease.InOutExpo:
            if (time == 0)
            {
                return(0);
            }
            if (time == duration)
            {
                return(1);
            }
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * (float)Math.Pow(2, 10 * (time - 1)));
            }
            return(0.5f * (-(float)Math.Pow(2, -10 * --time) + 2));

        case Ease.InCirc:
            return(-((float)Math.Sqrt(1 - (time /= duration) * time) - 1));

        case Ease.OutCirc:
            return((float)Math.Sqrt(1 - (time = time / duration - 1) * time));

        case Ease.InOutCirc:
            if ((time /= duration * 0.5f) < 1)
            {
                return(-0.5f * ((float)Math.Sqrt(1 - time * time) - 1));
            }
            return(0.5f * ((float)Math.Sqrt(1 - (time -= 2) * time) + 1));

        case Ease.InElastic:
            float s0;
            if (time == 0)
            {
                return(0);
            }
            if ((time /= duration) == 1)
            {
                return(1);
            }
            if (period == 0)
            {
                period = duration * 0.3f;
            }
            if (overshootOrAmplitude < 1)
            {
                overshootOrAmplitude = 1;
                s0 = period / 4;
            }
            else
            {
                s0 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude);
            }
            return(-(overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s0) * _TwoPi / period)));

        case Ease.OutElastic:
            float s1;
            if (time == 0)
            {
                return(0);
            }
            if ((time /= duration) == 1)
            {
                return(1);
            }
            if (period == 0)
            {
                period = duration * 0.3f;
            }
            if (overshootOrAmplitude < 1)
            {
                overshootOrAmplitude = 1;
                s1 = period / 4;
            }
            else
            {
                s1 = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude);
            }
            return(overshootOrAmplitude * (float)Math.Pow(2, -10 * time) * (float)Math.Sin((time * duration - s1) * _TwoPi / period) + 1);

        case Ease.InOutElastic:
            float s;
            if (time == 0)
            {
                return(0);
            }
            if ((time /= duration * 0.5f) == 2)
            {
                return(1);
            }
            if (period == 0)
            {
                period = duration * (0.3f * 1.5f);
            }
            if (overshootOrAmplitude < 1)
            {
                overshootOrAmplitude = 1;
                s = period / 4;
            }
            else
            {
                s = period / _TwoPi * (float)Math.Asin(1 / overshootOrAmplitude);
            }
            if (time < 1)
            {
                return(-0.5f * (overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period)));
            }
            return(overshootOrAmplitude * (float)Math.Pow(2, -10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * _TwoPi / period) * 0.5f + 1);

        case Ease.InBack:
            return((time /= duration) * time * ((overshootOrAmplitude + 1) * time - overshootOrAmplitude));

        case Ease.OutBack:
            return((time = time / duration - 1) * time * ((overshootOrAmplitude + 1) * time + overshootOrAmplitude) + 1);

        case Ease.InOutBack:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * (time * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time - overshootOrAmplitude)));
            }
            return(0.5f * ((time -= 2) * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time + overshootOrAmplitude) + 2));

        case Ease.InBounce:
            return(Bounce.EaseIn(time, duration, overshootOrAmplitude, period));

        case Ease.OutBounce:
            return(Bounce.EaseOut(time, duration, overshootOrAmplitude, period));

        case Ease.InOutBounce:
            return(Bounce.EaseInOut(time, duration, overshootOrAmplitude, period));

        case Ease.INTERNAL_Custom:
            return(customEase(time, duration, overshootOrAmplitude, period));

        case Ease.INTERNAL_Zero:
            // 0 duration tween
            return(1);

        // Extra custom eases ////////////////////////////////////////////////////
        case Ease.Flash:
            return(Flash.Ease(time, duration, overshootOrAmplitude, period));

        case Ease.InFlash:
            return(Flash.EaseIn(time, duration, overshootOrAmplitude, period));

        case Ease.OutFlash:
            return(Flash.EaseOut(time, duration, overshootOrAmplitude, period));

        case Ease.InOutFlash:
            return(Flash.EaseInOut(time, duration, overshootOrAmplitude, period));

        // Default
        default:
            // OutQuad
            return(-(time /= duration) * (time - 2));
        }
    }
Exemplo n.º 7
0
        internal static float Ease(Type ease, float t, float duration)
        {
            switch (ease)
            {
            case Type.Linear:
                return(Linear.EaseNone(t, duration));

            case Type.BackIn:
                return(Back.EaseIn(t, duration));

            case Type.BackOut:
                return(Back.EaseOut(t, duration));

            case Type.BackInOut:
                return(Back.EaseInOut(t, duration));

            case Type.BounceIn:
                return(Bounce.EaseIn(t, duration));

            case Type.BounceOut:
                return(Bounce.EaseOut(t, duration));

            case Type.BounceInOut:
                return(Bounce.EaseInOut(t, duration));

            case Type.CircIn:
                return(Circular.EaseIn(t, duration));

            case Type.CircOut:
                return(Circular.EaseOut(t, duration));

            case Type.CircInOut:
                return(Circular.EaseInOut(t, duration));

            case Type.CubicIn:
                return(Cubic.EaseIn(t, duration));

            case Type.CubicOut:
                return(Cubic.EaseOut(t, duration));

            case Type.CubicInOut:
                return(Cubic.EaseInOut(t, duration));

            case Type.ElasticIn:
                return(Elastic.EaseIn(t, duration));

            case Type.ElasticOut:
                return(Elastic.EaseOut(t, duration));

            case Type.ElasticInOut:
                return(Elastic.EaseInOut(t, duration));

            case Type.Punch:
                return(Elastic.Punch(t, duration));

            case Type.ExpoIn:
                return(Exponential.EaseIn(t, duration));

            case Type.ExpoOut:
                return(Exponential.EaseOut(t, duration));

            case Type.ExpoInOut:
                return(Exponential.EaseInOut(t, duration));

            case Type.QuadIn:
                return(Quadratic.EaseIn(t, duration));

            case Type.QuadOut:
                return(Quadratic.EaseOut(t, duration));

            case Type.QuadInOut:
                return(Quadratic.EaseInOut(t, duration));

            case Type.QuartIn:
                return(Quartic.EaseIn(t, duration));

            case Type.QuartOut:
                return(Quartic.EaseOut(t, duration));

            case Type.QuartInOut:
                return(Quartic.EaseInOut(t, duration));

            case Type.QuintIn:
                return(Quintic.EaseIn(t, duration));

            case Type.QuintOut:
                return(Quintic.EaseOut(t, duration));

            case Type.QuintInOut:
                return(Quintic.EaseInOut(t, duration));

            case Type.SineIn:
                return(Sinusoidal.EaseIn(t, duration));

            case Type.SineOut:
                return(Sinusoidal.EaseOut(t, duration));

            case Type.SineInOut:
                return(Sinusoidal.EaseInOut(t, duration));

            default:
                return(Linear.EaseNone(t, duration));
            }
        }
Exemplo n.º 8
0
    public static float EaseConstant(Ease easeType, float time, float duration, float overshootOrAmplitude = 0, float period = 0)
    {
        switch (easeType)
        {
        case Ease.Linear:
            return(time / duration);

        case Ease.InSine:
            return(-(float)Math.Cos(time / duration * piOver2) + 1);

        case Ease.OutSine:
            return((float)Math.Sin(time / duration * piOver2));

        case Ease.InOutSine:
            return(-0.5f * ((float)Math.Cos(Mathf.PI * time / duration) - 1));

        case Ease.InQuad:
            return((time /= duration) * time);

        case Ease.OutQuad:
            return(-(time /= duration) * (time - 2));

        case Ease.InOutQuad:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time);
            }
            return(-0.5f * ((--time) * (time - 2) - 1));

        case Ease.InCubic:
            return((time /= duration) * time * time);

        case Ease.OutCubic:
            return((time = time / duration - 1) * time * time + 1);

        case Ease.InOutCubic:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time * time);
            }
            return(0.5f * ((time -= 2) * time * time + 2));

        case Ease.InQuart:
            return((time /= duration) * time * time * time);

        case Ease.OutQuart:
            return(-((time = time / duration - 1) * time * time * time - 1));

        case Ease.InOutQuart:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time * time * time);
            }
            return(-0.5f * ((time -= 2) * time * time * time - 2));

        case Ease.InQuint:
            return((time /= duration) * time * time * time * time);

        case Ease.OutQuint:
            return((time = time / duration - 1) * time * time * time * time + 1);

        case Ease.InOutQuint:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * time * time * time * time * time);
            }
            return(0.5f * ((time -= 2) * time * time * time * time + 2));

        case Ease.InExpo:
            return((time == 0) ? 0 : (float)Math.Pow(2, 10 * (time / duration - 1)));

        case Ease.OutExpo:
            if (time == duration)
            {
                return(1);
            }
            return(-(float)Math.Pow(2, -10 * time / duration) + 1);

        case Ease.InOutExpo:
            if (time == 0)
            {
                return(0);
            }
            if (time == duration)
            {
                return(1);
            }
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * (float)Math.Pow(2, 10 * (time - 1)));
            }
            return(0.5f * (-(float)Math.Pow(2, -10 * --time) + 2));

        case Ease.InCirc:
            return(-((float)Math.Sqrt(1 - (time /= duration) * time) - 1));

        case Ease.OutCirc:
            return((float)Math.Sqrt(1 - (time = time / duration - 1) * time));

        case Ease.InOutCirc:
            if ((time /= duration * 0.5f) < 1)
            {
                return(-0.5f * ((float)Math.Sqrt(1 - time * time) - 1));
            }
            return(0.5f * ((float)Math.Sqrt(1 - (time -= 2) * time) + 1));

        case Ease.InElastic:
            float s0;
            if (time == 0)
            {
                return(0);
            }
            if ((time /= duration) == 1)
            {
                return(1);
            }
            if (period == 0)
            {
                period = duration * 0.3f;
            }
            if (overshootOrAmplitude < 1)
            {
                overshootOrAmplitude = 1;
                s0 = period / 4;
            }
            else
            {
                s0 = period / twoPi * (float)Math.Asin(1 / overshootOrAmplitude);
            }
            return(-(overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s0) * twoPi / period)));

        case Ease.OutElastic:
            float s1;
            if (time == 0)
            {
                return(0);
            }
            if ((time /= duration) == 1)
            {
                return(1);
            }
            if (period == 0)
            {
                period = duration * 0.3f;
            }
            if (overshootOrAmplitude < 1)
            {
                overshootOrAmplitude = 1;
                s1 = period / 4;
            }
            else
            {
                s1 = period / twoPi * (float)Math.Asin(1 / overshootOrAmplitude);
            }
            return(overshootOrAmplitude * (float)Math.Pow(2, -10 * time) * (float)Math.Sin((time * duration - s1) * twoPi / period) + 1);

        case Ease.InOutElastic:
            float s;
            if (time == 0)
            {
                return(0);
            }
            if ((time /= duration * 0.5f) == 2)
            {
                return(1);
            }
            if (period == 0)
            {
                period = duration * (0.3f * 1.5f);
            }
            if (overshootOrAmplitude < 1)
            {
                overshootOrAmplitude = 1;
                s = period / 4;
            }
            else
            {
                s = period / twoPi * (float)Math.Asin(1 / overshootOrAmplitude);
            }
            if (time < 1)
            {
                return(-0.5f * (overshootOrAmplitude * (float)Math.Pow(2, 10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * twoPi / period)));
            }
            return(overshootOrAmplitude * (float)Math.Pow(2, -10 * (time -= 1)) * (float)Math.Sin((time * duration - s) * twoPi / period) * 0.5f + 1);

        case Ease.InBack:
            return((time /= duration) * time * ((overshootOrAmplitude + 1) * time - overshootOrAmplitude));

        case Ease.OutBack:
            return((time = time / duration - 1) * time * ((overshootOrAmplitude + 1) * time + overshootOrAmplitude) + 1);

        case Ease.InOutBack:
            if ((time /= duration * 0.5f) < 1)
            {
                return(0.5f * (time * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time - overshootOrAmplitude)));
            }
            return(0.5f * ((time -= 2) * time * (((overshootOrAmplitude *= (1.525f)) + 1) * time + overshootOrAmplitude) + 2));

        case Ease.InBounce:
            return(Bounce.EaseIn(time, duration, overshootOrAmplitude, period));

        case Ease.OutBounce:
            return(Bounce.EaseOut(time, duration, overshootOrAmplitude, period));

        case Ease.InOutBounce:
            return(Bounce.EaseInOut(time, duration, overshootOrAmplitude, period));

        default:
            // OutQuad
            return(-(time /= duration) * (time - 2));
        }
    }
Exemplo n.º 9
0
 public override double Ease(double t, double b, double c, double d)
 {
     return(Bounce.EaseIn(t, b, c, d));
 }