O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating custom animations

The three types of animations provided by WPF (property, path, and key frame) are declarative in nature, which is in large part what makes them easy to use. There's no need to handle timers, change positions manually, or anything like that.

Occasionally, dynamic changes are required which cannot be represented using the built-in animations. Examples include movements that use complex formulas and changes based on user interaction. In such scenarios, it's possible to perform the changes manually with some help from WPF.

Getting ready

Make sure Visual Studio is up and running.

How to do it...

We'll create a bouncing ball application that uses complex movements and optional user interaction to control the ball:

  1. Create a new ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required