Exemple #1
1
        /// <summary>
        /// 动态显示内容
        /// </summary>
        /// <param name="target"></param>
        /// <param name="duration"></param>
        public static void Show(ContentControl target, double duration = .8)
        {

            ThicknessAnimation animtion = new ThicknessAnimation()
            {
                From = new Thickness(target.Margin.Left + 80, target.Margin.Top, target.Margin.Right, target.Margin.Bottom),
                To = new Thickness(160, 0, 0, 0),
                Duration = TimeSpan.FromSeconds(duration),
                FillBehavior = FillBehavior.HoldEnd,
                AccelerationRatio = .5,
                EasingFunction = be
            };

            DoubleAnimation animtion2 = new DoubleAnimation()
            {
                From = 0,
                To = 1,
                Duration = TimeSpan.FromSeconds(duration),
                FillBehavior = FillBehavior.HoldEnd,
                AccelerationRatio = .5,
                EasingFunction = be
            };

            target.BeginAnimation(ContentControl.MarginProperty, animtion);
            target.BeginAnimation(ContentControl.OpacityProperty, animtion2);
        }
        private static Storyboard FadeInAnimation(int interval, params FrameworkElement[] controls)
        {
            Storyboard fadeInAnimation = new Storyboard();
            int counter = 0;
            foreach (var control in controls)
            {
                control.BeginAnimation(OpacityProperty, null);
                control.BeginAnimation(MarginProperty, null);
                control.Opacity = 0;
                control.Margin = new Thickness(0, control.Margin.Top, 0, 0);
                DoubleAnimation da = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(300));
                ThicknessAnimation ta = new ThicknessAnimation(new Thickness(-10, control.Margin.Top, 10, 0), new Thickness(0, control.Margin.Top, 0, 0), TimeSpan.FromMilliseconds(400));
                Storyboard.SetTarget(da, control);
                Storyboard.SetTarget(ta, control);
                Storyboard.SetTargetProperty(da, new PropertyPath(OpacityProperty));
                Storyboard.SetTargetProperty(ta, new PropertyPath(MarginProperty));
                fadeInAnimation.Children.Add(da);
                fadeInAnimation.Children.Add(ta);
                da.BeginTime = TimeSpan.FromMilliseconds(counter * interval);
                ta.BeginTime = TimeSpan.FromMilliseconds(counter * interval);
                counter++;
            }

            fadeInAnimation.Completed += (s, e) =>
            {
                foreach (var c in controls)
                {
                    c.Opacity = 1;
                }
            };
            return fadeInAnimation;
        }
        public void Flush()
        {
            var thicknessAnimationUsingKeyFrames = new ThicknessAnimationUsingKeyFrames();
            thicknessAnimationUsingKeyFrames.KeyFrames = new ThicknessKeyFrameCollection();

            double delta = (Width - Height) / 2;

            var thicknessAnimation = new ThicknessAnimation()
            {
                From = new Thickness(delta, 0, delta, 0),
                To = new Thickness(delta - 500, -500, delta - 500, -500),
                Duration = new Duration(TimeSpan.FromSeconds(1)),
                AutoReverse = true
            };
            thicknessAnimation.Completed += new EventHandler(animation_Completed);

            _flushEllipse = new Ellipse()
            {
                Fill = new SolidColorBrush(Colors.LightBlue),
                Stroke = new SolidColorBrush(Colors.Orange),
                StrokeThickness = 5,
                Opacity = 0.5
            };

            Children.Add(_flushEllipse);
            _flushEllipse.BeginAnimation(Ellipse.MarginProperty, thicknessAnimation);
        }
        private void txt_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            DoubleAnimation title_width_animation = new DoubleAnimation();
            ThicknessAnimation title_margin_animation = new ThicknessAnimation();
            DoubleAnimation content_width_animation = new DoubleAnimation();
            DoubleAnimation content_height_animation = new DoubleAnimation();
            ThicknessAnimation content_margin_animation = new ThicknessAnimation();
            DoubleAnimation txt_width_animation = new DoubleAnimation();
            ThicknessAnimation txt_margin_animation = new ThicknessAnimation();
            if (txt.Width < 720 || txt.ActualWidth < 720)
            {
                title_width_animation.To = SystemParameters.PrimaryScreenWidth;

                title_margin_animation.To = new Thickness(0, 10, 0, 0);

                content_height_animation.To = SystemParameters.PrimaryScreenHeight - 105;

                content_width_animation.To = SystemParameters.PrimaryScreenWidth;

                content_margin_animation.To = new Thickness(0, 10, 0, 0);

                txt_width_animation.To = SystemParameters.PrimaryScreenWidth;

                txt_margin_animation.From = new Thickness(0, 0, 0, 0);
                txt_margin_animation.To = new Thickness(0, SystemParameters.PrimaryScreenHeight-txt.ActualHeight - 110, 0, 0);

            }
            else
            {
                title_width_animation.To = 392;

                title_margin_animation.To = new Thickness(0, 200, 0, 0);

                content_height_animation.To = 533;

                content_width_animation.To = 392;

                content_margin_animation.To = new Thickness(0, 10, 0, 0);

                txt_margin_animation.From = new Thickness(0, 0, 0, 0);
                txt_margin_animation.To = new Thickness(0, SystemParameters.PrimaryScreenHeight-txt.ActualHeight -110, 0, 0);

                //txt_width_animation.To = SystemParameters.PrimaryScreenWidth;
            }
            title_width_animation.Duration = TimeSpan.FromSeconds(0.5);
            title_margin_animation.Duration = TimeSpan.FromSeconds(0.5);
            content_height_animation.Duration = TimeSpan.FromSeconds(0.5);
            content_width_animation.Duration = TimeSpan.FromSeconds(0.5);
            content_margin_animation.Duration = TimeSpan.FromSeconds(0.5);
            txt_width_animation.Duration = TimeSpan.FromSeconds(0.5);
            txt_margin_animation.Duration = TimeSpan.FromSeconds(500);

            txt.BeginAnimation(StackPanel.WidthProperty, title_width_animation);
            txt.BeginAnimation(StackPanel.MarginProperty, title_margin_animation);
            //content.BeginAnimation(StackPanel.HeightProperty, content_height_animation);
            //content.BeginAnimation(StackPanel.WidthProperty, title_width_animation);
            //content.BeginAnimation(StackPanel.MarginProperty, content_margin_animation);
            txt.BeginAnimation(TextBlock.WidthProperty, txt_width_animation);
            txt.BeginAnimation(TextBlock.MarginProperty, txt_margin_animation);
        }
Exemple #5
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Ellipse ellipse1 = new Ellipse();
            ellipse1.Width = 50;
            ellipse1.Height = 20;
            ellipse1.ToolTip = "Touch Me / Потискай меня";
            ellipse1.StrokeThickness = 2;
            ellipse1.Stroke = Brushes.Black;
            ellipse1.Fill = Brushes.Red;
            Mygrid.Children.Add(ellipse1);

            Ellipse ellipse2 = new Ellipse();
            ellipse2.Width = 50;
            ellipse2.Height = 20;
            ellipse2.ToolTip = "Touch Me / Потискай меня";
            ellipse2.StrokeThickness = 2;
            ellipse2.Stroke = Brushes.Red;
            ellipse2.Fill = Brushes.Green;
            Mygrid.Children.Add(ellipse2);

            Random rand1 = new Random((int)DateTime.Now.Ticks);
            Random rand2 = new Random((int)DateTime.Now.Ticks);
            ThicknessAnimation TA1 = new ThicknessAnimation(); //Анимация перемещения
            TA1.From = ellipse1.Margin = new Thickness(10, 100, 0, 0); //Координаты начального положения
            TA1.To = ellipse1.Margin = new Thickness(1400, 100, 0, 0); //Координаты конечного положения
            TA1.Duration = TimeSpan.FromSeconds(rand1.Next(10, 20)); //Время анимации
            ellipse1.BeginAnimation(MarginProperty, TA1); //Запуск анимации

            ThicknessAnimation TA2 = new ThicknessAnimation(); //Анимация перемещения
            TA2.From = ellipse2.Margin = new Thickness(10, 200, 0, 0); //Координаты начального положения
            TA2.To = ellipse2.Margin = new Thickness(1400, 200, 0, 0); //Координаты конечного положения
            TA2.Duration = TimeSpan.FromSeconds(rand2.Next(10, 20)); //Время анимации
            ellipse2.BeginAnimation(MarginProperty, TA2); //Запуск анимации
        }
        private void AvatarBounce()
        {

            var bounce = new BounceEase { Bounces = 3, Bounciness = 10 };
            var a = new ThicknessAnimation(new Thickness(10, -800, 0, 810), new Thickness(10, 10, 0, 0),
                                           new Duration(new TimeSpan(0, 0, 1))) {EasingFunction = bounce};
            Avi.BeginAnimation(MarginProperty, a);
        }
Exemple #7
0
 private void AnimationUp(Grid grid)
 {
     ThicknessAnimation ta = new ThicknessAnimation();
     ta.From = grid.Margin;
     ta.To = new Thickness(grid.Margin.Left, RowHeight + SpaceBetweenGrids, 0, 0);
     ta.Duration = new Duration(TimeSpan.FromSeconds(0.5));
     grid.BeginAnimation(Grid.MarginProperty, ta);
 }
 private void BtnBack_Click(object sender, RoutedEventArgs e)
 {
     ThicknessAnimation ta = new ThicknessAnimation(new Thickness(-618, 0, 1003, 0), new Duration(TimeSpan.FromMilliseconds(350)));
     ExponentialEase ee = new ExponentialEase();
     ee.EasingMode = EasingMode.EaseOut;
     ta.EasingFunction = ee;
     ta.Completed += ta_Completed;
     this.OptGrid.BeginAnimation(MarginProperty, ta);
 }
Exemple #9
0
    private void DockPanel_MouseEnter(object sender, MouseEventArgs e) {
      var ta = new ThicknessAnimation();
/*
      ta.From = MenuCanvas.Margin;
      ta.To = new Thickness(0,15,-360,0);
      ta.Duration = new Duration(TimeSpan.FromMilliseconds(500));
      MenuCanvas.BeginAnimation(MarginProperty, ta);
*/
    }
Exemple #10
0
 public void Beweeg(Point target)
 {
     var thickness = new Thickness(target.X, target.Y, 0, 0);
     var moveAnimation = new ThicknessAnimation(Margin, thickness, TimeSpan.FromMilliseconds(500))
         {
             FillBehavior = FillBehavior.Stop
         };
     moveAnimation.Completed += (sender, args) => Margin = thickness;
     BeginAnimation(MarginProperty, moveAnimation);
 }
Exemple #11
0
		static AnimationTimeline CreateSlideInAnimation(FrameworkElement frameworkElement)
		{
			var parent = frameworkElement.Parent as FrameworkElement;
			
			var marginAnimation = new ThicknessAnimation();
			marginAnimation.From = new Thickness(parent.ActualWidth, 0, 0, 0);
			marginAnimation.To = new Thickness(0);
			marginAnimation.Duration = duration;
			return marginAnimation;
		}
Exemple #12
0
    private void StartLeaveAnimation() {
      var ta=new ThicknessAnimation();
/*
      ta.From=MenuCanvas.Margin;
      ta.To=new Thickness(0, 15, -410, 0);
      ta.Duration=new Duration(TimeSpan.FromMilliseconds(500));
      MenuCanvas.BeginAnimation(MarginProperty, ta);
*/

    }
 public void HideMessage()
 {
     ThicknessAnimation ta1 = new ThicknessAnimation();
     ta1.To = new Thickness(848, 55, 0, 0);
     ta1.Duration = new Duration(TimeSpan.FromSeconds(2));
     DoubleAnimation da1 = new DoubleAnimation();
     da1.To = 0;
     da1.Duration = new Duration(TimeSpan.FromSeconds(2));
     PopupContainer.BeginAnimation(Grid.MarginProperty, ta1);
     PopupContainer.BeginAnimation(Grid.OpacityProperty, da1);
 }
Exemple #14
0
        private static void SideBarAnimation(Panel sideBar, int from, int to, ThicknessAnimation ta)
        {
            DoubleAnimation da = new DoubleAnimation();
            da.From = from;
            da.To = to;
            da.Duration = TimeSpan.FromSeconds(0.4);
            sideBar.BeginAnimation(TextBlock.OpacityProperty, da);

            ta.Duration = TimeSpan.FromSeconds(0.2);
            sideBar.BeginAnimation(TextBlock.MarginProperty, ta);
        }
Exemple #15
0
 static Animation()
 {
     ca = new ColorAnimation();
     ta = new ThicknessAnimation();
     da = new DoubleAnimation();
     sbOnce = new Storyboard();
     sbForever = new Storyboard();
     sbForever.RepeatBehavior = RepeatBehavior.Forever;
     sbForever.Children.Add(new DoubleAnimation());
     sb = sbOnce;
     sb.Children.Add(new DoubleAnimation());
 }
        public ContentBouncer()
        {
            _aniSlider = new ThicknessAnimation
            {
                AutoReverse = true,
                FillBehavior = FillBehavior.Stop,
                RepeatBehavior = RepeatBehavior.Forever,
                BeginTime = TimeSpan.FromSeconds(.5),
            };

            Loaded += ContentBouncer_Loaded;
        }
 public void ShowMessage(int type)
 {
     PopupContainer.Children.Add(new Popup(type));
     ThicknessAnimation ta = new ThicknessAnimation();
     ta.To = new Thickness(848, 43, 0, 0);
     ta.Duration = new Duration(TimeSpan.FromSeconds(0.75));
     DoubleAnimation da = new DoubleAnimation();
     da.To = 1;
     da.Duration = new Duration(TimeSpan.FromSeconds(0.75));
     PopupContainer.BeginAnimation(Grid.MarginProperty, ta);
     PopupContainer.BeginAnimation(Grid.OpacityProperty, da);
 }
 private void frameGuide_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
 {
     var ani = new ThicknessAnimation(new Thickness(10, 0, -10, 0), new Thickness(0), TimeSpan.FromSeconds(0.25));
     var ani1 = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.25));
     frameGuide.BeginAnimation(MarginProperty, ani);
     frameGuide.BeginAnimation(OpacityProperty, ani1);
     if (e.Uri != null)
     {
         if (e.Uri.OriginalString.Equals("Guide/PageGuideEnd.xaml"))
         {
             Close();
         }
     }
 }
Exemple #19
0
 private void frameGuide_Navigated(object sender, NavigationEventArgs e)
 {
     var ani = new ThicknessAnimation(new Thickness(10, 0, -10, 0), new Thickness(0), TimeSpan.FromSeconds(0.25));
     var ani1 = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.25));
     VisualStateManager.GoToState(this, "AfterLoaded", true);
     frameGuide.BeginAnimation(MarginProperty, ani);
     frameGuide.BeginAnimation(OpacityProperty, ani1);
     if (e.Uri != null)
     {
         if (e.Uri.OriginalString.Equals("Guide/PageGuideTOTHY.xaml"))
         {
             Back();
         }
     }
 }
Exemple #20
0
        public ZoomControl()
        {
            _scaleTrasform = new ScaleTransform();
            _transformGroup = new TransformGroup();
            _transformGroup.Children.Add(_scaleTrasform);

            _animZoom = new DoubleAnimation();
            _animPositionX = new DoubleAnimation();
            _animPositionY = new DoubleAnimation();
            _animMargin = new ThicknessAnimation();
            _animZoom.Duration = _animMargin.Duration = _animPositionX.Duration = _animPositionX.Duration = AnimationDuration;
            _animZoom.EasingFunction = _animMargin.EasingFunction = new CircleEase();

            _animZoom.Completed += new EventHandler(_animZoom_Completed);
        }
        private static void PropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            var control = (FrameworkElement)dependencyObject;
            Storyboard storyboard = new Storyboard();
            DoubleAnimation da = new DoubleAnimation(0.3, 1, TimeSpan.FromMilliseconds(500));
            ThicknessAnimation ta = new ThicknessAnimation(new Thickness(-10, 0, 10, 0), new Thickness(0), TimeSpan.FromSeconds(0.4));
            Storyboard.SetTarget(da, control);
            Storyboard.SetTarget(ta, control);
            Storyboard.SetTargetProperty(da, new PropertyPath(UIElement.OpacityProperty));
            Storyboard.SetTargetProperty(ta, new PropertyPath(FrameworkElement.MarginProperty));

            storyboard.Children.Add(da);
            storyboard.Children.Add(ta);
            storyboard.Begin(control);
        }
        private void CurrentTrackAnimation(TextBlock txt, Polygon poly, bool inAnimate)
        {
            Storyboard story = new Storyboard();

            ColorAnimation coloranimation2 = new ColorAnimation(inAnimate ? ((SolidColorBrush)Application.Current.Resources["AccentColorBrush"]).Color : (Color)Application.Current.Resources["BlackColor"], TimeSpan.FromMilliseconds(250));
            Storyboard.SetTarget(coloranimation2, txt);
            Storyboard.SetTargetProperty(coloranimation2, new PropertyPath("Foreground.Color"));

            ThicknessAnimation thicknessanimation = new ThicknessAnimation(inAnimate ? new Thickness(3, 2, -3, 0) : new Thickness(0, 2, 0, 0), TimeSpan.FromMilliseconds(250));
            Storyboard.SetTarget(thicknessanimation, poly);
            Storyboard.SetTargetProperty(thicknessanimation, new PropertyPath(MarginProperty));

            story.Children.Add(coloranimation2);
            story.Children.Add(thicknessanimation);
            story.Begin(this);
        }
        public PivotContentControl()
        {
            ThicknessAnimation slideInAnimation = new ThicknessAnimation();
            slideInAnimation.From = new Thickness(200, 0, 0, 0);
            slideInAnimation.To = new Thickness(0, 0, 0, 0);
            slideInAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.3));
            Storyboard.SetTargetProperty(slideInAnimation, new PropertyPath(FrameworkElement.MarginProperty));
            Storyboard.SetTarget(slideInAnimation, this);

            CubicEase easing = new CubicEase();
            easing.EasingMode = EasingMode.EaseOut;
            slideInAnimation.EasingFunction = easing;

            fadeInSB = new Storyboard();
            fadeInSB.Children.Add(slideInAnimation);
        }
Exemple #24
0
        private void HideGrid()
        {
            if (LoginGrid.Visibility == Visibility.Collapsed)
                return;

            var hideGridAnimation = new ThicknessAnimation();
            hideGridAnimation.From = new Thickness(0);
            hideGridAnimation.To = new Thickness(0, FullScreenGrid.ActualHeight * -2, 0, 0);
            hideGridAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(400));
            hideGridAnimation.EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseInOut };
            var sb = new Storyboard();
            sb.Children.Add(hideGridAnimation);
            Storyboard.SetTarget(hideGridAnimation, LoginGrid);
            Storyboard.SetTargetProperty(hideGridAnimation, new PropertyPath(MarginProperty));
            sb.Completed += HideGridCompleted;
            sb.Begin();
        }
        public void Mix()
        {
            Random r = new Random();
            ThicknessAnimation[] ta = new ThicknessAnimation[16];
            int[] i = new int[16]{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};

            for (int k = 0; k < i.Length; k++)
            {
                int l=r.Next(0, 16);
                if (!i.Contains(l))
                    i[k] = l;
                else
                {
                    while (i.Contains(l))
                    {
                        l = r.Next(0, 16);
                    }
                    i[k] = l;
                }
            }

            for (int j = 0; j < ta.Length; j++)
            {
                ta[j] = new ThicknessAnimation();
                ta[j].To = new Thickness(margins.Margins[i[j]].Left, margins.Margins[i[j]].Top, margins.Margins[i[j]].Right, margins.Margins[i[j]].Bottom);
            }

            Button0.BeginAnimation(Button.MarginProperty, ta[0]);
            Button1.BeginAnimation(Button.MarginProperty, ta[1]);
            Button2.BeginAnimation(Button.MarginProperty, ta[2]);
            Button3.BeginAnimation(Button.MarginProperty, ta[3]);
            Button4.BeginAnimation(Button.MarginProperty, ta[4]);
            Button5.BeginAnimation(Button.MarginProperty, ta[5]);
            Button6.BeginAnimation(Button.MarginProperty, ta[6]);
            Button7.BeginAnimation(Button.MarginProperty, ta[7]);
            Button8.BeginAnimation(Button.MarginProperty, ta[8]);
            Button9.BeginAnimation(Button.MarginProperty, ta[9]);
            ButtonDec.BeginAnimation(Button.MarginProperty, ta[10]);
            ButtonDev.BeginAnimation(Button.MarginProperty, ta[11]);
            ButtonMult.BeginAnimation(Button.MarginProperty, ta[12]);
            ButtonMin.BeginAnimation(Button.MarginProperty, ta[13]);
            ButtonEqv.BeginAnimation(Button.MarginProperty, ta[14]);
            ButtonAdd.BeginAnimation(Button.MarginProperty, ta[15]);
        }
        public PivotContentControl()
        {
            var slideInAnimation = new ThicknessAnimation
            {
                From = new Thickness(200, 0, 0, 0),
                To = new Thickness(0, 0, 0, 0),
                Duration = new Duration(TimeSpan.FromSeconds(0.3))
            };
            Storyboard.SetTargetProperty(slideInAnimation, new PropertyPath(FrameworkElement.MarginProperty));
            Storyboard.SetTarget(slideInAnimation, this);

            slideInAnimation.EasingFunction = new CubicEase
                            {
                                EasingMode = EasingMode.EaseOut
                            };

            _fadeInSb = new Storyboard();
            _fadeInSb.Children.Add(slideInAnimation);
        }
Exemple #27
0
        public void MouseNHolder(Canvas b, Thickness tothickness, bool isactive)
        {
            ThicknessAnimation holderslide = new ThicknessAnimation();
            if (isactive)
            {
                holderslide.To = tothickness;
                holderslide.From = b.Margin;
                holderslide.Duration = new Duration(TimeSpan.FromMilliseconds(100));
                b.BeginAnimation(Canvas.MarginProperty, holderslide);
            }
            else
            {
                holderslide.To = tothickness;
                holderslide.From = b.Margin;
                holderslide.Duration = new Duration(TimeSpan.FromMilliseconds(100));
                b.BeginAnimation(Canvas.MarginProperty, holderslide);

            }
        }
 public void MoveHover(GridIconControl icon)
 {
     if (Config.HoverEnabled)
     {
         if (Hover.Opacity == 0)
         {
             var anim = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromMilliseconds(Config.HoverPopupDelay)));
             Hover.BeginAnimation(OpacityProperty, anim);
         }
         else
         {
             Hover.BeginAnimation(OpacityProperty, null);
             Hover.Opacity = 1;
         }
         var bounds = icon.TransformToAncestor(wpContent).TransformBounds(new Rect(0, 0, icon.ActualWidth, icon.ActualHeight));
         var anim2 = new ThicknessAnimation(Hover.Margin, new Thickness(bounds.Left - 3, bounds.Top - 3, 0, 0), new Duration(TimeSpan.FromMilliseconds(Config.HoverMoveDealy)));
         anim2.AccelerationRatio = 0.2;
         Hover.BeginAnimation(MarginProperty, null);
         Hover.BeginAnimation(MarginProperty, anim2);
     }
 }
Exemple #29
0
        private void slide(Border oldVisual, Border newVisual, Direction direction)
        {
            var width = this.ActualWidth;
            var animOut = new ThicknessAnimation(new Thickness(0), new Thickness(direction == Direction.Right ? -width : width, 0, direction == Direction.Right ? width : 0, 0), new Duration(TimeSpan.FromMilliseconds(300)));
            var animIn = new ThicknessAnimation(new Thickness(direction == Direction.Right ? width : -width, 0, direction == Direction.Right ? 0 : width, 0), new Thickness(0), new Duration(TimeSpan.FromMilliseconds(400)));

            animIn.EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 4 };
            animIn.EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 3 };

            Storyboard.SetTarget(animOut, oldVisual);
            Storyboard.SetTargetProperty(animOut, new PropertyPath(MarginProperty));

            Storyboard.SetTarget(animIn, newVisual);
            Storyboard.SetTargetProperty(animIn, new PropertyPath(MarginProperty));

            _storyBoard = new Storyboard();
            _storyBoard.Children.Add(animOut);
            _storyBoard.Children.Add(animIn);
            _storyBoard.Completed += StoryBoardCompleted;
            _storyBoard.Begin();
        }
Exemple #30
0
        private void Start()
        {
            if (!_queue.Any() || _moving)
                return;
            _moving = true;

            var target = _queue.Dequeue();
            var thickness = new Thickness(target.X, target.Y, 0, 0);
            var moveAnimation = new ThicknessAnimation(Margin, thickness, TimeSpan.FromMilliseconds(500))
            {
                FillBehavior = FillBehavior.Stop
            };
            moveAnimation.Completed += (sender, args) =>
                {
                    _moving = false;
                    Margin = thickness;
                    Start();
                };

            BeginAnimation(MarginProperty, moveAnimation);
        }