Exemplo n.º 1
0
        private Point GetAnimationStep(Point startPos, Point finalPos, double elapsedTime, double totalTime)
        {
            double x = TableflowViewAnimationHelper.GetAnimationStep(startPos.X, finalPos.X, elapsedTime, totalTime);
            double y = TableflowViewAnimationHelper.GetAnimationStep(startPos.Y, finalPos.Y, elapsedTime, totalTime);

            return(new Point(x, y));
        }
Exemplo n.º 2
0
        protected override double GetCurrentValueCore(double defaultOriginValue, double defaultDestinationValue, AnimationClock animationClock)
        {
            Nullable <double> to   = this.To;
            Nullable <double> from = this.From;

            if (!from.HasValue)
            {
                from = defaultOriginValue;
            }

            if (!to.HasValue)
            {
                to = defaultDestinationValue;
            }

            double toValue   = to.GetValueOrDefault();
            double fromValue = from.GetValueOrDefault();

            if ((!animationClock.CurrentProgress.HasValue) ||
                (animationClock.CurrentProgress.Value == 1))
            {
                return(toValue);
            }

            if (animationClock.CurrentProgress.Value == 0)
            {
                return(fromValue);
            }

            double totalTime   = animationClock.Timeline.Duration.TimeSpan.TotalMilliseconds;
            double elapsedTime = totalTime * animationClock.CurrentProgress.Value;

            if (elapsedTime >= totalTime)
            {
                return(toValue);
            }

            double animationStep = TableflowViewAnimationHelper.GetAnimationStep(fromValue, toValue, elapsedTime, totalTime);

            if (DoubleUtil.AreClose(animationStep, toValue))
            {
                return(toValue);
            }

            return(animationStep);
        }