user746461
user746461

Reputation:

WPF animation: enlarge-stay-shrink

If it is only enlarge and shrink, it is easy.

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 });
}

But now I hope when the font size grows to 40, stay for 2 seconds, then shrink. How to do this?

Upvotes: 1

Views: 407

Answers (1)

GETah
GETah

Reputation: 21449

You can combine several animations into a StoryBoard, that should do the trick. You can combine the following animations:

  • One that enlarges the font size up to 40
  • One that does nothing (with a duration of 2 sec)
  • One that shrinks the font back

Upvotes: 1

Related Questions