WPF左右移动动画实现

//boxItem要移动的控件 
              DoubleAnimation doubleAnimation = new DoubleAnimation();
                        doubleAnimation.Duration = new Duration
                            (TimeSpan.FromSeconds(5));

                        TranslateTransform transform = new TranslateTransform();
                        boxItem.RenderTransform = transform;
                        transform.X = 0;
                    
                                doubleAnimation.To = 100;
                 
                            transform.BeginAnimation(TranslateTransform.XProperty, doubleAnimation);
                        }

 

posted @ 2020-05-21 17:39  _York  阅读(1403)  评论(0编辑  收藏  举报