WPF Reflections

Jun 28 2008   7:08AM GMT

WPF Animation - key frame



Posted by: Mark Shurmer
WPF, Animation, XAML

Firstly, what does a key frame animation mean?

It is a way of specifying steps for your animation to follow.
The WPF runtime will work out the smooth transition between the steps for you.

Why would you want to do such a thing?
If you want to control how the animation flows, but don’t want to specify every point, then a key frame helps you.

In the following example,  I have used a key frame animation to specify the periods at which the button’s rectangle changes colour.
It changes colour from AliceBlue to Blue to DarkGrey when you click on the button

june28_1.JPG

Notice how you need to specify the target property as Fill.Color, if you don’t WPF tries complains that you are specifying a Color object when it is expecting a Brush!

Comment on this Post


You must be logged-in to post a comment. Log-in/Register