Ejemplo n.º 1
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            EasingFunctionBase easingFunctionBase = null;

            switch (EasingType)
            {
            case EasingType.Sine:
                easingFunctionBase = new SineEase();
                break;

            case EasingType.Cubic:
                easingFunctionBase = new CubicEase();
                break;

            case EasingType.Quint:
                easingFunctionBase = new QuinticEase();
                break;

            case EasingType.Circ:
                easingFunctionBase = new CircleEase();
                break;

            case EasingType.Quad:
                easingFunctionBase = new QuadraticEase();
                break;

            case EasingType.Quart:
                easingFunctionBase = new QuarticEase();
                break;

            case EasingType.Elastic:
                easingFunctionBase = new ElasticEase
                {
                    Springiness  = Param1.GetValueOrDefault(3.0),
                    Oscillations = Param2.GetValueOrDefault(3)
                };
                break;

            case EasingType.Expo:
                easingFunctionBase = new ExponentialEase
                {
                    Exponent = Param1.GetValueOrDefault(2.0)
                };
                break;

            case EasingType.Back:
                easingFunctionBase = new BackEase
                {
                    Amplitude = Param1.GetValueOrDefault(1.0)
                };
                break;

            case EasingType.Bounce:
                easingFunctionBase = new BounceEase
                {
                    Bounciness = Param1.GetValueOrDefault(2.0),
                    Bounces    = Param2.GetValueOrDefault(3)
                };
                break;
            }
            if (easingFunctionBase != null)
            {
                easingFunctionBase.EasingMode = EasingMode;
            }
            return(easingFunctionBase);
        }