ANIMATION

Silverlight is very good at creating and displaying animations. All you have to do is specify that you want a property of a control (such as a color, an opacity, or a position) to animate to a new value and how long you'd like that animation to take, and Silverlight takes care of interpolating all the values in between. To make animations appear more natural, you can even use easing functions.

Managing Animations with Storyboards

You can use a storyboard to manage animations in Silverlight. You can create a new storyboard in Blend and then add any number of animations to it by choosing a time in the Timeline panel and setting a property at that point. Silverlight will automatically animate that property to the chosen value in a smooth manner when the storyboard is begun.

Whereas a style represents a set of property setters for a single control, a storyboard is composed of a set of property setters for a number of controls, with timing information included. A storyboard defines the following:

  • Which controls are to be affected
  • Which properties of these controls are to be affected
  • What values these properties should have
  • When these property values should take effect

When you open a storyboard for editing, the Objects and Timeline panel transforms to show a timeline like the one shown in Figure 12-15. It also adds any storyboarded properties to each object as sub-items in the tree. Each of these properties has one or more keyframes in the Objects and Timeline panel. This ...

Get Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.