Пример #1
0
        public override Storyboard PrepareStoryboard(TransitionContainer container)
        {
            Storyboard animator = new Storyboard();

            DoubleAnimation prevAnim = new DoubleAnimation();

            Storyboard.SetTarget(prevAnim, _prevRect);
            Storyboard.SetTargetProperty(prevAnim, new PropertyPath("Opacity"));
            prevAnim.Duration = Duration;
            prevAnim.From     = 1;
            prevAnim.To       = 0;

            DoubleAnimation nextAnim = new DoubleAnimation();

            Storyboard.SetTarget(nextAnim, _nextRect);
            Storyboard.SetTargetProperty(nextAnim, new PropertyPath("Opacity"));
            nextAnim.Duration = Duration;
            nextAnim.From     = 0;
            nextAnim.To       = 1;

            animator.Children.Add(prevAnim);
            animator.Children.Add(nextAnim);

            return(animator);
        }
Пример #2
0
        public override Storyboard PrepareStoryboard(TransitionContainer container)
        {
            Storyboard animator = new Storyboard();

            DoubleAnimation prevAnim = new DoubleAnimation();

            Storyboard.SetTarget(prevAnim, _prevRect);            // Hilight this in the chapter!
            Storyboard.SetTargetProperty(prevAnim, new PropertyPath("(0).(1)", UIElement.RenderTransformProperty, TranslateTransform.XProperty));
            prevAnim.Duration = Duration;
            prevAnim.From     = 0;
            prevAnim.To       = Direction == Direction.RightToLeft ? -1 * container.ActualWidth : container.ActualWidth;

            DoubleAnimation nextAnim = new DoubleAnimation();

            Storyboard.SetTarget(nextAnim, _nextRect);
            Storyboard.SetTargetProperty(nextAnim, new PropertyPath("(0).(1)", UIElement.RenderTransformProperty, TranslateTransform.XProperty));
            nextAnim.Duration = Duration;
            nextAnim.From     = Direction == Direction.RightToLeft ? container.ActualWidth : -1 * container.ActualWidth;
            nextAnim.To       = 0;

            animator.Children.Add(prevAnim);
            animator.Children.Add(nextAnim);

            return(animator);
        }
Пример #3
0
 public abstract Storyboard PrepareStoryboard(TransitionContainer container);