Chapter 8. Creating Animations in Silverlight

In This Chapter

  • Creating a simple animation

  • Exploring the different kinds of animations

  • Animating states for controls

When one of the authors was a child, he was given a flip book that had a slightly different picture on each page. Flipping the pages rapidly created the illusion that the character in the picture performed an action. This is the most primitive form of animation.

Likewise, an animation in a software application is nothing more than a sequence of images displayed in rapid succession, thereby creating the illusion that an object is moving or changing.

To create an animation in Silverlight, you change the value of certain properties over a duration of time. Those special properties relate to an object's size, position, or color, and in this chapter, we show you how you can create animations using Expression Blend.

Creating a Simple Bouncing Ball Animation

Using Expression Blend, animation can be performed very easily in Silverlight by recording the objects over a period of time and playing them back.

For example, to animate the height of an object, you "record" what the object's height is over a period of time; that is, you specify that at the one-second mark, the object's height should be 300, and at the five-second mark, it should be 500, and so on.

When you play back the animation, Silverlight automatically calculates what the height of the object should be between the two recorded property values.

In this section, we show you how ...

Get Silverlight™ 4 For Dummies® 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.