Example #1
0
    public static float Ease(double linearStep, float acceleration, EEasingType type)
    {
        float easedStep = acceleration > 0 ? EaseIn(linearStep, type) :
                          acceleration < 0 ? EaseOut(linearStep, type) :
                          (float)linearStep;

        return(MathHelper.Lerp(linearStep, easedStep, Math.Abs(acceleration)));
    }
Example #2
0
            private static void OnEasingFunctionChanged(BindableObject bindable, EEasingType oldvalue, EEasingType newvalue)
            {
                var obj = bindable as BaseAnimationBehavior;

                if (obj == null)
                {
                    return;
                }

                obj.EasingType = newvalue;
            }
Example #3
0
    public static float EaseOut(double linearStep, EEasingType type)
    {
        switch (type)
        {
        case EEasingType.Step: return(linearStep < 0.5 ? 0 : 1);

        case EEasingType.Linear: return((float)linearStep);

        case EEasingType.Sine: return(Sine.EaseOut(linearStep));

        case EEasingType.Quadratic: return(Power.EaseOut(linearStep, 2));

        case EEasingType.Cubic: return(Power.EaseOut(linearStep, 3));

        case EEasingType.Quartic: return(Power.EaseOut(linearStep, 4));

        case EEasingType.Quintic: return(Power.EaseOut(linearStep, 5));
        }
        throw new NotImplementedException();
    }
Example #4
0
            protected static Easing ToEasing(EEasingType easingType)
            {
                switch (easingType)
                {
                case EEasingType.BounceIn:
                    return(Easing.BounceIn);

                case EEasingType.BounceOut:
                    return(Easing.BounceOut);

                case EEasingType.CubicIn:
                    return(Easing.CubicIn);

                case EEasingType.CubicInOut:
                    return(Easing.CubicInOut);

                case EEasingType.CubicOut:
                    return(Easing.CubicOut);

                case EEasingType.Linear:
                    return(Easing.Linear);

                case EEasingType.SinIn:
                    return(Easing.SinIn);

                case EEasingType.SinInOut:
                    return(Easing.SinInOut);

                case EEasingType.SinOut:
                    return(Easing.SinOut);

                case EEasingType.SpringIn:
                    return(Easing.SpringIn);

                case EEasingType.SpringOut:
                    return(Easing.SpringOut);

                default:
                    return(Easing.Linear);
                }
            }
Example #5
0
 public static float EaseInOut(double linearStep, EEasingType easeInType, EEasingType easeOutType)
 {
     return(linearStep < 0.5 ? EaseInOut(linearStep, easeInType) : EaseInOut(linearStep, easeOutType));
 }
Example #6
0
 public static float Calculate(EEasingMethod type, EEasingType method, float t)
 {
     return(Methods[(int)type * METHOD_COUNT + (int)method](t));
 }
Example #7
0
 public static EasingDelegate Get(EEasingMethod type, EEasingType method)
 {
     return(Methods[(int)type * METHOD_COUNT + (int)method]);
 }
Example #8
0
 public EasingFunc(float duration, EEasingMethod method = EEasingMethod.Sine, EEasingType type = EEasingType.In)
 {
     m_Method = EasingHelper.Get(method, type);
     Duration = duration;
 }