Exemplo n.º 1
0
        protected override double GetCurrentValueCore(double defaultOriginValue, double defaultDestinationValue, AnimationClock animationClock)
        {
            double time     = animationClock.CurrentTime.HasValue ? animationClock.CurrentTime.Value.TotalMilliseconds : 0.0;
            double from     = this.From.HasValue ? this.From.Value : defaultOriginValue;
            double to       = this.To.HasValue ? this.To.Value : defaultDestinationValue;
            double delta    = to - from;
            double duration = this.Duration.TimeSpan.TotalMilliseconds;

            return(EasingUtilities.CalculateCurrentValue(time, from, delta, duration, this.Equation));
        }
        protected override Thickness GetCurrentValueCore(Thickness defaultOriginValue, Thickness defaultDestinationValue, AnimationClock animationClock)
        {
            double    time = animationClock.CurrentTime.HasValue ? animationClock.CurrentTime.Value.TotalMilliseconds : 0.0;
            Thickness from = this.From.HasValue ? this.From.Value : defaultOriginValue;
            Thickness to   = this.To.HasValue ? this.To.Value : defaultDestinationValue;

            double leftDelta   = to.Left - from.Left;
            double topDelta    = to.Top - from.Top;
            double rightDelta  = to.Right - from.Right;
            double bottomDelta = to.Bottom - from.Bottom;

            double duration = this.Duration.TimeSpan.TotalMilliseconds;

            double leftResult   = EasingUtilities.CalculateCurrentValue(time, from.Left, leftDelta, duration, this.Equation);
            double topResult    = EasingUtilities.CalculateCurrentValue(time, from.Top, topDelta, duration, this.Equation);
            double rightResult  = EasingUtilities.CalculateCurrentValue(time, from.Right, rightDelta, duration, this.Equation);
            double bottomResult = EasingUtilities.CalculateCurrentValue(time, from.Bottom, bottomDelta, duration, this.Equation);

            Thickness returnThickness = new Thickness(leftResult, topResult, rightResult, bottomResult);

            return(returnThickness);
        }