Beispiel #1
0
        public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount)
        {
            if (!(otherAnim is AnimationFilledGradientRectangle))
            {
                throw new FormatException("Cannot blend with another type");
            }

            amount = GetTransitionValue(amount);

            RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount),
                                                (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount),
                                                (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount),
                                                (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount)
                                                );

            float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount);

            return(new AnimationFilledGradientRectangle(newrect, _gradientBrush.BlendEffectBrush((otherAnim as AnimationFilledGradientRectangle)._gradientBrush, amount)).SetAngle(newAngle));
        }