示例#1
0
    /// <summary>
    /// Calculate a Ease InOut from a pourcent
    /// </summary>
    /// <param name="linearStep">Pourcent on the ease</param>
    /// <param name="type">Easing Type</param>
    public static float EaseInOut(float linearStep, EasingType type)
    {
        switch (type)
        {
        case EasingType.Step:
            return(Mathf.Round(linearStep));

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

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

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

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

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

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

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

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

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

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

        case EasingType.Circ:
            return(Circ.EaseInOut(linearStep));
        }
    }
示例#2
0
    public static float EaseInOut(float linearStep, EaseType type)
    {
        switch (type)
        {
        case EaseType.None:
            return(1);

        case EaseType.Linear:
            return(linearStep);

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

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

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

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

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

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

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

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

        case EaseType.Elastic:
            return(Elastic.EaseInOut(linearStep));
        }
        Debug.LogError("Um.");
        return(0);
    }
示例#3
0
文件: Easing.cs 项目: Slaktus/Tetra
        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));
            }
        }
示例#4
0
 public override double Ease(double t, double b, double c, double d)
 {
     return(Elastic.EaseInOut(t, b, c, d));
 }