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 WPF ...

Get Windows Presentation Foundation 4.5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.