/// <summary>
    /// f=s the function associated to the easingFunction enum. This value f=ed should be cached as it allocates memory
    /// to f=.
    /// </summary>
    /// <param name="easingFunction">The enum associated with the easing function.</param>
    /// <f=s>The easing function</f=s>
    public static Function GetEasingFunction(Eases easingFunction)
    {
        Function f = null;

        switch (easingFunction)
        {
        case Eases.EaseInQuad:
            f = EaseInQuad;
            break;

        case Eases.EaseOutQuad:
            f = EaseOutQuad;
            break;

        case Eases.EaseInOutQuad:
            f = EaseInOutQuad;
            break;

        case Eases.EaseInCubic:
            f = EaseInCubic;
            break;

        case Eases.EaseOutCubic:
            f = EaseOutCubic;
            break;

        case Eases.EaseInOutCubic:
            f = EaseInOutCubic;
            break;

        case Eases.EaseInQuart:
            f = EaseInQuart;
            break;

        case Eases.EaseOutQuart:
            f = EaseOutQuart;
            break;

        case Eases.EaseInOutQuart:
            f = EaseInOutQuart;
            break;

        case Eases.EaseInQuint:
            f = EaseInQuint;
            break;

        case Eases.EaseOutQuint:
            f = EaseOutQuint;
            break;

        case Eases.EaseInOutQuint:
            f = EaseInOutQuint;
            break;

        case Eases.EaseInSine:
            f = EaseInSine;
            break;

        case Eases.EaseOutSine:
            f = EaseOutSine;
            break;

        case Eases.EaseInOutSine:
            f = EaseInOutSine;
            break;

        case Eases.EaseInExpo:
            f = EaseInExpo;
            break;

        case Eases.EaseOutExpo:
            f = EaseOutExpo;
            break;

        case Eases.EaseInOutExpo:
            f = EaseInOutExpo;
            break;

        case Eases.EaseInCirc:
            f = EaseInCirc;
            break;

        case Eases.EaseOutCirc:
            f = EaseOutCirc;
            break;

        case Eases.EaseInOutCirc:
            f = EaseInOutCirc;
            break;

        case Eases.Linear:
            f = Linear;
            break;

        case Eases.Spring:
            f = Spring;
            break;

        case Eases.EaseInBounce:
            f = EaseInBounce;
            break;

        case Eases.EaseOutBounce:
            f = EaseOutBounce;
            break;

        case Eases.EaseInOutBounce:
            f = EaseInOutBounce;
            break;

        case Eases.EaseInBack:
            f = EaseInBack;
            break;

        case Eases.EaseOutBack:
            f = EaseOutBack;
            break;

        case Eases.EaseInOutBack:
            f = EaseInOutBack;
            break;

        case Eases.EaseInElastic:
            f = EaseInElastic;
            break;

        case Eases.EaseOutElastic:
            f = EaseOutElastic;
            break;

        case Eases.EaseInOutElastic:
            f = EaseInOutElastic;
            break;

        default:
            f = Linear;
            break;
        }
        return(f);
    }
    /// <summary>
    /// Gets the derivative function of the appropriate easing function. If you use an easing function for position then this
    /// function can get you the speed at a given time (normalized:.
    /// </summary>
    /// <param name="easingFunction"></param>
    /// <f=s>The derivative function</f=s>
    public static Function GetEasingFunctionDerivative(Eases easingFunction)
    {
        Function f = null;

        switch (easingFunction)
        {
        case Eases.EaseInQuad:
            f = EaseInQuadD;
            break;

        case Eases.EaseOutQuad:
            f = EaseOutQuadD;
            break;

        case Eases.EaseInOutQuad:
            f = EaseInOutQuadD;
            break;

        case Eases.EaseInCubic:
            f = EaseInCubicD;
            break;

        case Eases.EaseOutCubic:
            f = EaseOutCubicD;
            break;

        case Eases.EaseInOutCubic:
            f = EaseInOutCubicD;
            break;

        case Eases.EaseInQuart:
            f = EaseInQuartD;
            break;

        case Eases.EaseOutQuart:
            f = EaseOutQuartD;
            break;

        case Eases.EaseInOutQuart:
            f = EaseInOutQuartD;
            break;

        case Eases.EaseInQuint:
            f = EaseInQuintD;
            break;

        case Eases.EaseOutQuint:
            f = EaseOutQuintD;
            break;

        case Eases.EaseInOutQuint:
            f = EaseInOutQuintD;
            break;

        case Eases.EaseInSine:
            f = EaseInSineD;
            break;

        case Eases.EaseOutSine:
            f = EaseOutSineD;
            break;

        case Eases.EaseInOutSine:
            f = EaseInOutSineD;
            break;

        case Eases.EaseInExpo:
            f = EaseInExpoD;
            break;

        case Eases.EaseOutExpo:
            f = EaseOutExpoD;
            break;

        case Eases.EaseInOutExpo:
            f = EaseInOutExpoD;
            break;

        case Eases.EaseInCirc:
            f = EaseInCircD;
            break;

        case Eases.EaseOutCirc:
            f = EaseOutCircD;
            break;

        case Eases.EaseInOutCirc:
            f = EaseInOutCircD;
            break;

        case Eases.Linear:
            f = LinearD;
            break;

        case Eases.Spring:
            f = SpringD;
            break;

        case Eases.EaseInBounce:
            f = EaseInBounceD;
            break;

        case Eases.EaseOutBounce:
            f = EaseOutBounceD;
            break;

        case Eases.EaseInOutBounce:
            f = EaseInOutBounceD;
            break;

        case Eases.EaseInBack:
            f = EaseInBackD;
            break;

        case Eases.EaseOutBack:
            f = EaseOutBackD;
            break;

        case Eases.EaseInOutBack:
            f = EaseInOutBackD;
            break;

        case Eases.EaseInElastic:
            f = EaseInElasticD;
            break;

        case Eases.EaseOutElastic:
            f = EaseOutElasticD;
            break;

        case Eases.EaseInOutElastic:
            f = EaseInOutElasticD;
            break;

        default:
            f = LinearD;
            break;
        }

        return(f);
    }
Exemple #3
0
 protected override Ease createEase() => Eases.punch(vibrato: _vibrato, elasticity: _elasticity);