WPF动画:enlarge-stay-shrink

时间:2012-04-23 16:11:49

标签: 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)),
                               FillBehavior.Stop) { AutoReverse = true });
}

但是现在我希望当字体大小增加到40时,保持2秒,然后缩小。怎么做?

1 个答案:

答案 0 :(得分:1)

您可以将多个动画组合成StoryBoard,这应该可以解决问题。 您可以组合以下动画:

  • 将字体大小扩大到40
  • 不做任何事情(持续时间为2秒)
  • 缩小字体的一个