Esempio n. 1
0
    public static Sinusoidal compose(Sinusoidal first, Sinusoidal second)
    {
        List <SineWave> together = new List <SineWave> ();

        together.AddRange(first.getElements());
        together.AddRange(second.getElements());
        return(new SineWaveComposition(together));
    }
        public static float CalculateLerpValueClamp01(float lerpValue, Type easingType, bool isZeroToOne)
        {
            switch (easingType)
            {
            case Type.Linear:
                lerpValue = Linear.InOut(lerpValue);
                break;

            case Type.Quadratic:
                lerpValue = Quadratic.InOut(lerpValue);
                break;

            case Type.Cubic:
                lerpValue = Cubic.InOut(lerpValue);
                break;

            case Type.Quartic:
                lerpValue = Quartic.InOut(lerpValue);
                break;

            case Type.Quintic:
                lerpValue = Quintic.InOut(lerpValue);
                break;

            case Type.Sinusoidal:
                lerpValue = Sinusoidal.InOut(lerpValue);
                break;

            case Type.Exponential:
                lerpValue = Exponential.InOut(lerpValue);
                break;

            case Type.Circular:
                lerpValue = Circular.InOut(lerpValue);
                break;

            case Type.Elastic:
                lerpValue = Elastic.InOut(lerpValue);
                break;

            case Type.Back:
                lerpValue = Back.InOut(lerpValue);
                break;

            case Type.Bounce:
                lerpValue = Bounce.InOut(lerpValue);
                break;

            default:
                return(-1f);
            }

            lerpValue = ClampMinMax(0f, 1f, lerpValue);

            return(lerpValue);
        }
Esempio n. 3
0
 public static float easeInOut(float t)
 {
     if (t <= 0.5f)
     {
         return(Sinusoidal.easeIn(t * 2) / 2);
     }
     else
     {
         return((Sinusoidal.easeOut((t - 0.5f) * 2.0f) / 2) + 0.5f);
     }
 }
Esempio n. 4
0
 public static IFasor CrearFasor(Sinusoidal sinusoide, double amplitud, double periodo, double angulo)
 {
     if (sinusoide == Sinusoidal.COSENO)
     {
         return(new FasorCoseno(amplitud, periodo, angulo));
     }
     if (sinusoide == Sinusoidal.SENO)
     {
         return(new FasorSeno(amplitud, periodo, angulo));
     }
     throw new InvalidOperationException("poner seno o coseno porfavor");
 }
Esempio n. 5
0
    //------------------------------------------------------------------------------------------------------------

    public static float GetEasingFunction(Type easingFunction, float t)
    {
        // Quad
        if (easingFunction == Type.EaseInQuad)
        {
            return(Quadratic.In(t));
        }

        if (easingFunction == Type.EaseOutQuad)
        {
            return(Quadratic.Out(t));
        }

        if (easingFunction == Type.EaseInOutQuad)
        {
            return(Quadratic.InOut(t));
        }

        // Cubic
        if (easingFunction == Type.EaseInCubic)
        {
            return(Cubic.In(t));
        }

        if (easingFunction == Type.EaseOutCubic)
        {
            return(Cubic.Out(t));
        }

        if (easingFunction == Type.EaseInOutCubic)
        {
            return(Cubic.InOut(t));
        }

        // Quart
        if (easingFunction == Type.EaseInQuart)
        {
            return(Quartic.In(t));
        }

        if (easingFunction == Type.EaseOutQuart)
        {
            return(Quartic.Out(t));;
        }

        if (easingFunction == Type.EaseInOutQuart)
        {
            return(Quartic.InOut(t));;
        }

        // Quint
        if (easingFunction == Type.EaseInQuint)
        {
            return(Quintic.In(t));
        }

        if (easingFunction == Type.EaseOutQuint)
        {
            return(Quintic.Out(t));
        }

        if (easingFunction == Type.EaseInOutQuint)
        {
            return(Quintic.InOut(t));
        }

        // Sine
        if (easingFunction == Type.EaseInSine)
        {
            return(Sinusoidal.In(t));
        }

        if (easingFunction == Type.EaseOutSine)
        {
            return(Sinusoidal.Out(t));
        }

        if (easingFunction == Type.EaseInOutSine)
        {
            return(Sinusoidal.InOut(t));
        }

        // Expo
        if (easingFunction == Type.EaseInExpo)
        {
            return(Exponential.In(t));
        }

        if (easingFunction == Type.EaseOutExpo)
        {
            return(Exponential.Out(t));
        }

        if (easingFunction == Type.EaseInOutExpo)
        {
            return(Exponential.InOut(t));
        }

        // CirC
        if (easingFunction == Type.EaseInCirc)
        {
            return(Circular.In(t));
        }

        if (easingFunction == Type.EaseOutCirc)
        {
            return(Circular.Out(t));
        }

        if (easingFunction == Type.EaseInOutCirc)
        {
            return(Circular.InOut(t));
        }

        // Linear
        if (easingFunction == Type.Linear)
        {
            return(Linear(t));
        }

        //  Bounce
        if (easingFunction == Type.EaseInBounce)
        {
            return(Bounce.In(t));
        }

        if (easingFunction == Type.EaseOutBounce)
        {
            return(Bounce.Out(t));
        }

        if (easingFunction == Type.EaseInOutBounce)
        {
            return(Bounce.InOut(t));
        }

        // Back
        if (easingFunction == Type.EaseInBack)
        {
            return(Back.In(t));
        }

        if (easingFunction == Type.EaseOutBack)
        {
            return(Back.Out(t));
        }

        if (easingFunction == Type.EaseInOutBack)
        {
            return(Back.InOut(t));
        }

        // Elastic
        if (easingFunction == Type.EaseInElastic)
        {
            return(Elastic.In(t));
        }

        if (easingFunction == Type.EaseOutElastic)
        {
            return(Elastic.Out(t));
        }

        if (easingFunction == Type.EaseInOutElastic)
        {
            return(Elastic.InOut(t));
        }

        return(0);
    }
Esempio n. 6
0
        public static float GetTerpedPosition(float time, float totalTime, Function function, Direction direction)
        {
            switch (function)
            {
            case Function.Quadratic:
                switch (direction)
                {
                case Direction.In:
                    return(Quadratic.In(time / totalTime));

                case Direction.Out:
                    return(Quadratic.Out(time / totalTime));

                default:
                    return(Quadratic.InOut(time / totalTime));
                }

            case Function.Cubic:
                switch (direction)
                {
                case Direction.In:
                    return(Cubic.In(time / totalTime));

                case Direction.Out:
                    return(Cubic.Out(time / totalTime));

                default:
                    return(Cubic.InOut(time / totalTime));
                }

            case Function.Quartic:
                switch (direction)
                {
                case Direction.In:
                    return(Quartic.In(time / totalTime));

                case Direction.Out:
                    return(Quartic.Out(time / totalTime));

                default:
                    return(Quartic.InOut(time / totalTime));
                }

            case Function.Quintic:
                switch (direction)
                {
                case Direction.In:
                    return(Quintic.In(time / totalTime));

                case Direction.Out:
                    return(Quintic.Out(time / totalTime));

                default:
                    return(Quintic.InOut(time / totalTime));
                }

            case Function.Sinusoidal:
                switch (direction)
                {
                case Direction.In:
                    return(Sinusoidal.In(time / totalTime));

                case Direction.Out:
                    return(Sinusoidal.Out(time / totalTime));

                default:
                    return(Sinusoidal.InOut(time / totalTime));
                }

            case Function.Exponential:
                switch (direction)
                {
                case Direction.In:
                    return(Exponential.In(time / totalTime));

                case Direction.Out:
                    return(Exponential.Out(time / totalTime));

                default:
                    return(Exponential.InOut(time / totalTime));
                }

            case Function.Circular:
                switch (direction)
                {
                case Direction.In:
                    return(Circular.In(time / totalTime));

                case Direction.Out:
                    return(Circular.Out(time / totalTime));

                default:
                    return(Circular.InOut(time / totalTime));
                }

            case Function.Elastic:
                switch (direction)
                {
                case Direction.In:
                    return(Elastic.In(time / totalTime));

                case Direction.Out:
                    return(Elastic.Out(time / totalTime));

                default:
                    return(Elastic.InOut(time / totalTime));
                }

            case Function.Back:
                switch (direction)
                {
                case Direction.In:
                    return(Back.In(time / totalTime));

                case Direction.Out:
                    return(Back.Out(time / totalTime));

                default:
                    return(Back.InOut(time / totalTime));
                }

            default:    //Function.Bounce:
                switch (direction)
                {
                case Direction.In:
                    return(Bounce.In(time / totalTime));

                case Direction.Out:
                    return(Bounce.Out(time / totalTime));

                default:
                    return(Bounce.InOut(time / totalTime));
                }
            }
        }
Esempio 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));
            }
        }
Esempio n. 8
0
        public static float Ease(EasingType easingFunction, float k)
        {
            switch (easingFunction)
            {
            case EasingType.Linear:
                return(Linear(k));

            case EasingType.QuadraticIn:
                return(Quadratic.In(k));

            case EasingType.QuadraticOut:
                return(Quadratic.Out(k));

            case EasingType.QuadraticInOut:
                return(Quadratic.InOut(k));

            case EasingType.CubicIn:
                return(Cubic.In(k));

            case EasingType.CubicOut:
                return(Cubic.Out(k));

            case EasingType.CubicInOut:
                return(Cubic.InOut(k));

            case EasingType.QuarticIn:
                return(Quartic.In(k));

            case EasingType.QuarticOut:
                return(Quartic.Out(k));

            case EasingType.QuarticInOut:
                return(Quartic.InOut(k));

            case EasingType.QuinticIn:
                return(Quintic.In(k));

            case EasingType.QuinticOut:
                return(Quintic.Out(k));

            case EasingType.QuinticInOut:
                return(Quintic.InOut(k));

            case EasingType.SinusoidalIn:
                return(Sinusoidal.In(k));

            case EasingType.SinusoidalOut:
                return(Sinusoidal.Out(k));

            case EasingType.SinusoidalInOut:
                return(Sinusoidal.InOut(k));

            case EasingType.ExponentialIn:
                return(Exponential.In(k));

            case EasingType.ExponentialOut:
                return(Exponential.Out(k));

            case EasingType.ExponentialInOut:
                return(Exponential.InOut(k));

            case EasingType.CircularIn:
                return(Circular.In(k));

            case EasingType.CircularOut:
                return(Circular.Out(k));

            case EasingType.CircularInOut:
                return(Circular.InOut(k));

            case EasingType.ElasticIn:
                return(Elastic.In(k));

            case EasingType.ElasticOut:
                return(Elastic.Out(k));

            case EasingType.ElasticInOut:
                return(Elastic.InOut(k));

            case EasingType.BackIn:
                return(Back.In(k));

            case EasingType.BackOut:
                return(Back.Out(k));

            case EasingType.BackInOut:
                return(Back.InOut(k));

            case EasingType.BounceIn:
                return(Bounce.In(k));

            case EasingType.BounceOut:
                return(Bounce.Out(k));

            case EasingType.BounceInOut:
                return(Bounce.InOut(k));

            default:
                return(Linear(k));
            }
        }
Esempio n. 9
0
        public static double Specify(EaseType easeType, EaseOption easeOption, double k)
        {
            switch (easeType)
            {
            case EaseType.Quadratic:
                switch (easeOption)
                {
                case EaseOption.In:
                    return(Quadratic.In(k));

                case EaseOption.Out:
                    return(Quadratic.Out(k));

                case EaseOption.InOut:
                    return(Quadratic.InOut(k));
                }

                break;

            case EaseType.Cubic:
                switch (easeOption)
                {
                case EaseOption.In:
                    return(Cubic.In(k));

                case EaseOption.Out:
                    return(Cubic.Out(k));

                case EaseOption.InOut:
                    return(Cubic.InOut(k));
                }

                break;

            case EaseType.Quartic:
                switch (easeOption)
                {
                case EaseOption.In:
                    return(Quartic.In(k));

                case EaseOption.Out:
                    return(Quartic.Out(k));

                case EaseOption.InOut:
                    return(Quartic.InOut(k));
                }

                break;

            case EaseType.Quintic:
                switch (easeOption)
                {
                case EaseOption.In:
                    return(Quintic.In(k));

                case EaseOption.Out:
                    return(Quintic.Out(k));

                case EaseOption.InOut:
                    return(Quintic.InOut(k));
                }

                break;

            case EaseType.Sinusoidal:
                switch (easeOption)
                {
                case EaseOption.In:
                    return(Sinusoidal.In(k));

                case EaseOption.Out:
                    return(Sinusoidal.Out(k));

                case EaseOption.InOut:
                    return(Sinusoidal.InOut(k));
                }

                break;
            }

            return(Linear(k));
        }