private void BeginArrangeAnimation()
        {
            BeginAnimation(PercentProperty, null);
            foreach (UIElement child in InternalChildren)
            {
                var currentOffset = GetCurrentOffset(child);
                if (!double.IsNaN(currentOffset))
                {
                    SetLastOffset(child, GetCurrentOffset(child));
                }
            }
            var animation = new DoubleAnimation()
            {
                From           = 0,
                To             = 100,
                Duration       = AnimationDuration,
                EasingFunction = AnimationUtils.CreateEasingFunction(AnimationEase),
            };

            BeginAnimation(PercentProperty, animation);
        }
Пример #2
0
        private void UpdateChildren(bool useAnimation)
        {
            var targetX = (CurrentIndex - 1) * DesiredSize.Width;
            var targetY = (CurrentIndex - 1) * DesiredSize.Height;
            var targetPositionOffset = new Rect(targetX, targetY, 0, 0);

            if (!IsLoaded || !useAnimation || AnimationDuration.TotalMilliseconds == 0)
            {
                PositionOffset = targetPositionOffset;
            }
            else
            {
                var animation = new RectAnimation()
                {
                    To             = targetPositionOffset,
                    Duration       = AnimationDuration,
                    EasingFunction = AnimationUtils.CreateEasingFunction(AnimationEase),
                };
                BeginAnimation(PositionOffsetProperty, animation);
            }
        }