public abstract object CalculateAnimatedValue(
     object startValue,
     object endValue,
     object currValue,
     object step,
     int currFrameNum,
     int totalFrameNum,
     EasingCalculator calc);
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            SizeF sizeF = (SizeF)startValue;

            return((object)new SizeF(calc.CalculateCurrentValue(sizeF.Width, ((SizeF)endValue).Width, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(sizeF.Height, ((SizeF)endValue).Height, currFrameNum, totalFrameNum)));
        }
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            Font font = (Font)currValue;
            FontAnimationStep fontAnimationStep = (FontAnimationStep)step;

            return((object)new Font(font.FontFamily, font.Size + fontAnimationStep.SizeStep));
        }
Esempio n. 4
0
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            PointF pointF1 = (PointF)step;
            PointF pointF2 = (PointF)currValue;

            return((object)new PointF(pointF2.X + pointF1.X, pointF2.Y + pointF1.Y));
        }
 public override object CalculateAnimatedValue(
     object startValue,
     object endValue,
     object currValue,
     object step,
     int currFrameNum,
     int totalFrameNum,
     EasingCalculator calc)
 {
     if (endValue == null)
     {
         return(currValue);
     }
     return(endValue);
 }
        private object GetEndValue(RadObject element)
        {
            if (this.endValue != null)
            {
                return(this.endValue);
            }
            AnimationValueCalculator calculator = AnimationValueCalculatorFactory.GetCalculator(this.Property.PropertyType);
            EasingCalculator         calc       = (EasingCalculator) new StandardEasingCalculator(RadEasingType.InQuad);
            object currValue = this.StartValue;

            for (int currFrameNum = 1; currFrameNum <= this.NumFrames; ++currFrameNum)
            {
                currValue = calculator.CalculateAnimatedValue(this.StartValue, this.EndValue, currValue, this.step, currFrameNum, this.NumFrames, calc);
            }
            return(currValue);
        }
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            if (endValue == null)
            {
                return((object)(float)((double)(float)currValue + (double)(float)step));
            }
            float initialValue = (float)startValue;
            float endValue1    = (float)endValue;

            return((object)calc.CalculateCurrentValue(initialValue, endValue1, currFrameNum, totalFrameNum));
        }
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            Size size1 = (Size)step;
            Size size2 = (Size)currValue;

            if (currFrameNum == totalFrameNum)
            {
                return(endValue);
            }
            return((object)new Size(size2.Width + size1.Width, size2.Height + size1.Height));
        }
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            if (endValue == null)
            {
                Padding padding1 = (Padding)step;
                Padding padding2 = (Padding)currValue;
                return((object)new Padding(padding2.Left + padding1.Left, padding2.Top + padding1.Top, padding2.Right + padding1.Right, padding2.Bottom + padding1.Bottom));
            }
            Padding padding3 = (Padding)startValue;
            Padding padding4 = (Padding)endValue;

            return((object)new Padding(calc.CalculateCurrentValue(padding3.Left, padding4.Left, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(padding3.Top, padding4.Top, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(padding3.Right, padding4.Right, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(padding3.Bottom, padding4.Bottom, currFrameNum, totalFrameNum)));
        }
Esempio n. 10
0
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            Color color1 = (Color)currValue;
            ColorAnimationStep colorAnimationStep = (ColorAnimationStep)step;

            if (endValue == null)
            {
                return((object)Color.FromArgb(Math.Max(0, Math.Min((int)byte.MaxValue, (int)color1.A + colorAnimationStep.A)), Math.Max(0, Math.Min((int)byte.MaxValue, (int)color1.R + colorAnimationStep.R)), Math.Max(0, Math.Min((int)byte.MaxValue, (int)color1.G + colorAnimationStep.G)), Math.Max(0, Math.Min((int)byte.MaxValue, (int)color1.B + colorAnimationStep.B))));
            }
            Color color2 = (Color)startValue;
            Color color3 = (Color)endValue;

            return((object)Color.FromArgb(Math.Max(0, Math.Min((int)byte.MaxValue, calc.CalculateCurrentValue((int)color2.A, (int)color3.A, currFrameNum, totalFrameNum))), Math.Max(0, Math.Min((int)byte.MaxValue, calc.CalculateCurrentValue((int)color2.R, (int)color3.R, currFrameNum, totalFrameNum))), Math.Max(0, Math.Min((int)byte.MaxValue, calc.CalculateCurrentValue((int)color2.G, (int)color3.G, currFrameNum, totalFrameNum))), Math.Max(0, Math.Min((int)byte.MaxValue, calc.CalculateCurrentValue((int)color2.B, (int)color3.B, currFrameNum, totalFrameNum)))));
        }
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            if (endValue == null)
            {
                Padding rect     = (Padding)step;
                Padding currRect = (Padding)currValue;

                return(new Padding(
                           currRect.Left + rect.Left,
                           currRect.Top + rect.Top,
                           currRect.Right + rect.Right,
                           currRect.Bottom + rect.Bottom));
            }

            Padding startPadding = (Padding)startValue;
            Padding endPadding   = (Padding)endValue;

            Padding res = new Padding(
                calc.CalculateCurrentValue(startPadding.Left, endPadding.Left, currFrameNum, totalFrameNum),
                calc.CalculateCurrentValue(startPadding.Top, endPadding.Top, currFrameNum, totalFrameNum),
                calc.CalculateCurrentValue(startPadding.Right, endPadding.Right, currFrameNum, totalFrameNum),
                calc.CalculateCurrentValue(startPadding.Bottom, endPadding.Bottom, currFrameNum, totalFrameNum)
                );

            return(res);
        }
Esempio n. 12
0
        public override object CalculateAnimatedValue(
            object startValue,
            object endValue,
            object currValue,
            object step,
            int currFrameNum,
            int totalFrameNum,
            EasingCalculator calc)
        {
            Rectangle rectangle1 = Rectangle.Empty;

            if (currValue != null)
            {
                rectangle1 = (Rectangle)currValue;
            }
            if (endValue != null)
            {
                int initialValue1 = rectangle1.Left;
                int initialValue2 = rectangle1.Top;
                int width         = rectangle1.Width;
                int height        = rectangle1.Height;
                if ((object)startValue.GetType() == (object)typeof(Rectangle))
                {
                    Rectangle rectangle2 = (Rectangle)startValue;
                    initialValue1 = rectangle2.Left;
                    initialValue2 = rectangle2.Top;
                    width         = rectangle2.Width;
                    height        = rectangle2.Height;
                }
                else if ((object)startValue.GetType() == (object)typeof(Point))
                {
                    Point point = (Point)startValue;
                    initialValue1 = point.X;
                    initialValue2 = point.Y;
                }
                else
                {
                    startValue.GetType();
                    Type type = typeof(Size);
                }
                int endValue1 = initialValue1;
                int endValue2 = initialValue2;
                int endValue3 = width;
                int endValue4 = height;
                if ((object)endValue.GetType() == (object)typeof(Rectangle))
                {
                    Rectangle rectangle2 = (Rectangle)endValue;
                    endValue1 = rectangle2.Left;
                    endValue2 = rectangle2.Top;
                    endValue3 = rectangle2.Width;
                    endValue4 = rectangle2.Height;
                }
                else if ((object)endValue.GetType() == (object)typeof(Point))
                {
                    Point point = (Point)endValue;
                    endValue1 = point.X;
                    endValue2 = point.Y;
                }
                else if ((object)endValue.GetType() == (object)typeof(Size))
                {
                    Size size = (Size)endValue;
                    endValue3 = size.Width;
                    endValue4 = size.Height;
                }
                return((object)new Rectangle(calc.CalculateCurrentValue(initialValue1, endValue1, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(initialValue2, endValue2, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(width, endValue3, currFrameNum, totalFrameNum), calc.CalculateCurrentValue(height, endValue4, currFrameNum, totalFrameNum)));
            }
            if (step == null)
            {
                return(currValue);
            }
            if ((object)step.GetType() == (object)typeof(Rectangle))
            {
                Rectangle rectangle2 = (Rectangle)step;
                return((object)new Rectangle(rectangle1.X + rectangle2.X, rectangle1.Y + rectangle2.Y, rectangle1.Width + rectangle2.Width, rectangle1.Height + rectangle2.Height));
            }
            if ((object)step.GetType() == (object)typeof(Point))
            {
                Point point = (Point)step;
                return((object)new Rectangle(rectangle1.X + point.X, rectangle1.Y + point.Y, rectangle1.Width, rectangle1.Height));
            }
            if ((object)step.GetType() != (object)typeof(Size))
            {
                return(currValue);
            }
            Size size1 = (Size)step;

            return((object)new Rectangle(rectangle1.X, rectangle1.Y, rectangle1.Width + size1.Width, rectangle1.Height + size1.Height));
        }
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            SizeF size = (SizeF)startValue;

            float resWidth  = calc.CalculateCurrentValue(size.Width, ((SizeF)endValue).Width, currFrameNum, totalFrameNum);
            float resHeight = calc.CalculateCurrentValue(size.Height, ((SizeF)endValue).Height, currFrameNum, totalFrameNum);

            return(new SizeF(
                       resWidth,
                       resHeight));
        }
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            PointF size     = (PointF)step;
            PointF currSize = (PointF)currValue;

            return(new PointF(
                       currSize.X + size.X,
                       currSize.Y + size.Y));
        }
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            Size size     = (Size)step;
            Size currSize = (Size)currValue;

            return(new Size(
                       currSize.Width + size.Width,
                       currSize.Height + size.Height));
        }
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            Rectangle currRect = Rectangle.Empty;

            if (currValue != null)
            {
                currRect = (Rectangle)currValue;
            }
            if (endValue != null)
            {
                int startLeft   = currRect.Left;
                int startTop    = currRect.Top;
                int startWidth  = currRect.Width;
                int startHeight = currRect.Height;
                int endLeft;
                int endTop;
                int endWidth;
                int endHeight;

                if (startValue.GetType() == typeof(Rectangle))
                {
                    Rectangle startRectangle = (Rectangle)startValue;
                    startLeft   = startRectangle.Left;
                    startTop    = startRectangle.Top;
                    startWidth  = startRectangle.Width;
                    startHeight = startRectangle.Height;
                }
                else if (startValue.GetType() == typeof(Point))
                {
                    Point startPoint = (Point)startValue;
                    startLeft = startPoint.X;
                    startTop  = startPoint.Y;
                }
                else if (startValue.GetType() == typeof(Size))
                {
                }

                endLeft   = startLeft;
                endTop    = startTop;
                endWidth  = startWidth;
                endHeight = startHeight;

                if (endValue.GetType() == typeof(Rectangle))
                {
                    Rectangle endRectangle = (Rectangle)endValue;
                    endLeft   = endRectangle.Left;
                    endTop    = endRectangle.Top;
                    endWidth  = endRectangle.Width;
                    endHeight = endRectangle.Height;
                }
                else if (endValue.GetType() == typeof(Point))
                {
                    Point endPoint = (Point)endValue;
                    endLeft = endPoint.X;
                    endTop  = endPoint.Y;
                }
                else if (endValue.GetType() == typeof(Size))
                {
                    Size endSize = (Size)endValue;
                    endWidth  = endSize.Width;
                    endHeight = endSize.Height;
                }

                int newLeft, newTop, newWidth, newHeight;

                newLeft   = calc.CalculateCurrentValue(startLeft, endLeft, currFrameNum, totalFrameNum);
                newTop    = calc.CalculateCurrentValue(startTop, endTop, currFrameNum, totalFrameNum);
                newWidth  = calc.CalculateCurrentValue(startWidth, endWidth, currFrameNum, totalFrameNum);
                newHeight = calc.CalculateCurrentValue(startHeight, endHeight, currFrameNum, totalFrameNum);

                return(new Rectangle(newLeft, newTop, newWidth, newHeight));
            }

            if (step == null)
            {
                return(currValue);
            }

            if (step.GetType() == typeof(Rectangle))
            {
                Rectangle rect = (Rectangle)step;

                return(new Rectangle(
                           currRect.X + rect.X,
                           currRect.Y + rect.Y,
                           currRect.Width + rect.Width,
                           currRect.Height + rect.Height));
            }
            else if (step.GetType() == typeof(Point))
            {
                Point pt = (Point)step;

                return(new Rectangle(
                           currRect.X + pt.X,
                           currRect.Y + pt.Y,
                           currRect.Width,
                           currRect.Height));
            }
            else if (step.GetType() == typeof(Size))
            {
                Size size = (Size)step;

                return(new Rectangle(
                           currRect.X,
                           currRect.Y,
                           currRect.Width + size.Width,
                           currRect.Height + size.Height));
            }

            return(currValue);
        }
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            Color currColor = (Color)currValue;
            ColorAnimationStep colorStep = (ColorAnimationStep)step;

            int newA;
            int newR;
            int newG;
            int newB;

            if (endValue == null)
            {
                newA = Math.Max(0, Math.Min(255, currColor.A + colorStep.A));
                newR = Math.Max(0, Math.Min(255, currColor.R + colorStep.R));
                newG = Math.Max(0, Math.Min(255, currColor.G + colorStep.G));
                newB = Math.Max(0, Math.Min(255, currColor.B + colorStep.B));

                return(Color.FromArgb(newA, newR, newG, newB));
            }

            Color startColor = (Color)startValue;
            Color endColor   = (Color)endValue;

            newA = Math.Max(0, Math.Min(255, calc.CalculateCurrentValue(startColor.A, endColor.A, currFrameNum, totalFrameNum)));
            newR = Math.Max(0, Math.Min(255, calc.CalculateCurrentValue(startColor.R, endColor.R, currFrameNum, totalFrameNum)));
            newG = Math.Max(0, Math.Min(255, calc.CalculateCurrentValue(startColor.G, endColor.G, currFrameNum, totalFrameNum)));
            newB = Math.Max(0, Math.Min(255, calc.CalculateCurrentValue(startColor.B, endColor.B, currFrameNum, totalFrameNum)));

            return(Color.FromArgb(newA, newR, newG, newB));
        }
Esempio n. 18
0
        public override object CalculateAnimatedValue(object startValue, object endValue, object currValue, object step, int currFrameNum, int totalFrameNum, EasingCalculator calc)
        {
            if (endValue == null)
            {
                return((int)currValue + (int)step);
            }

            int startDouble = (int)startValue;
            int endDouble   = (int)endValue;

            return(calc.CalculateCurrentValue(startDouble, endDouble, currFrameNum, totalFrameNum));
        }