C# WPF动画:放大和缩小

C# WPF动画:放大和缩小,c#,.net,wpf,C#,.net,Wpf,如果只是放大和缩小,就很容易了 private void button1_Click(object sender, RoutedEventArgs e) { button1.BeginAnimation(Button.FontSizeProperty, new DoubleAnimation( 40, new System.Windows.Duration(TimeSpan.FromSeconds(2)),

如果只是放大和缩小,就很容易了

private void button1_Click(object sender, RoutedEventArgs e)
{
    button1.BeginAnimation(Button.FontSizeProperty, new DoubleAnimation( 40,
                           new System.Windows.Duration(TimeSpan.FromSeconds(2)),
                               FillBehavior.Stop) { AutoReverse = true });
}

但现在我希望当字体大小增加到40时,保持2秒钟,然后缩小。如何做到这一点?

您可以将多个动画组合成一个动画,这应该可以做到。 可以组合以下动画:

  • 一种将字体大小放大到40的字体
  • 不做任何事情的人(持续时间为2秒)
  • 缩小字体的字体
查看