Ejemplo n.º 1
0
        public virtual IInterpolable CreateInterpolator()
        {
            this.isDirty = false;

            switch (this.algorithm)
            {
            case AlgorithmType.Linear:
                return(Linear.Instance);

            case AlgorithmType.Acceleration:
                return(new Acceleration(this.floatValues[0]));

            case AlgorithmType.Bezier3:
                return(new Bezier3(this.floatValues[0]));

            case AlgorithmType.Bezier4:
                return(new Bezier4(this.floatValues[0], this.floatValues[1]));

            case AlgorithmType.Spline:
                return(new Spline(Interpolator.ToSplintPoint(this.floatValues)));

            case AlgorithmType.Ease:
                return(new Ease((Ease.Equations) this.intValue));

            case AlgorithmType.Constant:
                return(Constant.Instance);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public virtual bool UpdateInterpolator(IInterpolable internalInterpolator)
        {
            this.isDirty = false;

            switch (this.algorithm)
            {
            case AlgorithmType.Linear:
            case AlgorithmType.Constant:
                return(true);

            case AlgorithmType.Acceleration:
            {
                var inst = (Acceleration)internalInterpolator;
                inst.Factor = this.floatValues[0];
                return(true);
            }

            case AlgorithmType.Bezier3:
            {
                var inst = (Bezier3)internalInterpolator;
                inst.P1 = this.floatValues[0];
                return(true);
            }

            case AlgorithmType.Bezier4:
            {
                var inst = (Bezier4)internalInterpolator;
                inst.P1 = this.floatValues[0];
                inst.P2 = this.floatValues[1];
                return(true);
            }

            case AlgorithmType.Spline:
            {
                var inst = (Spline)internalInterpolator;
                inst.Update(Interpolator.ToSplintPoint(this.floatValues));
                return(true);
            }

            case AlgorithmType.Ease:
            {
                var inst = (Ease)internalInterpolator;
                inst.Equation = (Ease.Equations) this.IntValue;
                return(true);
            }
            }

            return(false);
        }