![]() |
Table of Contents |
![]() |
Hacks #26-34This chapter covers a topic near and dear to Flash's heart: animation. The Flash interface is based on the techniques of traditional cel animation. The Flash timeline is the digital equivalent of a flip book, with each frame representing a slice of time and successive cels (frames) displayed over time to create the illusion of motion. Like traditional cel animation, Flash supports the concept of layers, which are used to build up an animation from the background to the foreground, with various elements at appropriate depths. Keyframes
and tween frames, in which the master artist
creates the keyframes and underlings create the in-between (tween)
frames, will also be familiar to traditional animators. In
Flash's tween-based system, the artist creates the
keyframes and Flash can generate the tween frames automatically. All
changes created by the animator, such as moving a graphic to a new
location, must occur on a keyframe. Frame 1 is always a keyframe and
you can create additional keyframes using
Insert When a graphic is placed in a layer, it appears on Stage until a
blank keyframe is encountered in that layer. For example, if you want
a graphic to be removed from the Stage after frame 19, you can insert
a blank keyframe in frame 20 (using
Insert Even though Flash does a lot of the work for you, this chapter has a number of hacks that benefit the traditional animator and newcomer alike. Creating animation can require a lot of time and skill, so this chapter offers hacks that both reduce the time required and simplify the process. Unlike traditional animators, Flash animators must also be concerned with download times and runtime performance. This chapter looks at ways of reducing or automating common animation tasks by:
Flash also allows you to generate scripted motion. In scripted motion, the appearance of the next frame in the animation is calculated and drawn by ActionScript. This form of animation is the route best taken when you want to create interactive animation or when your animations are controlled by mathematical rules (such as physical equations of motion). When using scripted animation, be aware that Flash uses print-based coordinates, not mathematical ones. A printed page takes the origin at the top-left corner, whereas the traditional Cartesian axes use the bottom-left corner as the origin. This means that the Flash origin is at the top-left corner of the Stage, and the positive Y direction is downward, as shown in Figure 4-1. Figure 4-1. Flash coordinate axes (left) and traditional Cartesian coordinate axes (right)![]() For scripted motion, the limiting factor is performance, and we will look at ways of making your code create animations that are as smooth and responsive as possible. We will also look at several quick ways of creating common scripted animation effects. |
![]() |
Table of Contents |
![]() |