It is common to think of an animation as a series of images that change over time; however to understand the framework of the Animation API for BlackBerry® device applications, you need to think of animation in a more abstract way. Animation is the change, over time, of any property or set of properties according to specified rules. The changing property might be the location of an image that is displayed on the screen, in which case the animation is an object moving on the screen. But the properties might be color or opacity, in which case the animation might be a pulsating object that constantly changes color or one that cycles between being transparent and opaque.

A framework that supports this more abstract type of animation requires objects that include properties to animate. These objects are called Animatable objects. Objects that you want to animate have to expose one or more of their properties to be updated by the animation framework. They do this either by using one of the predefined Animatable objects or by creating their own classes that implement the Animatable interface.

The rendering of the animation is treated as a separate task that is not handled automatically by the animation engine. The animation engine updates the animatable property values periodically according to rules that you specify using the API. You must write your own rendering code and register a listener to be notified when an update occurs so that you can render the current state of the animation. The update can be images in updated locations, images with different colors, or something even more creative.

The animation engine must be supplied with rules that tell it how to change the animatable property values under its control. The animation framework uses the traditional animation concepts of key frames and easing curves. The key frames specify the values that the properties should have at various points during the animation. The easing curves specify the dynamics of how transitions are made from one key frame to the next. The animation framework uses an AnimationKeyframeSequence object to specify key frames and an Animation object lets you specify various easing curves.

The animation framework lets you group animations so that you can control them as a group. It also lets you set up triggers that cause an animation to start and stop.

Next topic: Animation API

Was this information helpful? Send us your comments.