WPF动画
1、DoubleAnimation
private void RunAnimation( UIElement element, DependencyProperty dp, double oldValue, double newValue, double durationMs ) { var duration = new Duration(TimeSpan.FromMilliseconds(durationMs)); var doubleAnimation = new DoubleAnimation(oldValue, newValue, duration) { AccelerationRatio = 1, FillBehavior = FillBehavior.Stop, Name = dp.Name }; doubleAnimation.Completed += OnAnimationCompleted; //动画结束 doubleAnimation.CurrentTimeInvalidated += AnimationOnCurrentTimeInvalidated; //动画中的实时数据 element.BeginAnimation(dp, doubleAnimation); } private void StopAnimation(UIElement element, DependencyProperty dp) { element.BeginAnimation(dp, null); }