Chapter 10. Timeline Animation and the Motion Editor

IN THIS CHAPTER

  • Animating frame by frame

  • Editing multiple frames and using onion skinning

  • Working with shape tweens

  • Adding shape hints

  • Creating motion tweens

  • Modifying motion paths

  • Animating with motion presets

  • Easing and the Motion Editor

  • Tweening 3-D properties

  • Optimizing and integrating multiple tween sequences

In this chapter, I discuss the basic methods and tools used to create animations in the Flash authoring environment. Animation is the process of creating the illusion of movement or change over time. Animation can be the movement of an item from one place to another, or it can be a change of color over a period of time. The change can also be a morph, or transformation, from one shape to another. Any change of either position or appearance that occurs over time is animation. In Flash, changing the contents of successive frames (over a period of time) creates animation. This can include any or all of the changes I have mentioned, in any combination.

Note

Animation is possible without extending Flash content beyond one frame, but this requires you to apply transformations to graphics by using ActionScript commands and/or mathematical equations that are executed by code rather than triggered by the Flash timeline. I suggest you use ActionScript 3.0 Bible (Wiley, 2008) as a companion to this book when you are ready to go to the next level with your Flash projects.

Basic Methods of Flash Animation

Flash supports three basic methods of animation:

  • Frame-by-frame animation is achieved by manually changing the individual contents of each of any number of successive keyframes.

  • Keyframe-based tweened animation is achieved by defining the contents of the start and endpoints of an animation (with keyframes) and allowing Flash to interpolate the contents of the frames in between. Flash CS5 has two kinds of keyframe-based tweening:

    • Shape tweening

    • Classic (motion) tweening

  • Object-based motion tweening is an amazing evolution of keyframe-based (or Classic) motion tweening. In Flash CS5, you can now apply a tween to a target object on the Stage, and by simply moving or transforming the object, property keyframes (and a motion path, if needed) are auto-created to track and animate the changes. The many benefits of the tween method and the Motion Editor are explained in more detail later in this chapter.

Advanced Flash developers tend to animate almost exclusively by controlling Movie clips with ActionScript. Although this might seem intimidating to illustrators or animators who are more comfortable using analog tools, this programmatic approach to creating motion (and even artwork) dynamically makes sense. After all, computer animation is the art of orchestrating items according to various properties over time — and in the digital realm. numbers describe all properties, even color.

Note

The Motion Presets panel enables users to create or import, save, reuse, and share custom tween patterns. These XML-based tween files work more seamlessly than Timeline Effects ever did.

Flash components, the Motion Presets panel, and the Copy Motion as ActionScript 3.0 command make it easier than ever for beginning programmers to integrate ActionScripted elements into Flash projects. But, before you jump into scripted animation, it helps to know how to animate in the Flash authoring environment by using layers, frames, and symbols.

Frame-by-Frame Animation

The most basic form of animation is frame-by-frame animation. Because frame-by-frame animation employs unique drawings in each frame, it's ideal for complex animations that require subtle changes — for example, facial expressions. However, frame-by-frame animation also has its drawbacks. It can be very tedious and time consuming to draw unique art for each frame of the animation. Moreover, all those unique drawings contribute to a large file size. In Flash, a frame with unique art is called a keyframe. As shown in Figure 10.1, frame-by-frame animation requires a unique drawing for every movement or change, which makes nearly every frame a keyframe.

The example shown in Figure 10.1 (keyframe.swf) was created by inserting a series of blank keyframes (F7) and then working backward from the artwork in the final frame to paste the text and erase letters in (reverse) sequential keyframes. In the final effect, the text appears letter by letter until the whole word is written out in keyframe 10. This process of modifying your original artwork in each frame to create a sequence is one use of frame-by-frame animation. Another approach is to create completely unique artwork in each blank keyframe (F7).

When you use keyframes to gradually add to the artwork, the text appears to be written out letter by letter in the final animation.

Figure 10.1. When you use keyframes to gradually add to the artwork, the text appears to be written out letter by letter in the final animation.

As shown in Figure 10.2, the changes in the lines from frame to frame can add a lot more motion to the final animation. If you are a skilled illustrator, you will be able to keep enough consistency from keyframe to keyframe that the animation will seem to be the same shape or figure moving to a new position. If you are an aspiring illustrator, you may end up with a lot more variation among your drawings! As long as you are not trying to get a very precise sequence, this variation can actually be a lot of fun to watch — every line dances and moves in your final animation. Keep in mind that you are not restricted to just one series of frames; you can keep adding elements with their own keyframe sequences on separate layers.

Note

The source files for the examples in this section are included on the CD-ROM — they're in the Keyframe folder of the ch10 folder.

The images shown in Figure 10.2 are from the file faceFramebyFrame.fla. This sequence of drawings was originally done on top of a short video clip of a real person. If you're learning to draw motion, video can be a good starting point — place it in a guide layer so it won't add to the file size of your final movie. If you work in a loose style, the roughness of the individual traced drawings can add more life to the final animation.

A loosely sketched sequence can be paced by adding more "repeater" frames between the unique keyframe images.

Figure 10.2. A loosely sketched sequence can be paced by adding more "repeater" frames between the unique keyframe images.

Adding keyframes

To add a keyframe to the Timeline, select the frame that you want to convert into a keyframe and then do one of the following:

  • Convert a frame into a keyframe:

    • Right-click (or Control+click on Mac) the frame and select Insert Keyframe from the contextual menu.

    • Choose Insert

      Adding keyframes
    • Press F6 on the keyboard.

  • Convert a frame into a blank keyframe:

    • Right-click (or Control+click on Mac) the frame and select Insert Blank Keyframe from the contextual menu.

    • Choose Insert

      Adding keyframes
    • Press F7 on the keyboard.

Note

If you select a frame in a span, the selected frame converts to a keyframe without adding to the length of the span. If you insert a keyframe at the end of a span, the keyframe adds to the length of the sequence. If you convert a frame in a span to a blank keyframe, all content clears from the keyframe and the following frames of the span.

Tip

If you need to make a sequence of keyframes, but you would rather not have to press F6 or F7 repeatedly to create individual keyframes, you can select a range of frames and use the Modify

Adding keyframes

Creating frame-by-frame animation

The basic steps for creating a frame-by-frame animation are as follows:

  1. Select the frame in which you want your frame-by-frame animation to begin. If it's not already a keyframe, use Insert

    Creating frame-by-frame animation
  2. Either draw or import the first image for your sequence into this keyframe. Wherever possible, use symbols and flip, rotate, or otherwise manipulate them for reuse to economize on file size.

  3. Select the next frame and either carry the artwork from the previous keyframe forward for modification by adding a keyframe (F6), or, if you want to create a completely new image from scratch or place a different imported image, make the next keyframe a blank keyframe (F7).

  4. Continue to add keyframes and change the contents of each keyframe until you complete the animation.

  5. Play back your animation by returning to the first keyframe and then selecting Control

    Creating frame-by-frame animation

Modifying Multiframe Sequences

To control the pacing of your animation, you can add more frames (F5) between the keyframes (creating a span) or add more keyframed (F6) images to the sequence to extend its length. Adding more frames between keyframes "holds" or pauses the animation until the playhead hits the next keyframe with changed content. In the example shown in Figure 10.2, the face holds on some frames while the butterfly continues to move in keyframed drawings on its own layer. To speed up (or shorten) animation, you can remove frames (Shift+F5) or keyframes (Shift+F6) to shorten the sequence. You can make changes in the length of a span by selecting a frame in the span that you want to modify and using the application menu commands (or shortcut keys), or you can simply drag the endframe of the span to change its position on the Timeline.

Tip

If you drag the endframe of a span to a new position, Flash automatically inserts a new keyframe to mark the new position. If you want to change the length of a span without adding more keyframes, hold down the Ctrl/

Modifying Multiframe Sequences

Inserting more frames does work to slow down an animated sequence, but generally if you insert more than two frames between keyframes the movement is interrupted and the animation starts to look too choppy. Try adding more keyframes to the sequence with very subtle change to the content in each keyframe if you want to create a slower, smoother animation.

Note

The default frame rate in Flash CS5 is 24 fps. This reflects the fact that most people viewing Flash Player 10 content have enough processor speed and bandwidth to handle smooth playback of high-fidelity animation.

By default, Flash loops the content on your timeline, so if you want a sequence to be repeated, you don't need to draw it over and over again. If you notice that your animation disappears before it loops to play again, check to make sure that there are no extra empty frames at the end of the sequence, or that the endframe of one of your sequences is not farther down the Timeline than the endframe of the element that disappears. Although you won't see anything on the Stage in these frames, Flash still plays those frames if they exist on the Timeline. Obviously, blank frames can be used in an animation whenever you want to empty the Stage — either as a pause between sequences or to create the illusion that your artwork has disappeared.

To illustrate how blank frames play back in an animation, we've created a silly example with a face and a rectangle that persist in every frame and some text that exists only on some frames (see Figure 10.3).

You can insert blank keyframes to clear artwork from the Stage. Remember that the playhead continues along the Timeline if there are frames on any one of the layers, even if the artwork on other layers is no longer present.

Figure 10.3. You can insert blank keyframes to clear artwork from the Stage. Remember that the playhead continues along the Timeline if there are frames on any one of the layers, even if the artwork on other layers is no longer present.

Onion skinning

Traditional animators worked on layers of transparent cels using a light table. This made it possible for them to create consistent drawings and to plan the pacing of movement in a sequence of cels. As you move from keyframe to keyframe in Flash, you might feel that you are working blind because you can see the artwork only on the current frame. If you are creating artwork for a sequence of related keyframes, it is crucial to have some visual indication or "map" of the changes from frame to frame. Fortunately, Flash has an effective digital version of the traditional light table — this handy feature is called onion skinning. In Flash, onion skinning enables you to see several frames of your artwork displayed at one time. The onion skin markers on the timeline determine the number of frames that are visible. You can turn onion skinning on or off whenever you need to by using the toggle buttons at the bottom of the Timeline window. As shown in Figure 10.4, there are actually two options for onion skinning: Onion Skin or Onion Skin Outlines.

Tip

Layers that are locked will not be onion skinned, even if there is artwork on multiple frames within the onion skin markers — this is helpful if you need to keep the view from getting too cluttered with multiple overlays. Generally, onion skinning works best if all layers are locked except the layer that you plan to edit.

The current frame (indicated by the position of the playhead) is displayed at 100 percent opacity, while the other frames in the sequence are displayed at a slightly reduced opacity or as outlines, depending on the Onion Skin button you have selected.

Tip

If you don't like the color of the outlines that appear when you turn on Onion Skin Outlines, you can change the setting for Outline color in the Layer Properties dialog box. (Double-click the layer icon or choose Properties from the contextual menu.)

The number of frames that are included in the onion skin display can be controlled either by choosing a setting from the Modify Onion Markers menu (shown in Figure 10.5) or by selecting the round marker handles with the Selection tool and sliding them to a new position on the Timeline. The number of frames that you select from the Modify menu is shown before and after the current frame — so in our example with Onion 2 selected, the onion markers actually span five frames (the current frame, plus two frames on each side).

Editing multiple frames

One of the drawbacks of manually creating unique artwork on every frame is that changes can be very time consuming. If you decide to change the color or size of an element or perhaps edit out a feature of your artwork, repeating this edit on every frame of a sequence is tedious and labor intensive.

Tip

The Find and Replace panel (Edit

Editing multiple frames
Onion Skin shows grayed out or ghosted artwork on multiple frames, and Onion Skin Outlines shows colored outlines of the artwork on multiple frames. It's hard to see the "color" here, but notice that the lines are thinner with Onion Skin Outlines (right).

Figure 10.4. Onion Skin shows grayed out or ghosted artwork on multiple frames, and Onion Skin Outlines shows colored outlines of the artwork on multiple frames. It's hard to see the "color" here, but notice that the lines are thinner with Onion Skin Outlines (right).

You can control the number of frames visible when onion skinning is turned on with the Modify Onion Markers menu or by dragging the onion skin markers to a new position on the Timeline.

Figure 10.5. You can control the number of frames visible when onion skinning is turned on with the Modify Onion Markers menu or by dragging the onion skin markers to a new position on the Timeline.

Fortunately, Flash provides a Timeline option that can make repeated edits on multiple frames much more efficient. Edit Multiple Frames enables you to see and select items on multiple frames for simultaneous modification. As shown in Figure 10.6, the Edit Multiple Frames option is turned on with the toggle button below the Timeline. When this feature is active, you can use any of the selection methods (Selection tool, Lasso, application menu, or shortcut keys) to select the parts of your artwork that you want to move, modify, or delete. This feature is especially helpful for edits that need to be consistent from frame to frame, such as moving all of your artwork to a new position in your layout.

Tip

Using the Lock feature to protect layers that you don't want to edit makes it much easier to select and edit multiple elements on specific layers. Using the Lasso tool or the Selection tool to drag-select items on the Stage includes only items on unlocked layers in your selection. The Select All command (Edit

You can control the number of frames visible when onion skinning is turned on with the Modify Onion Markers menu or by dragging the onion skin markers to a new position on the Timeline.
With Edit Multiple Frames toggled on, you can select elements on individual keyframes in a sequence (left) to be modified simultaneously (right).

Figure 10.6. With Edit Multiple Frames toggled on, you can select elements on individual keyframes in a sequence (left) to be modified simultaneously (right).

The frames visible and available for selection are marked by a gray span on the timeline with start and end handles. You can adjust the number of frames included in the span with the Selection tool by clicking and dragging the round handles on the timeline to a new position.

Using Tweens for Animation

Tweening is one of the most powerful capabilities of Flash. Whether you are creating character animation or motion graphics, or even the most basic button effect, you will find tweening indispensable. After you have planned your animation and created the initial artwork, you can use Flash tweening to generate the transitional images between one keyframe and another. This is the tool that makes it possible for artists to quickly generate smooth, precise animation — without spending half their lives manually filling in unique graphics on every frame. Instead, you can establish a beginning point and an endpoint, and make drawings, or key art, only for each of those points. Then you let Flash interpolate and render, or tween, the changes between the keyframes. Tweening can be used to render changes in size, shape, color, position, and rotation.

Tweening also minimizes file size because you don't have to include unique information on each frame in the animation. Because you define the contents of the frames at the beginning and endpoint (keyframes), Flash has to save only those graphics, plus the values needed to make the changes on the frames in between. Basically, Flash has to store only the difference between the beginning frame and the endframe so that the images on the frames in between can be calculated and rendered.

The other significant benefit of using tweens to generate an animated sequence is that if you want to make a change, you only need to modify the beginning or endpoint and Flash instantly updates the images in between.

Three kinds of tweens can be created in Flash — shape tweens, motion tweens, and Classic (motion) tweens — each applied for specific purposes. The type of tween that you want to apply is selected from the frame or object contextual menu or from the application Insert menu. Tween types are represented on the Timeline by a colored fill. Motion tweens are represented by a blue fill without an arrow, and shape tweens and classic tweens are represented by a fill with a continuous arrow on the span between the start keyframe and the end keyframe of the animation — a green fill for shape tweens and purple fill for classic tweens.

Note

There is one other type of tween layer that Flash auto-creates to hold IK armatures: Pose layers are marked by a small running figure, and like motion tween layers, they save changes made to the contents of the layer in property keyframes to enable animation. Pose layers cannot be inserted or created manually, they are only added to your layer stack when you use the Bone tool to link symbol instances or create an armature inside of a shape. This workflow is described later in this chapter.

Note

If a shape tween or classic tween is incomplete, either because the wrong tween type has been applied or because information on one of the defining keyframes is missing, the continuous arrow is replaced with a dashed line.

Note

Because the new object-based motion tween model introduced with Flash CS5 is the preferred workflow, I do not discuss classic tweening in detail in this edition of the book. For more information on classic tweening, refer to the archived "Timeline Animation" chapter from Flash CS3 Professional Bible (Wiley, 2007) on www.flashsupport.com/archive or search the Flash Help files for "classic tween."

Shape tweening

Shape tweening is useful for morphing basic shapes — for example, turning a square into a circle, or animating the drawing of a line by tweening from a dot to a finished line. Flash can shape tween only raw shapes or drawing objects, so don't even try to shape tween a group, symbol, or editable text — it won't work. You can tween multiple shapes on one layer, but for the sake of organization and animation control, it's best to put each shape on its own layer. This enables you to adjust the speed and length of shape tweens individually and also makes it much easier to figure out what's going on if you need to edit the file later.

Tip

The Object Drawing (J) toggle in the options area of the Tools panel makes your production process more streamlined if you are drawing items to animate. Drawing objects are a more flexible art type, but they can still be shape tweened like raw shapes. You can make objects with any of the normal drawing tools as long as you select the Object Drawing toggle. If you want to convert a raw shape into an object after it is drawn, select the shape, and then choose Modify

Shape tweening

Note

The smileTween.fla example file is located on the CD-ROM in the shapeTween subfolder of the ch11 folder.

Figure 10.7 shows an animated "smile" created by interpolating the graphics between a dot and a curved stroke with a shape tween. Flash nimbly handles this simple transition, rendering a gradually extending line on the frames between the dot of the pursed mouth and the final curve of the smile.

Here are the steps for creating a shape tween:

  1. Select the frame in which you want to start the animation. If it's not already a keyframe, convert it to one (F6).

  2. Draw your starting image on the Stage (see Figure 10.8). Always remember that shape tweening works only with shapes or drawing objects — not groups, symbols, or editable text. To shape tween these items, you first need to break them into shapes (Modify

    Shape tweening
    After a dot is drawn on keyframe 1 and an arc is drawn on keyframe 5, a shape tween is applied to render the shapes on the frames in the span between, creating an animation.

    Figure 10.7. After a dot is drawn on keyframe 1 and an arc is drawn on keyframe 5, a shape tween is applied to render the shapes on the frames in the span between, creating an animation.

    The contents of the first keyframe in your span define the starting point for the shape tween.

    Figure 10.8. The contents of the first keyframe in your span define the starting point for the shape tween.

  3. Insert a keyframe (F6) on the Timeline where you want the animation to end, and modify the artwork to define the endpoint of the animation (see Figure 10.9). If you want to create the artwork in the final frame from scratch, insert a blank keyframe (F7) instead of a keyframe that includes the artwork from the first keyframe.

    The contents of the final keyframe after your span define the ending point for the shape tween.

    Figure 10.9. The contents of the final keyframe after your span define the ending point for the shape tween.

  4. Select the keyframe at the beginning of the span that you want to interpolate with a shape tween. Remember that results are easiest to control and modify if you tween only one shape per layer.

  5. Choose Shape Tween from the application Insert menu or choose Create Shape Tween from the contextual menu (opened by right-clicking or Control+clicking the keyframe where you want to start the animation). The span between the start keyframe and the end keyframe of your animation appears with a green fill and an arrow to indicate that a shape tween has been applied, as shown in Figure 10.10.

    When the applied tween is selected in the Timeline, the Properties panel updates to present two options in the Tweening section (shown in Figure 10.11):

    On the first keyframe, specify Shape as the tween type with the contextual menu (or choose Create Shape Tween from the application Insert menu).

    Figure 10.10. On the first keyframe, specify Shape as the tween type with the contextual menu (or choose Create Shape Tween from the application Insert menu).

    Easing values and animation Blend style can be selected in the Tweening section of the Properties panel.

    Figure 10.11. Easing values and animation Blend style can be selected in the Tweening section of the Properties panel.

    • Set the Ease value if you want to vary the rate or speed of the animation. This is useful if you want to create the effect of acceleration or deceleration. If you want your animation to start slowly and progressively speed up, push the value down (by clicking and dragging left) to add an Ease In. This causes "in" to display adjacent to the slider and updates the value field with a negative number (between −1 and −100). For an animation that starts fast and progressively slows, push the value up (by clicking and dragging right) to add an Ease Out. The word "out" appears and a positive number (between 1 and 100) displays in the value field. If you want the rate of your animation to stay constant, leave the value in the middle (0). You can also click (and release) the hot text value field to type any number between −100 and 100 directly into the field.

      Note

      I added an Ease In (−100) to the smileTween sample file to make the animation look a little more realistic.

    • Select a Blend type from the drop-down menu. Distributive blending creates smoother interpolated shapes, whereas Angular blending creates interpolated shapes that preserve corners and straight lines. If your endpoints contain shapes with corners and lines, select Angular blending. Otherwise, use the default Distributive blending.

  6. Preview the animation by choosing Control

    Easing values and animation Blend style can be selected in the Tweening section of the Properties panel.

Tip

If the overall speed of the tween seems too fast or too slow, you can extend or reduce the length of the span. The fastest way to increase the span on all visible layers is to move the playhead to the center of the span, make sure that none of the frames are selected on any of the layers and that the layers are all unlocked, and then use the F5 key to add more frames. I added five frames to the overall span of the smileTween sample to slow the animation down.

Note

If you delete the artwork on the start or the end keyframes, you will notice that the arrow icon on the Timeline is replaced with a dashed line. This indicates that the tween is broken or incomplete. To restore the tween, it is usually best to select the first keyframe and choose Remove Tween from the application Insert menu (or from the frame contextual menu). Then check your timeline and your artwork to make sure that you have shapes on both a beginning and an end keyframe for Flash to interpolate. When you think all the elements are in place, select the first keyframe and reapply the shape tween by using the Insert menu (or the contextual menu).

Adding shape hints

Because Flash calculates the simplest way to interpolate from one shape to another, you occasionally get unexpected results if the shapes are complex or extremely different from one another. Shape tweening becomes less reliable the more points there are to be calculated between the defined keyframes. In the example, I have added a keyframe at the end of the span with the eyes of the character changed from circles to stars. I want the animation to be a smooth transition from the rough circle to the star shape in each eye. As shown in Figure 10.12, a basic shape tween results in some odd in-between shapes.

When a shape tween is added to create an animation from one keyframe to another, the transition artwork that Flash generates may not look how you expect it to.

Figure 10.12. When a shape tween is added to create an animation from one keyframe to another, the transition artwork that Flash generates may not look how you expect it to.

One way of making the in-between artwork more precise is to insert keyframes in the middle of the shape tween so that you can manually adjust the shapes that Flash has generated. Another option that enables you to control a tween without modifying any artwork is to add shape hints for Flash to follow when rendering the in-between shapes. Shape hints enable you to specify points on a starting shape that should match with specified points on the final shape. This helps Flash to "understand" how the shapes are related and how the transitional images should be rendered. Compare Figure 10.12 with Figure 10.13 to see the improvement that shape hints can make in the precision of in-between shapes.

Note

To compare the difference made by adding shape hints to the animation, open eyeTween.fla (or .swf) and eyeTweenHints.fla (or .swf) from the shapeHints subfolder in the ch11 folder on the CD-ROM.

Placing shapes on individual layers and adding shape hints to control the way that Flash renders in-between shapes improves the precision of shape tweens.

Figure 10.13. Placing shapes on individual layers and adding shape hints to control the way that Flash renders in-between shapes improves the precision of shape tweens.

Warning

When you are copying and pasting a span of frames into a new timeline — such as from the Main Timeline to a Movie clip timeline — Flash disconnects the shape hints from the shape. When pasting is confined to a single timeline, hints stay as you placed them.

Shape hints can be added only to artwork on keyframes that define the beginning and ending points of a shape tween. To add shape hints to the artwork in a shape tween, follow these steps after you have created a basic shape tween:

  1. Select a shape on the starting keyframe and choose Modify

    Placing shapes on individual layers and adding shape hints to control the way that Flash renders in-between shapes improves the precision of shape tweens.
  2. To specify a point on your starting shape, use the Selection tool to select and move the first hint (a) — position it on an area of the shape (for example, a corner or a curve) that you want to match up with an area on the final shape, as shown in Figure 10.14.

    Shape hints positioned on a shape in the starting keyframe for a shape tween

    Figure 10.14. Shape hints positioned on a shape in the starting keyframe for a shape tween

    When you move the playhead to the final keyframe of your shape tween, you will see a lettered hint that matches the one that was placed on the starting keyframe.

  3. Position this hint with the Selection tool so that it marks the area of the final shape that should match up with the area specified on the starting shape. Flash recognizes the hint only if it attaches correctly to the artwork. You will know that your hints are positioned properly when their fill color changes from red to green on the final keyframe (see Figure 10.15) and from red to yellow on the starting keyframe.

  4. Preview the new in-between shapes by scrubbing the Timeline (dragging the playhead with the Selection tool to review frames in the tweened sequence).

    Shape hints aligned to points on a shape in the ending keyframe of the tween

    Figure 10.15. Shape hints aligned to points on a shape in the ending keyframe of the tween

  5. Continue to add or reposition hints until Flash renders the in-between shapes correctly.

  6. To remove an individual hint, drag it off the Stage with the Selection tool. To remove all hints from an active keyframe, choose Modify

    Shape hints aligned to points on a shape in the ending keyframe of the tween

Tip

If the shape hints are not visible after you have placed them, make sure that the Show All Hints option in the contextual menu is toggled on, or use the application menu to choose View

Shape hints aligned to points on a shape in the ending keyframe of the tween
The contextual menu offers some options for working with shape hints.

Figure 10.16. The contextual menu offers some options for working with shape hints.

Motion tweening

Motion tweening is useful for animating Movie clips, Graphic symbols, and editable text; however, it cannot be used to animate groups, drawing objects, or raw shapes (unless these are first converted into Movie clip or Graphic symbols). As the name suggests, motion tweening is applied to move an item (or target object) from one place to another, but it's capable of much more. Motion tweening can also be used to animate the scale, skew, rotation, color, or transparency of a symbol. Flash filters and the new 3-D properties available in Flash CS5 can also be animated with motion tweens, as described later in this chapter.

Note

Motion tweening can only be applied to one target object per layer — use multiple layers to motion tween multiple targets in the same span of the Timeline.

Like a shape tween, a motion tween is more efficient than frame-by-frame animation because it doesn't require unique content for each frame of animation. Yet it is not appropriate for all effects — sometimes you'll need to use either frame-by-frame animation or shape tweening to create the kind of in-betweens you want in a sequence.

Note

Create your own file from scratch, or open motionTween_start.fla from the motionTween subfolder of the ch11 folder on the CD-ROM. To view the final animation, open motionTween_final.fla (or .swf) from the same location.

Here's how to create a motion tween:

  1. Select the frame in which you want to start your animation. If it's not already a keyframe, make it one by choosing Insert

    Object-Based Tweens versus Classic Tweens
  2. Draw or import the image that you want to tween. Remember that you can motion tween only symbols and text (editable text blocks).

    • If you already have the element as a symbol in your current Library, you can just drag an instance from the Library onto the Stage. Place each symbol that you want to animate on a separate layer, as shown in Figure 10.17.

    • If you are using a raw shape, group, drawing object, or bitmap, you have the option of converting it into a named Movie clip or Graphic symbol before applying the tween or applying the tween and saying "yes" to the dialog box prompt, allowing Flash to convert the target object into an auto-named Movie clip for you.

      The artwork on the first keyframe of the span you want to motion tween should be a symbol or a text box on its own layer, unless you want to let Flash do the dirty work for you and worry about renaming the symbols it adds to your Library later.

      Figure 10.17. The artwork on the first keyframe of the span you want to motion tween should be a symbol or a text box on its own layer, unless you want to let Flash do the dirty work for you and worry about renaming the symbols it adds to your Library later.

  3. Apply a motion tween. There are two ways to do this:

    • Select the target object on the Stage and apply the Insert

      The artwork on the first keyframe of the span you want to motion tween should be a symbol or a text box on its own layer, unless you want to let Flash do the dirty work for you and worry about renaming the symbols it adds to your Library later.
    • Select any frame following the initial keyframe containing the target object and apply a motion tween by using either the contextual menu or the application menu.

      The tween span appears in the Timeline as a blue fill. If the tween has a target object, the initial keyframe is a black (filled) dot; if the tween does not have a target object the initial keyframe is a white (empty) dot.

  4. Scrub the Timeline to any frame within the tween span where you want to modify the target object.

  5. Select the target object and edit it as you would any symbol in your Flash movie — using tools in the Tools panel or settings in the Properties panel. Remember that you can move tweened elements, as well as scale, skew, rotate, or add filters to them. In our example, I wanted the character to glance up and to the side, so I scrubbed to the last frame in the tween span and moved the eye symbol to the final position I wanted the tween to land on and scaled it up to 125 percent (as shown in Figure 10.18). Finally, to give the animation a little more character, I modified the straight motion path by clicking and dragging with the Selection tool to create a slight curve.

  6. After you have a tweened animation working for the first eye and a motion tween span set up for the second eye, select the first eye and use the Copy Motion and Paste Motion commands in the contextual menu to apply the same scale and motion path properties to the second eye tween.

    Modify the features of the symbol that you want to interpolate with a motion tween at any point in the tween span — Flash auto-inserts property keyframes to keep track of the changes.

    Figure 10.18. Modify the features of the symbol that you want to interpolate with a motion tween at any point in the tween span — Flash auto-inserts property keyframes to keep track of the changes.

Modifying motion tween properties

In addition to the changes that you can make to an animated target object on the Stage by using the Selection tool and the Transform panel, there are some specialized options available in the Properties panel when you select a motion tween span (blue shaded frames on a tween layer). These settings can be used to add finesse to an animation after you have your basic motion tween working:

  • Ease: As described previously in the Shape tweening section, Ease settings control the interpolation pattern of a tween. A default setting of 0 interpolates the changes in the motion tween at a consistent rate from beginning to end. Increasing the Ease value (within a range of 1 to 100) makes the change start more quickly and then gradually slow down — creating an ease out. Decreasing the Ease value (within a range of −1 to −100) makes the change start more slowly and gradually speed up — creating an ease in. Easing in works well to build anticipation, and easing out works well to make items settle more naturally at the end of a motion.

    Tip

    As you try different Ease values, you may realize that you want your tween to ease in and ease out, but still move quickly in the middle. Luckily, the Motion Editor enables custom easing control by using a visual curve to map the rate of interpolation in a tween. Using curves to adjust easing anywhere along a tween rather than applying a fixed value on the initial keyframe opens up a whole range of creative possibilities and makes the process a lot more fun. The Motion Editor is discussed later in this chapter.

  • Rotation: You can rotate tweened items with this option. You can set the number of rotations or the degree of rotation. One rotation is equal to 360 degrees — Flash automatically calculates the number of whole rotations when you enter a rotation of more than 360 in the degree field. If you want your target object to do only a partial rotation, enter a value less than 360 degrees. Select a rotation direction from the drop-down menu: None rotates your item in the direction that requires the least amount of motion, while Clockwise and Counterclockwise rotate your item in the indicated direction. In both cases, the rotation is completed as many times as you specify in the Rotate value field or as many times as Flash calculates from the value you enter in the degree field. If you type 0 in the Rotate field, or select None from the drop-down menu, no rotation occurs (other than rotation that has been applied to the symbol with the Transform panel). As shown in Figure 10.19, I applied an Ease out value of 100 to the sample file from the previous section, motionTween, to make the eye motion look more natural.

Note

The 3D Rotation and 3D Translation tools can be applied to a Movie clip in a tween span to convert it into a 3-D symbol. Settings for 3-D symbols can then be modified on the Stage or in the Properties panel.

Warning

Alpha effects and intensive filters in motion tweens slow most fps (frames per second) settings. The only way to make sure that the fps is honored, no matter how intensive the animation might be, is to use a stream sync sound that loops over the course of any critical fps playback. For more on the relationship between streaming sounds and fps rate, see Chapter 12.

Basic options for motion tweens are available in the Properties panel when a tween span is selected in the Timeline.

Figure 10.19. Basic options for motion tweens are available in the Properties panel when a tween span is selected in the Timeline.

  • Orient to path: When your item follows a path (or motion guide), turning this selection on forces the item to orient its movement to that path. I describe this feature in more detail in the section later in this chapter on editing motion paths.

  • Sync Graphic symbols: When this setting is activated on a tween, you can replace the symbol in the first keyframe and it automatically updates in the remaining frames and in any other synchronized keyframes that follow. This setting is also important if your animation is contained within a Graphic symbol. Flash recalculates the number of frames in a tween on a Graphic symbol's Timeline so that it matches the number of frames available on the Main Timeline. Sync ensures that your animation loops properly when the animated symbol is placed in the Main Timeline, even if the frame sequence in the Graphic symbol is not an even multiple of the number of frames assigned to the symbol in the Main Timeline.

Tip

You can tell if a tweened sequence is synchronized by observing that the vertical lines separating the keyframes from the span are not visible when this setting is applied.

Working with motion tween spans and layers

When you apply a motion tween to a target object, the tween span is rendered on a special tween layer — you'll notice that the standard layer icon changes from a simple page to something that looks like a square in motion. If the target object is the only element on the original layer when you apply a motion tween, the layer converts from a standard layer into a tween layer. However, if there are other elements on the original layer, the target object moves to a new auto-inserted tween layer created by Flash. In either case, the tween span occupies the same number of frames in the tween layer as the target object occupied on the original layer. The exception to this rule occurs when the target object occupies only one frame in the original layer, in which case Flash adds enough frames to the tween span to create one second of animation. That is, if the frame rate of your Flash movie is 24 fps, the default length for auto-created tween spans will be 24 frames.

Other elements can be motion tweened on the same span of the Timeline, as long as they are on separate layers (see Figure 10.20). You can interpolate different features on each tween and also apply any control settings (property keyframes or keyframes) that you want — Flash reads and renders the motion on each tween layer independently.

Multiple items can be animated simultaneously by creating tweens on individual layers.

Figure 10.20. Multiple items can be animated simultaneously by creating tweens on individual layers.

Tween layers restrict some authoring options to protect the tween span:

  • Adding graphics: You cannot add additional elements to a tween layer with the drawing tools or the Text tool. If you attempt these actions, a dialog box reminds you that tween layers do not support drawing.

  • Adding symbols: If you paste a symbol or drag a symbol from the Library onto the Stage while a tween layer (with a target object) is active, a dialog box gives you the option of replacing the original target object with the new symbol you are trying to place. Choose OK only if you want to swap the symbols for the duration of the tween.

  • Pasting graphics: If you try to paste a raw shape (including shape primitives or drawing objects) onto the Stage while a tween layer is active, Flash tries to interpret the shape as a motion path. If the shape is anything but a simple stroke with a beginning and endpoint, a dialog box reminds you that the shape is not a valid motion path and cannot be pasted into a tween layer.

  • Adding keyframes: You can add keyframes (F6) and empty keyframes (F7) to a tween layer but only before or after a tween span. Using the Insert Keyframe command from the application menu or the F6 shortcut on a frame within a tween span (the blue shaded frames on a tween layer) actually inserts a property keyframe (marked by a black diamond), locking all properties for the target object to their current value on that frame. This is not a recommended workflow unless you have a special reason for locking all properties on that frame. It's best to rely on Flash to create individual property keyframes as needed when you modify the target object or use the tween layer contextual menu to specify the property you want to keyframe (Insert Keyframe

    Multiple items can be animated simultaneously by creating tweens on individual layers.

As you work with content on tween layers, there are some special workflows that will help you manipulate motion tween spans:

  • Extending animation: A motion tween span can be as short as one frame. Dragging the end of a tween span to the right extends the animation farther along the Timeline, shifting all the property keyframes as needed to keep the flow of the animation consistent. The longer a tween span is, the longer the animation takes to complete, so any motion or change in properties will be slower. Conversely, dragging the end of a tween span to the left shortens the duration of a tween and makes any changes happen more quickly. Keep in mind that the speed of the overall animation is also constrained by the frame rate setting for your Flash movie.

  • Extending a tween span: Holding down the Shift key as you drag the end of a tween span lengthens the tween span without moving any of the property keyframes. This means that the pacing for changes in position or property that you have already established in your animation do not change, but the final state of the target object is visible on the Stage as long as the blue tween span is extended along the Timeline. You can, of course, make additional changes to the target object at any point in the tween, regardless of which method you use to extend the span.

  • Moving a tween span: You can move a tween span by selecting it as a single object and dragging it to a new location on the Timeline — either on the same layer or on a different layer. If you drag a tween span onto a normal layer, it converts into a tween layer. Any existing content in the frames where you place the tween span is cleared and replaced with the animation in the tween span.

  • Replacing a target object: As described earlier, you can drag or paste a new symbol into a tween layer and Flash gives you the option of replacing the current target object. You can also select the current target object and use the Swap Symbol command to choose a new target object from your Library. You can even delete the original target object and then drag or paste a symbol into the tween layer to automatically become the new target object without any fear of "breaking" the tween — another benefit of the new motion tween model over the old classic motion tween.

  • Viewing property keyframes: As you make changes to a target object in a motion tween span, you will see diamond-shaped markers added to the timeline to mark each property keyframe. If you want to control which property keyframes are visible in the span, use the tween layer contextual menu (right-click or Control+click on Mac) to access the View Keyframes submenu. By default, all properties are set to visible. Click any property in the list to toggle it off or back on or use the global settings of All or None.

Editing motion paths

One of the most elegant aspects of the object-based motion tween model is that motion paths are auto-created on the same layer as the target object. Points along the path correspond to frames in the tween span, and the position or shape of the path can be changed at any point in the tween.

Note

This workflow is miles ahead of the classic tween model in previous versions of Flash that required a separate layer for a manually created motion guide and necessitated careful alignment and snapping to keep the tweened object attached to the path.

To create and edit a motion path in a motion tween span, follow these steps:

  1. After setting up a motion tween (as described in the previous section), scrub the Timeline to any frame in the tween span (besides the starting keyframe). If you want the motion to happen over the duration of the tween span, scrub to the final frame in the span. In our example, I moved the playhead to frame 20 and then selected the target object. Select the target object on the Stage and move it to a new X, Y location — use the Selection tool to click and drag or enter new X and/or Y values in the Position and Size section of the Properties panel.

    As shown in Figure 10.21, after you move a target object, a blue line appears, marking the shortest distance between the original location of the target object and the new location of the target object. The dots along this motion path represent the individual frames in the span between the original keyframe and the frame where you moved the target object. The frame where you moved the target object to a new location becomes a position property keyframe.

    The initial keyframe in the motion tween sets the starting position for the target object (left); moving the target object to a new position in any other frame of the tween span creates a motion path and inserts a position property keyframe (right).

    Figure 10.21. The initial keyframe in the motion tween sets the starting position for the target object (left); moving the target object to a new position in any other frame of the tween span creates a motion path and inserts a position property keyframe (right).

    Warning

    If you move the target object at a frame in the middle of the span and then decide you want to move it again in a frame farther along the span (or farther back), just keep in mind that any frames where you move the target object become position property keyframes. These are visible in the Timeline and on the motion path as diamond-shaped markers. If you prefer to enable Flash to interpolate the motion evenly from beginning to end within a tween span, remove any interstitial position property keyframes and work with the motion guide or the easing curves to create the motion pattern you want between the initial keyframe and the final frame in the tween span. If you leave in a series of random position property keyframes, you may find that your animated motion lags or speeds up unexpectedly in different sections of the motion path.

  2. Scrub the timeline to preview the motion as the object follows the path. If you are happy with the motion, you're finished! If you like to change the route that the target object takes, the motion path can be modified with the Selection tool or the Subselection tool. In our example, I clicked and dragged the motion path to add a large curve for the target object to follow. As shown in Figure 10.22, this new path is longer but there is still the same number of frame markers (round dots) along the path — equal to the number of frames between the first keyframe and the final position property keyframe in the tween span.

    The motion path can be modified with the Selection tool (left) to change the route that the target object takes between keyframes within the tween span (right).

    Figure 10.22. The motion path can be modified with the Selection tool (left) to change the route that the target object takes between keyframes within the tween span (right).

    Note

    You might notice that the motion path is actually a Bezier path, and you can use the Subselection tool and the Pen tool to modify control points and handles to adjust the curves and angles in the motion path just as you would any other stroke. The white squares that mark position property keyframe changes along the motion guide when the line is selected with the Pen or Subselection tool are cubic Bezier anchor points; these can be used for controlling the shape of the line. The smaller round dots along the line mark all the "normal" frames in the span and cannot be used as control points for changing the shape of the line unless you convert a frame into a property keyframe (by manually changing the position of the target object on that frame). Refer to Chapter 5 if you need information about working with Bezier controls.

  3. If you want to move the whole path (and the target object) to a different location on the Stage, click (and release) to select the path and then click and drag it to a new location. This is different than clicking (and not releasing) the mouse to drag the path in order to change its shape.

    You can delete the path at any time and the position property keyframes are deleted along with the motion path. You can also copy and paste the path if you want to reuse it or have multiple items follow the same path on different tween layers.

Adding control to animation along a motion path

Even after you have succeeded in modifying a motion path in a tween span, you may find that the movement of the animated element is not exactly as you would like. Fortunately, you can modify how a target object follows a motion path in a few different ways.

Using Orient to path

The first control to consider is found in the Properties panel when the first keyframe of your motion tween is selected. The Orient to path check box (shown in Figure 10.23) creates property keyframes on every frame of the tween to track changes in rotation (z-axis), helping the target object stay oriented as it follows a curved path and keeping it headed along the path. When Orient to path is not active, an animated item maintains the same orientation throughout the tween, with no relation to the curves or loops in the path.

By default, a tweened item maintains the same orientation as it moves along a curved path (left). Selecting Orient to path keeps an animated item headed along the curves or loops in a motion path (right).

Figure 10.23. By default, a tweened item maintains the same orientation as it moves along a curved path (left). Selecting Orient to path keeps an animated item headed along the curves or loops in a motion path (right).

Registration and center point alignment

The second important factor that determines how an animated element moves along a motion path is where the registration point of the symbol is located. By default, the registration point is generally at the center of the symbol, but this may not be the point of the item that you want to snap to the path. To modify the alignment of a target object, you can modify the registration point of the symbol (see Figure 10.24).

To modify the registration point of a tweened symbol on a motion path, follow these steps:

  1. Select the symbol on the first keyframe of the tween.

  2. Activate the Free Transform tool in the Toolbox, and drag the registration point (small white circle icon) to a new location. You'll see the motion path move to snap-align to the new registration point on the target object. You may have to select the motion path and move it back into position in relation to the Stage or artwork on other layers, but the target object also moves and the new registration point remains locked to the path.

When Free Transform is active, you can modify the registration point that defines how a target object tracks along a motion path without changing the alignment of the artwork in relation to the symbol center point.

Figure 10.24. When Free Transform is active, you can modify the registration point that defines how a target object tracks along a motion path without changing the alignment of the artwork in relation to the symbol center point.

Working with motion presets

As many of us had to learn the hard way, animation is not as easy as it looks. Something as simple as a bounce or a dimensional zoom requires attention to timing and scale — and if the animation is going to have any dimension or character, physical properties of weight and density need to be conveyed as the object moves or reacts to other elements in the scene. Although experienced animators can create believable motion without breaking a sweat, this can be a tall order for even the most skilled graphic designer or programmer. In an attempt to make the learning curve a little less steep, Adobe has included a collection of starter animation presets. These ready-made object-based motion tweens can be previewed and applied from the Motion Presets panel (Window

Working with motion presets

To apply a Motion preset, follow these steps:

  1. Open the Motion Presets panel (shown in Figure 10.25). Preview animation by selecting any presets listed in the Default Presets folder (or any other folder if you have loaded or saved custom presets of your own).

  2. Select a tweenable target object on the Stage (on its own layer) and click the Apply button in the Motion Presets panel. If the object you have selected is not a Movie clip or a Graphic symbol or a text field, a dialog box reminds you that the object must be one of these element types before the motion preset can be applied.

    The motion preset creates a tween by using your selected object as the target. You can scrub the Timeline to preview the result (or use the Test Movie command). The tween span, property keyframes, or motion path applied to your target object by the motion preset may not align as you expect with your Stage size or elements on other layers — that's why these are considered animation starter files.

Warning

If you apply a motion preset and then decide to remove it, using the Remove tween command removes the tween span from the Timeline, but property changes applied to the target object may still "stick." You can use the Properties panel to remove filters or color effects or other changes made to your target object by the motion preset, but this can be a little tricky to dig through. Another option is to use the Undo command rather than the Remove tween command to get rid of any changes the motion preset made.

The Motion Presets panel

Figure 10.25. The Motion Presets panel

You can modify the animation created by a motion preset in the same way you would modify any other motion tween. If you end up with a customized result that you want to save and use again, simply select the tween span or the target object and use the contextual menu to choose Save as Motion Preset. You can also click the page icon at the bottom of the Motion Presets panel to save your selected tween as a preset. Motion presets are stored as XML files in the following directory locations:

  • Windows: HDDocuments and Settings<user>Local SettingsApplication DataAdobeFlash CS5<language>ConfigurationMotion Presets

  • Mac: HD/Users/<user>/Library/Application Support/Adobe/Flash CS5/<language>/Configuration/Motion Presets/

Motion preset XML files can also be exported or imported, using the Motion Presets panel.

Note

For more detailed information about working with custom motion presets, including how to create a preview for a custom XML file, refer to Adobe Help: Using Flash CS5 Professional

The Motion Presets panel

Note

If you are working with classic tweens, the Copy Motion and Paste Motion commands can be a helpful shortcut for reusing animation patterns. These commands can be found in the contextual menu when a tween span is selected, or in the Application menu under Edit

The Motion Presets panel

Adjusting Easing and Tween Properties with the Motion Editor

Custom easing curves can be created and manipulated in Motion Editor panel. The panel is docked for tabbed access with the Timeline panel when you load the Essentials Workspace, or you can add it to any Workspace layout by choosing Window

Adjusting Easing and Tween Properties with the Motion Editor

This panel may be a little intimidating when you first open it, but keep in mind that you don't really need to use this panel unless you want to fine-tune the animation you've already created with other Flash tools. You can think of the Motion Editor as the engine room: If everything is going smoothly up on deck and you are happy with the way the animation is running, there's really no need to go down below and get your hands dirty. On the other hand, if you like to see how things work, the Motion Editor does a great job of laying out all the changes that happen in a tween span so that you can analyze it in frame-by-frame and property-by-property detail.

The Motion Editor panel displays the property values for property keyframes in a selected motion tween span. Individual values can be modified, using hot text controls or tweening curves.

Figure 10.26. The Motion Editor panel displays the property values for property keyframes in a selected motion tween span. Individual values can be modified, using hot text controls or tweening curves.

You can modify the individual curves of any of these properties should you want them to be rendered at a different pace to create a custom tween effect:

  • Basic motion: This section groups together the X, Y, and Z (rotation) values for the target object. Because these properties are always related (a target object always has an X, Y, and Z value to locate it on the Stage), their property keyframes have to match up and they have some special editing rules that other properties don't have:

    • You can add or remove control points on the tween curves for these properties, but you cannot modify them with Bezier controls.

    • To toggle interstitial keyframes in a tween span for these properties from roving to non-roving, use the contextual menu or drag a roving keyframe to a vertical frame divider to make it non-roving.

    • It is best to edit the basic motion of a target object by working directly with the motion path on the Stage. The Motion Editor can be helpful for moving property values to new frames in the tween span or for setting exact pixel values for the target location in some property keyframes.

    Note

    Roving keyframes enable Flash to render motion more smoothly by shifting keyframes as needed over the span of a tween. Non-roving keyframes lock specific X, Y, and Z values (or target object positions) to specific frames within a tween span.

  • Transformation: This section groups together the Skew and Scale properties for both the x and y axis of the target object. Any differences in size or skew between the target object in the initial keyframe and the last property keyframe of a tween span can be interpolated at different rates.

  • Color Effect: You can control any color changes from one property keyframe to the next in a tween by editing the tween curve. You can add color effects to a target symbol by using the submenu in the Motion Editor or by using the settings in the Properties panel.

  • Filters: If filters have been applied to create changes in an item's appearance in the span of a tween, the pattern of change can be adjusted with custom easing. Filters can be added to a target symbol from the submenu in the Motion Editor or from the Properties panel.

Tip

To link X and Y value pairs so that they always match when changes are made to either property, click the Link X and Y Property Values button (to the left of the Ease menu) for either property.

In most cases, you only need to create custom tween curves for one or two properties to achieve a very polished final result. The possibilities can be a little overwhelming at first and the flexibility of custom easing curves might work against you: As you modify the curves in myriad ways, it can be difficult to keep track of which curves work best for specific effects. Fortunately, a few tricks can help as you experiment:

  • Use the Properties panel controls first because these are a little less complicated. The settings you apply with the Properties panel are translated into curves that you can use as a starting point when you shift over to the Motion Editor.

  • Copy and paste patterns from one property to another if you have created a tween curve that you like and you want another property to progress in the same pattern. Right-click (or

    The Motion Editor panel displays the property values for property keyframes in a selected motion tween span. Individual values can be modified, using hot text controls or tweening curves.
  • To reverse the direction of a property tween, select the graph area and choose Reverse Keyframes from the contextual menu.

  • If an individual curve gets too complicated or you change your mind, just use the contextual menu in the graph area to choose Reset Property.

  • Use the Reset Values button for the category to reset all the curves for a section of properties in the Motion Editor to non-tweened values.

Controlling property views in the Motion Editor

As in the Properties panel, you can control what property values are visible in the Motion Editor by expanding and collapsing sections of the panel with the property layer controls. When a property layer arrow is twirled down, the property name, value setting (for current position in the tween span), Ease setting (if any), and visual tween curve (plotted across the frames of the current tween span) are all visible. To facilitate editing in the tween curve area of the panel, you can click any expanded layer a second time to expand the layer view even farther. The number of frames visible in the tween curve area and the height of expanded and collapsed layers can be modified with the Grid display controls (bottom-left corner of Figure 10.26) to suit your screen size (or eyesight):

  • Graph size: Sets the minimum height of the layers in the graph for collapsed layers. Can be set in a range between 20 pixels and 20 pixels less than the current setting for Expanded Graph size.

  • Expanded Graph size: Sets the maximum height for expanded layers in the graph. Can be set in a range between 20 pixels more than the current (collapsed) Graph size and 500 pixels. I found 200 to be a good working size.

  • Viewable frames: Zooms in and out of the current tween span to show a set number of frames in the curves area of the panel. The range is from 1 frame to the total number of frames in the currently selected tween span.

Warning

Patterns in your tween curves and eases can be hard to see in the Motion Editor if you are zoomed in too close to the tween span. It helps to zoom out and get oriented by pushing the number of viewable frames up to show your complete tween span before zooming in again, if needed, to focus on a more limited number of specific frames. The timeline only shows numbers every fifth frame, so it becomes more useful as a navigation aid when you look at ten or more frames at a time.

Editing tween curves and property key frames

The tween curves in the Motion Editor track changes in object properties over the life of your tween span. Most properties can be modified independently from frame to frame (changes can be locked in by using a property keyframe or they can be interpolated in a curve from one control point to the next). Tween curves can be edited in a similar way to strokes (or motion paths), using the Selection tool or the Pen tool:

  • Drag control points left or right to set a property value at a specific frame in the tween span. Dragging a control point left sets the value sooner in the tween, and dragging it right sets it later in the tween.

Warning

Dragging a control point past other control points on the same property curve clears those points.

  • Increase a property value by dragging a curve or control point toward the top of the grid. Decrease a property value by dragging a curve or control point toward the bottom of the grid.

  • Add or Remove control points by moving the playhead to the frame you want to edit and using the Add or Remove Keyframe button in the Motion Editor (yellow diamond icon between next and last keyframe buttons).

    Tip

    You can also use the contextual menu to add or remove control points as well as using shortcut keys with the Selection tool: Ctrl+click/Option+click on an empty area of the curve to add a point, or on an existing point to remove it.

  • Curves with smooth points can be adjusted with Bezier handles. To toggle a control point between corner and smooth modes, Alt+click/

    Editing tween curves and property key frames

Tip

To adjust a specific curve point, you can also use the contextual menu to choose Smooth Point, Smooth Right, Smooth Left, or Corner Point.

Eases and custom eases

Although tween curves and eases appear on the same grid, they are edited differently. Tween curves are generated when you make any changes to a tweened property, and they enable you to edit the curve directly to adjust the rate of change for a specific property at any time. Eases are preset interpolation patterns that enable you to control the percentage of change that happens in each section of a tween span; you can also think of this as the pattern of the change. Easing is applied only if you want the rate of interpolation for a specific property (or all tweened properties) to change over the span of a tween. If you want the interpolation to be spread evenly on all frames that come between one property keyframe and the next, you don't have to add any easing.

Eases are managed in the Eases section at the bottom of the Motion Editor and applied by using the Ease menu for each property layer (shown in Figure 10.26). As discussed in the Animation Strategies chapter of this book, animation relies heavily on physics and the laws of the natural world. For this reason, Adobe was able to anticipate some of the ease patterns that you might find most useful and include them in the Eases submenu (available when you click the plus icon (+) at the top of the Eases section of the Properties panel). Any eases that you add to the Eases section of the Motion Editor are available in the Ease menu for each property in the layers above. For Figure 10.26, I added just two of the ready-made eases that ship with Flash CS5 to the Eases section of the panel to give you an idea of how different these patterns can be. I also applied the Bounce pattern to the tween for the Y value of the Basic motion property so that you can see how the dotted ease pattern overlays the original tween curve.

It takes some practice to get the feel for using easing curves to control tweens, but I'm sure you can already see how many more options for different styles of motion you'll have if you use easing:

  • Diagonal lines continue in an even motion. The more closely the percentage of change matches the progression in frames, the more even the transformation will be. (Try any of the Simple eases.)

  • Gradual curves can add smooth acceleration or deceleration. A reverse curve that creates gradual slopes at the beginning and end as well as a steeper pitch in the middle creates an Ease In/Ease Out effect. (Try the Stop and Start ease or the Sine Wave ease.)

  • Bumps in a curve can add a stuttering motion. For example, if an anchor point at the frame 10 marker is set at the 50% change line and you add an anchor point at the frame 15 marker that is set to pull the curve back down to the 25% tween line, you cause the tween to progress and then reverse and then progress again at a quicker rate to reach 100% transformation by the last frame of the tween. (Try the Bounce ease or Sawtooth Wave ease.)

  • Flat (horizontal) lines add pauses. The frames continue, but the percentage of change is forced to plateau or hold at a specific point of transformation. (Try the Square Wave ease or Random ease.)

  • Vertical lines create quick jumps. The percentage of change has to increase, but it doesn't have any frames to gradually make the change. (Try the Square Wave ease or the Random ease.)

Warning

You can add or delete eases at any time, but keep in mind that removing an ease from the Eases section of the Motion Editor also removes it from any property layer that you've applied it to.

After you add an ease to a tween property, you can still edit the tween curve (either in the Motion Editor or by making changes to the target object on Stage or in the Timeline), and the ease curve responds, but it keeps its basic shape. Ease curves can be modified in the Eases section of the Motion Editor by changing the hot text values within the allowable range for each ease pattern: Patterns with one long curve enable you to push the pattern from one end of the tween to the other and flip the pattern by changing the value from negative to positive (making it an ease in or an ease out), while repeating patterns with discrete sections joined by corner points enable you to set the number of repeating sections in the pattern.

Tip

If you set easing for a tween span in the main Properties panel, the value of Ease In or Ease Out that you apply renders in the Motion Editor as a Simple(Slow) curve, and the value applies to all tweened properties. This is a good way to get an idea of how the visual curve relates to the standard easing values.

If you need to go beyond the ease patterns that ship with Flash CS5, you can select the Custom option at the bottom of the Add Ease menu in the Motion Editor. This adds a Custom layer in the Eases section with an editable (solid rather than dotted) line loaded in the graph area. You can use the Selection or Pen tool to modify this line with Bezier handles or by adding additional curve or corner points. Custom patterns are available in the Ease menus for any of the property layers, and changes that you make to your patterns update on any layers that you've added them to.

Tip

You can add as many custom ease patterns to the Motion Editor as you need to — they will all have the same name, but they will also be numbered in the order that you added them so you can tell them apart. Custom eases are saved with your Flash project file but do not carry over from one file to the next (unless you do some copying and pasting from file to file or use motion presets to save your animation along with any custom eases).

As with anything else, it pays to start simple. Experiment with changing the ease curve of one property, and if you get something you like, copy it to a new custom ease layer before you move on with another modification. If a curve works great to create an interesting effect on one property, try applying it to something else. Before long, you will have a library of files with cool tween patterns that you can copy and paste from, instead of having to re-create a curve from scratch each time.

Animating 3-D properties

I describe the process for working with 3-D symbol properties in Chapter 9, but you can take this feature a step farther and animate the changes you make to 3-D position or rotation. If you have already created a 3-D symbol on the Stage by applying the 3D Rotation (W) or 3D Translation tool (G) to a Movie clip, you can use the 3-D symbol as a target object for a motion tween. Changes made to the target object on the Stage by using the 3-D settings or tools create property keyframes that are interpolated in the tween span and displayed in the Motion Editor along with other properties.

A great way to get started with 3-D animation is to try one of the motion presets that tween 3-D properties. After you apply a motion preset (as described earlier in this chapter), you can modify any of the settings or curves in the Motion Editor. I used the motion preset for 3D Rotation ("spiral-3D" from the Default Presets folder in the Motion Presets panel) as a starting point in our example file. This motion preset animates the target object around the z-axis, but the final result is that the object ends up looking backward in the end frame of the tween, as shown in Figure 10.27.

To create a more seamless looping animation, I used two different approaches:

  • In the 3D_rotationRepeat.fla file, I made the animation look as though the graphic is rotating 180 degrees to face backward and then rotating the opposite direction to face forward again. I did this by inserting a control point on the Rotation Y tween curve, setting the value on the new property keyframe to 180 degrees, and then changing the value in the final property keyframe to 0 degrees. As shown in Figure 10.28, the resulting tween interpolates the rotation from 0 degrees to 180 degrees and then back from 180 degrees to 0 degrees. The animation is faster because the graphic rotates forward and then backward through the 180-degree arc within the same number of frames, but you can always extend the tween farther along the Main Timeline to give the animation more time.

    The spiral-3D motion preset tweens the Rotation Y property for the target object from 0 degrees to 180 degrees over a span of 50 frames. In the final frame of the tween, our target object is backward. When the tween loops, the object "jumps" back to its proper orientation when the playhead returns to the initial keyframe in the tween.

    Figure 10.27. The spiral-3D motion preset tweens the Rotation Y property for the target object from 0 degrees to 180 degrees over a span of 50 frames. In the final frame of the tween, our target object is backward. When the tween loops, the object "jumps" back to its proper orientation when the playhead returns to the initial keyframe in the tween.

    Tip

    The same effect I created by modifying the curve for the Rotation Y property can be achieved on animation with multiple property changes, or even on frame-by-frame animation sequences by editing the Main Timeline. Copy the whole tween span and place the copy farther down the Timeline on the same layer to follow seamlessly after the first tween. A shortcut for creating a copy of a tween span is to hold down the Alt (Option) key while dragging the span to a new location, and then use the contextual menu to choose Reverse Keyframes on the copied span. Repeating and reversing a tween span is almost always a good way to get a seamless looping animation and to avoid a "blip" at the end of your sequence when the position in the final frame of a tween jumps back to the starting position at the beginning of the span. Having a tween run forward and then run backward before returning to the beginning of the span creates a seamless transition.

    Creating a repeating pattern in a tween curve with matching values in the final property keyframe and the initial tween keyframe creates a smooth transition for looping animation.

    Figure 10.28. Creating a repeating pattern in a tween curve with matching values in the final property keyframe and the initial tween keyframe creates a smooth transition for looping animation.

  • In the 3D_rotationFlip.fla file, I inserted a property keyframe halfway through the tween (when the target object was approximately 90 degrees along the z-axis or "sideways" to the viewer) and applied a vertical flip to the graphic (Modify

    Creating a repeating pattern in a tween curve with matching values in the final property keyframe and the initial tween keyframe creates a smooth transition for looping animation.
    Flipping the target object on the Stage resulted in a tweened curve interpolating the change in the Scale X property from 100 to −100 over the first half of the tween span.

    Figure 10.29. Flipping the target object on the Stage resulted in a tweened curve interpolating the change in the Scale X property from 100 to −100 over the first half of the tween span.

  • The solution is to force the flip to happen in just one frame instead of tweening it over all the frames in the first half of the span. This is accomplished by using two property keyframes side by side in the Timeline with an X-scale of 100 in the first keyframe (or no flip) and an X-scale of −100 in the second keyframe (or full flip). You can either make these changes directly to the target object on the Stage by using the Transform panel to modify the X-scale value on two frames somewhere around the center of the tween span, or you can open the Motion Editor and modify the tween curve for the Scale X property in the Transformation section of the panel. Insert a new control point just before the control point that flips the graphic, and then move the new control point up to keep the curve flat (no transformation) for the first half of the tween span, with a sharp drop from +100 to −100 over just one frame, as shown in Figure 10.30.

    Inserting a new control point on the curve enables us to force the change in Scale X value to happen over just one frame instead of interpolating it over the first half of the tween span. Adding and shifting the control point on the curve is equivalent to adding a property keyframe and forcing the Scale X value to its original value in the frame just before the frame that changes it to −100.

    Figure 10.30. Inserting a new control point on the curve enables us to force the change in Scale X value to happen over just one frame instead of interpolating it over the first half of the tween span. Adding and shifting the control point on the curve is equivalent to adding a property keyframe and forcing the Scale X value to its original value in the frame just before the frame that changes it to −100.

Note

To see the original animation created by applying the motion preset for 3D Rotation, open 3D_rotation Preset.fla from the 3DTween subfolder in the ch10 folder on the CD. Compare the original with the modified files, 3D_rotationRepeat.fla and 3D_rotationFlip.fla, found in the same folder.

Although describing these changes takes up a lot of page space, it really is just a couple of quick editing steps, and you can see how much time is saved by using motion presets and the Motion Editor rather than creating animation from scratch. The key to success when working with animation (2-D or 3-D) is to first understand the individual properties and how changes in their value modify the appearance of your target object. Testing property changes first by using a nonanimated target object enables you to plan the key positions in your animation. If you then work with the Motion Editor, you will have a better idea of which curves you need to modify and the values to enter on property keyframes to get the animated result you are hoping for. If you know where you want to start and how you want to end, Flash does a pretty great job of figuring out all the steps in between to render smooth animation.

Integrating Multiple Animation Sequences

So far in this chapter, I've looked at creating different types of animation on the Main Timeline. Adding multiple tweens to the Main Timeline can soon result in a jumble of colored spans and keyframes that might be hard to navigate when you need to make edits. Authoring all animation sequences on the Main Timeline also puts you at risk of unintentionally displacing multiple sequences as you make edits.

The best solution for keeping your project (.fla) files manageable as you continue to add animation is to move animation sequences off the Main Timeline and organize them instead on individual symbol timelines. This makes it much easier to move or reuse animation and also ensures that any edits you make to individual animation sequences do not disrupt sequences on other symbol timelines. Graphic symbols and Movie clip symbols can both be used to hold multiple layers of animation, but they have different uses.

As I discuss in Chapter 6, all symbols have their own timelines, so you could just as easily store an animation in a Graphic symbol as in a Movie clip. However, there are some important differences to keep in mind:

  • A Graphic symbol timeline must still be tied to frames on the Main Timeline, while a Movie clip timeline plays back independently, regardless of how many frames it is assigned on the Main Timeline.

  • The benefit of using a Graphic symbol to store an animated sequence is that it can be previewed frame by frame directly in the authoring environment, even if it is nested. You can preview animation on a Movie clip timeline in Edit mode, but you cannot see how the animation on the Movie clip timeline syncs with animation on other symbol timelines or with the Main Timeline until you publish the movie or use the Test Movie command.

  • Another significant limitation of Graphic symbols is that they cannot be targeted with ActionScript. Movie clip symbols can be targeted with ActionScript to control the playback of each symbol instance independently, as opposed to having all animation tied to frame sequences on the same (main) timeline.

The extent to which you separate and nest animated elements depends on the complexity of the project and also on how you intend to reuse animation. In general, any elements that will always be linked together on playback can be stored in the same symbol. If you want to have the option of altering playback speed or placement of certain elements independently, then these should be stored in discrete symbols. For example, if you have an animated logo that may be used in a project separately from an animated title, then these two elements should be in individual symbols. On the other hand, if the logo always appears in the same way with the title, then these two elements can be stored in a single symbol (on separate layers, if necessary).

Tip

It is always possible to use the Properties panel to change the behavior (or symbol type) of a symbol instance on the Stage. If you are working with multiple Movie clips and you need to sync some parts of the animation, it can be helpful to temporarily assign a Movie clip instance Graphic symbol behavior so that you can see the animation on its timeline in the main authoring environment. Don't forget to switch the instance back to Movie Clip behavior before you publish your movie.

Moving tweens onto symbol timelines

Certainly, it is more efficient to plan your project structure before you begin adding animation so that you can nest animation in symbols as you create the project, but Flash is flexible enough to enable you to optimize the organization of your animation sequences even after you have strewn them around on the Main Timeline.

To illustrate how tweens are moved from the Main Timeline to symbol timelines, I will modify a file called tweensTimeline.fla, which includes layers with shape tweens, motion tweens, and classic motion tweens keyframed on the Main Timeline.

Note

I have included two files in the Integrate subfolder of the ch11 folder on the CD-ROM for you to refer to: the original tweensTimeline.fla with tweens on the Main Timeline, and the modified tweensNested.fla with tweens moved onto symbol timelines.

To reorganize a file (.fla) that has animation built on the Main Timeline, follow these steps:

  1. Analyze the Main Timeline carefully to see how the various animated sequences need to relate to each other in the final SWF file. Decide which frame spans and layers you need to keep tied together and which should be independent.

  2. Pay close attention to how the transitions between different animated sequences are handled on the Main Timeline. If two different phases of a tween share a common keyframe (for example, if you have scaled an element in one tween and then rotated the same element in a span that continues from the final keyframe of the first tween), you must keep these tweens together or else insert an additional keyframe before you separate them in order to keep both tweens intact.

    Tip

    Object-based tween spans that follow each other on the same tween layer can simply be selected and dragged to move apart from each other; Flash automatically inserts a blank keyframe to hold the space between the two tween spans on the Timeline.

    Tip

    To be certain that linked sequential tweens can be separated without getting messed up, it can be helpful to add two manually inserted "divider keyframes" at the point that you want to split the tween: You can remove the tween from the first divider keyframe, leaving the second divider keyframe (F6) to maintain the beginning of the tween that follows. This ensures that there is no interpolation between the end keyframe of the first tween and the start keyframe of the second tween.

  3. Select the span or Shift+select the beginning and end keyframes of the sequence that you want to move off the Main Timeline. Clicking the layer icon also selects all frames and tween spans on a layer.

  4. With all frames in the sequence selected, choose Copy Frames from the contextual menu (see Figure 10.31) or Edit

    Moving tweens onto symbol timelines
    You can select frame spans on multiple layers to move at one time. Be sure to use Copy Frames rather than simply Copy to move all the frames to the Clipboard.

    Figure 10.31. You can select frame spans on multiple layers to move at one time. Be sure to use Copy Frames rather than simply Copy to move all the frames to the Clipboard.

  5. Create a new symbol by choosing Insert

    You can select frame spans on multiple layers to move at one time. Be sure to use Copy Frames rather than simply Copy to move all the frames to the Clipboard.

    After you click OK to close the Create New Symbol dialog box, the symbol automatically opens in Edit mode — you will see the symbol timeline rather than the Main Timeline in the Timeline window.

    In the Create New Symbol dialog box, select a symbol type and enter a meaningful name for your new symbol.

    Figure 10.32. In the Create New Symbol dialog box, select a symbol type and enter a meaningful name for your new symbol.

  6. Select the first frame of the symbol timeline and choose Paste Frames from the contextual menu, as shown in Figure 10.33. Or choose Edit

    In the Create New Symbol dialog box, select a symbol type and enter a meaningful name for your new symbol.

    Flash automatically inserts enough layers and frames to accommodate the content you paste into the symbol timeline (see Figure 10.34). Your animation sequence is now stored inside the symbol, and you can easily access it from the Library for reuse or editing.

    Create as many new symbols as you need to hold all the individual animation sequences that you want to work within your project. When you are finished, you should have a set of easily identifiable named symbols in your Library containing animated elements that are now efficient to edit or reuse.

    Note

    You may notice that there are two consecutive motion tween spans on the tween layer for the starAnim sequence. Although these could have been integrated into one tween span by working with property keyframes and curves in the Motion Editor, I opted to leave them separate so that I could reuse the Movie clip that contained the animation of the star spinning without the animation of it falling.

    Select the first frame in your new symbol timeline and use Paste Frames to insert the frames and layers from the Clipboard.

    Figure 10.33. Select the first frame in your new symbol timeline and use Paste Frames to insert the frames and layers from the Clipboard.

Organizing symbol instances on the Main Timeline

In the previous section I suggested copying your animation sequences from the Main Timeline to be pasted into individual symbol timelines — even though this results in redundant content. The rationale for leaving the original sequences on the Main Timeline rather than cutting them as you move content into separate symbols is that they provide a useful reference for where the symbol instances should be placed on the Stage and how they should be arranged on the Main Timeline. The simplest way to "rebuild" your animation, using the nested symbols you have created, is to insert a new layer for each symbol on the Main Timeline directly above the original sequence that was copied. As you drag each symbol instance onto the Stage, you can align the artwork with the original sequence on the Stage and also determine how many frames the symbol should occupy on the Main Timeline.

When you use Paste Frames to place the content from the Clipboard into your symbol, layers and keyframes are preserved.

Figure 10.34. When you use Paste Frames to place the content from the Clipboard into your symbol, layers and keyframes are preserved.

Using the example from the previous section, I show you how to replace the tweened sequences on the Main Timeline with nested symbol instances:

  1. Insert a new layer on the Main Timeline directly above the original tweened sequence by selecting the original layer and using the New Layer button in the Timeline window or choosing Insert

    When you use Paste Frames to place the content from the Clipboard into your symbol, layers and keyframes are preserved.

    Warning

    Check the labels above the Timeline to be sure that you are editing the Main Timeline (Scene 1) and not one of the named symbol timelines. If there are any names listed in the crumb menu to the right of Scene 1, click the back arrow or the Scene 1 label to return to the Main Timeline before you start placing symbol instances on the Stage.

  2. Drag an instance of your nested animation symbol from the Library onto the Stage in the new layer and align it with the content on the other layers (see Figure 10.35).

    Tip

    Use the Lock Others command to protect content on your original layers while you drag and position the symbol instance on your new layer. Your keyboard arrow keys can be helpful for "nudging" an item into final alignment if dragging is not precise enough.

    The original animation layers can help you to sequence and visually align the new symbol instances as you rebuild your project.

    Figure 10.35. The original animation layers can help you to sequence and visually align the new symbol instances as you rebuild your project.

    After you finish placing the new symbol instance in the Main Timeline, you can delete the layers containing the original tweened sequences (which are now redundant). You will quickly see how much cleaner and easier to modify the Timeline becomes when the tweened and frame-by-frame sequences are replaced with nested symbol instances, as shown in Figure 10.36.

    The Main Timeline becomes easier to manage as you replace the tweened and frame-by-frame sequences with nested symbol instances.

    Figure 10.36. The Main Timeline becomes easier to manage as you replace the tweened and frame-by-frame sequences with nested symbol instances.

In the previous example, I moved the timeline animation sequences to Graphic symbol timelines to make it easier to preview the animation on the Main Timeline. However, in most production contexts, it is best to use Movie clip symbols to hold animation because instances of Movie clips can be targeted with ActionScript. Also, Movie clip timelines loop independently of the Main Timeline, so you can repeat an animation sequence as many times as you want, either by holding on a single frame of the Main Timeline or by extending the span of the Movie clip so that it remains visible as the Main Timeline continues to play. In the next section, I work with Movie clip symbol instances to demonstrate how to reuse animated symbols and how to add some variation to the instances.

Reusing and Modifying Tweened Symbol Instances

Cleaning up the Main Timeline is one good reason to move animation onto symbol timelines. An even better reason is to make it easier to reuse and modify instances of the animated symbols after you have them stored in your Flash Library.

In the our example file, I have placed multiple instances of a Movie clip on a layer in the Main Timeline to create some animated background elements (see Figure 10.37).

Movie clips make it easy to use multiple instances of an animated element.

Figure 10.37. Movie clips make it easy to use multiple instances of an animated element.

As discussed in previous chapters, you can modify the appearance of symbol instances without having to edit the contents of the original symbol. This can be helpful when you are working with static elements, but it really becomes indispensable when you are working with animated elements. Imagine the time it would take to copy and paste a series of tweens or a frame-by-frame sequence on the Main Timeline and then to edit the artwork on each keyframe just to change the scale or the color of your animated element each time you want to use it. Now be very happy that the little extra time spent moving your animated sequences off the Main Timeline and into symbols makes it possible to drag and drop your animated elements and then to scale, rotate, or apply filters or color effects to get endless variations without ever having to edit the original keyframe artwork.

Note

I have included the original and the modified version of our example file so that you can see how the symbol instances were changed — compare tweensModify_start.fla and tweensModify_final.fla in the Modify subfolder in the ch11 folder of the CD-ROM.

In our example (see Figure 10.38), I have modified the appearance of some of the animated stars by transforming instances of the original starSpin Movie clip.

By transforming symbol instances, you can add almost endless variation to the appearance of your animated sequences without having to modify any keyframe artwork.

Figure 10.38. By transforming symbol instances, you can add almost endless variation to the appearance of your animated sequences without having to modify any keyframe artwork.

The beauty of symbols is that you always have the option of modifying the appearance of individual symbol instances or making global changes by modifying the artwork in your original symbol. If you decide that an element should be changed every place that it appears, editing the original symbol is much quicker than modifying all the symbol instances individually.

Tip

If you decide that you want to keep the static shape, but not the animation or the link to the original symbol in the Library for some of the symbol instances you have placed on the Main Timeline, you can use Modify

By transforming symbol instances, you can add almost endless variation to the appearance of your animated sequences without having to modify any keyframe artwork.

You can use ActionScript to control the playback of each element independently of the Main Timeline. For example, instead of stopping everything on the Main Timeline, you can place a stop() action on the starSpin symbol timeline to hold the animation of the stars while the other elements continue to play (as shown in Figure 10.39, top). Any ActionScript placed directly on the symbol timeline applies to all instances of the symbol. If you are working with Movie clip symbols, you have the additional option of naming individual symbol instances and targeting them with ActionScript placed on a keyframe in the Main Timeline (as shown in Figure 10.39, bottom). This method enables you to stop the animation on some stars, while letting others continue to spin as the animation on the Main Timeline plays.

Note

To see the difference between adding ActionScript directly to a symbol timeline to stop all instances and targeting a specific named symbol instance with ActionScript on the Main Timeline, compare stopSymbol.fla (or .swf) with stopInstance.fla (or .swf).

ActionScript can be added to symbol timelines (left) or used to target symbol instances (right) to control the playback of animated elements, independent of the Main Timeline.

Figure 10.39. ActionScript can be added to symbol timelines (left) or used to target symbol instances (right) to control the playback of animated elements, independent of the Main Timeline.

Note

For more information about controlling symbol timelines and symbol instances with ActionScript, refer to Part V, "Adding Basic Interactivity to Flash Movies."

Creating IK Armatures with the Bone Tool and Bind Tool

Inverse Kinematics or IK is an animation technique that is familiar to anyone who has worked with more specialized character animation or modeling programs. Instead of animating the individual parts of an object as isolated elements, IK creates relationships or links between elements so that the movement of one element affects the movement of other related elements. The classic example of this is a hand moving while connected to a wrist, which is also connected to an elbow, and then to a shoulder. Each distinct part of the structure can initiate movement, but as one part moves, the other parts of the structure stay connected to it and move accordingly. This example is consistent with the behavior of IK bones in Flash because the bones do not bend, but the joints between the bones enable the shape to move in almost any direction, subject to the varying limitations in rotation and movement of each joint. For example, the shoulder joint can move quite freely in a circular motion but it can't easily change its position in space (unless the torso moves), while the elbow joint has a more limited range of rotation but a greater freedom of movement in space.

If you have spent time trying to animate characters or design elements in Flash with multiple parts that you wanted to move individually, while keeping them connected to each other, you will appreciate how much easier this type of animation is in Flash CS5. The Bone tool enables you to apply IK in two ways: You can link individual symbol instances so that they can move as a chain or rotate in relation to one another or you can create a skeleton inside of a shape that can be used to control the movement of the shape for realistic animation.

The Bone tool gets its name from the fact that the links that make up an IK armature are similar to the bones in a skeleton: They do not bend, but they rotate at joints and allow the symbol instances or shapes around them to bend and change size and position within a controllable range. Armatures can be linear or branched. You may want to experiment with linear structures to get a feel for the hierarchy of bones and the characteristics of joints before you move on to creating more complex branched structures.

Note

The IK tools are only available if your project file is targeting Flash Player 10 and using ActionScript 3.0.

To create a linear IK armature linking a series of symbol instances, follow these steps:

  1. Place a series of symbol instances on the Stage. You can use multiple instances of the same shape or a variety of different symbol instances. Our starting file with seven scaled instances of the same circle symbol is shown in Figure 10.40.

  2. Activate the Bone tool (X) and click on the symbol instance that you want to start your bone chain.

    Note

    The initial symbol instance in the chain will have a fixed x, y position by default, while the connected instances can be moved on the Stage with the Selection tool. Think of the first symbol instance as the anchor point of your animation. If you wanted to have a blade of grass that could bend and move in the wind, you would start from the root of the grass and grow the chain upward instead of starting at the top of the grass and growing the chain down toward the root.

  3. Hold down the mouse and drag to see a preview of the bone that will connect the first symbol instance to the next one in your chain. Release the mouse when the end of the bone is connected to the next symbol in the chain. The endpoint of the bone automatically snaps to the center point of the symbol instance as you drag over it.

    A series of symbol instances arranged on a single layer in Flash are ready to be connected by the Bone tool into an IK armature.

    Figure 10.40. A series of symbol instances arranged on a single layer in Flash are ready to be connected by the Bone tool into an IK armature.

  4. Click the second symbol in the chain and drag a new bone to connect to the third symbol in the chain. Continue clicking and adding sequential bones to create a series of joined symbol instances. Figure 10.41 shows our sample file with the first half of a bone chain created to connect the symbol instances into an IK armature.

Notice that each time you connect a symbol with a bone to add it to your bone chain or IK armature, Flash moves the symbol onto an auto-created pose layer (designated by a small running figure) in the Timeline. If you start with six symbol instances in a layer on the Stage and then connect them all with the Bone tool, you will see that the original layer is empty and all the symbols are on the pose layer when you are finished creating your bone chain. You can select symbol instances in the chain to access instance properties or select the individual bones in the armature to access IK controls in the Properties panel.

As you connect each symbol instance with a bone, the instance becomes part of your IK armature and is moved onto the auto-created pose layer.

Figure 10.41. As you connect each symbol instance with a bone, the instance becomes part of your IK armature and is moved onto the auto-created pose layer.

As shown in Figure 10.42, each bone has settings for the following properties:

  • Speed: This setting is used to slow down the movement of bones to simulate weight. The default setting of 100 percent is equal to free motion or no weight. The lowest setting of 0 percent is equal to no motion or dead weight. In most cases, you will get a nice feeling of organic weight by using values in the middle of this range.

  • Joint Rotation: By default this setting for movement around the bone joint is enabled and unconstrained. If you want to freeze a joint, deselect the Enable check box. If you want to limit the range of motion for the joint, select the Constrain check box and set a Minimum and/or a Maximum angle of rotation within the 360-degree range of the joint.

    Tip

    Positive and negative angles are calculated from the original position of the bone. A value range of −45 degrees to 45 degrees would allow the joint to move to both sides of its current position within a 90-degree arc. A value range of 0 to 90 degrees would also enable the joint to move in a 90-degree arc but only to one side (clockwise) from its current position.

    You can select each bone in an IK armature to access controls in the Properties panel and fine-tune the behavior of your chain.

    Figure 10.42. You can select each bone in an IK armature to access controls in the Properties panel and fine-tune the behavior of your chain.

  • Joint X Translation and Joint Y Translation: By default, these settings for movement of a joint within the chain are disabled. This keeps the length of bones in a chain fixed and makes it a little easier to get predictable motion as you click and drag an IK armature to create poses. If you want more freedom to move individual symbol instances or bones within a chain and you don't mind dealing with bones growing or shrinking within your armature, you may choose to enable free movement along the x and/or y axis by selecting the Enable check box for the respective property. Values are in pixels and are calculated relative to the original position of a bone on the Stage. To limit how far joints can move from their original location, you can set Minimum and/or Maximum values for either axis.

Tip

Although you can enable a joint to move within a range that takes it well outside the Stage area, you might find it easier to control your armature if you use conservative ranges for the X and Y Translation properties to keep the armature from drifting too far outside the Stage.

The pose layer that Flash creates to hold your IK chain is a special layer type that, like a motion tween layer, will capture changes that you make on the Stage and save them in property keyframes.

Note

A pose layer can only contain one armature. If you are working with multiple armatures, you can animate each one on its own pose layer.

If you want to animate your IK armature, follow these steps:

  1. Extend the frame span by inserting additional frames on the pose layer. Select the initial frame in the span and use the F5 key add one frame at a time or select the frame number that you want the span to extend to and then use the F5 key to auto-extend the span to that frame.

  2. Scrub the Timeline to a frame where you would like to add a new pose.

  3. Use the Selection tool or the Properties panel to make changes to the position (or shape) of your armature. As shown in Figure 10.43, a property keyframe has been added to the span of the pose layer to save the changes. If you scrub the Timeline, you see an animation of the symbol instances in your IK chain moving from the original position to the new position (or series of poses) that you created in the pose layer.

    You can change the position of your IK chain in a series of property keyframes to create poses that are animated on the pose layer.

    Figure 10.43. You can change the position of your IK chain in a series of property keyframes to create poses that are animated on the pose layer.

Selecting any frame in the span of the pose layer loads settings for the IK animation into the Properties panel. As shown in Figure 10.44, you can apply easing to the animation as well as choose whether the IK armature is animated at authortime (enabling you to create a series of poses and a set animation sequence) or at runtime (enabling the viewer to click and drag the armature to interact with it "live"). You can also change the bone display Style from the default setting of Solid to Wire or Line to find the view that suits you best.

Adding Spring to IK animations

Realistic physics can be automatically added to IK animations using the new Spring feature. To add Spring, first select a frame span for an IK animation, and then make sure the Enable Springs box is checked in the Properties panel (Figure 10.44). Spring can then be applied to individual bones through the SPRING section of the Properties panel once a bone is selected (Figure 10.45). The Strength value controls the power of the spring effect (higher values mean more extreme springs), and the Damping value controls the decrease of the spring effect over time. A damping value of 0 allows the spring to continue indefinitely, while a value of 100 slows the spring effect over the least amount of frames.

Enable Springs must be checked in the Properties panel when an animation is selected in the Timeline for an animation to allow Spring effects.

Figure 10.44. Enable Springs must be checked in the Properties panel when an animation is selected in the Timeline for an animation to allow Spring effects.

Control the spring effect using Strength and Damping in the Properties panel after a bone is selected.

Figure 10.45. Control the spring effect using Strength and Damping in the Properties panel after a bone is selected.

Note

In Flash CS5, more life can be added to IK animations using a new feature called Spring. Adding Spring to IK animations can make those animations more realistic by applying real-world physics. These physics extend the animations you create to automatically show additional movement.

One example of a spring in action is a pendulum animation. To best apply the spring effect, start the armature animation in the pose you want at the beginning, and after a few frames, define the end pose for the animation. Instead of applying the spring effect in between the start and end frames, Flash applies the effect over many (sometimes hundreds) of frames, so you will need to expand the about of frames by extending the number of frames in the Timeline in order to see the full animation. In the pendulum example in Figures 10.46 and 10.47 the pendulum is at the top of a swing on frame 1, the finished pose is on frame 5, and the Timeline is extended to 500 frames. With a spring strength of 100 and damping of 50, Flash creates the left swing animation, and the pendulum swings back and forth until it comes to a stop in the middle (Figure 10.48).

The pendulum posed to the top-right on frame 1

Figure 10.46. The pendulum posed to the top-right on frame 1

The pendulum posed to the desired end of the animation on frame 5

Figure 10.47. The pendulum posed to the desired end of the animation on frame 5

The animated pendulum showing spring in the Flash Player

Figure 10.48. The animated pendulum showing spring in the Flash Player

Animating shapes with IK

Up to this point, I have worked with bones using symbols, but bones can be added to shapes as well. However, the way that bones interact with symbol instances is quite different from the way they control the movement of a shape. To create an IK armature inside of a shape, follow these steps:

  1. Use the Brush tool or any of the shape drawing tools to create a filled shape that you want to add an IK skeleton or armature to. IK works best if you make a simple, solid shape without a stroke. Our starting shape is shown in Figure 10.49.

  2. Select the Bone tool in the Tools panel.

  3. Click inside the shape and drag to create the first bone in the armature. In most cases, you will want to start at one end of the shape and continue clicking and dragging to set up a series of bones that progress to the other end of the shape. The shorter you make the bones, the more joints you can include in the armature and the more "flexible" the shape will be.

A simple filled shape drawn in merge or object drawing mode can be transformed into an articulated shape by adding an IK armature with the Bone tool.

Figure 10.49. A simple filled shape drawn in merge or object drawing mode can be transformed into an articulated shape by adding an IK armature with the Bone tool.

As with bones added to symbol instances, bones added to a shape will be saved on a new pose layer that can be used to animate the articulated IK armature. A preview of our example shape (with bones added) being moved into a new pose is shown in Figure 10.50.

One challenge of animating shapes with IK bones is that the outline of the shape will sometimes distort or fracture as you move the skeleton. The companion tool for the Bone tool, called the Bind tool (Z), helps you control how the shape relates to the bones in your armature. The way these two tools work together is similar to how the Subselection tool works with the Pencil or Pen tool. After you have created an armature inside of a shape with the Bone tool, you can use the Bind tool to select a bone and see the related control points along the edges of the shape highlighted (with a yellow outline). You can also use the Bind tool to select individual points along the edge of the shape and see the related bone or bones highlighted (with a yellow outline). These two different views of the armature-shape relationship are shown in Figure 10.51.

Moving one bone in the armature drags the other bones along in a continuous chain that controls the motion and form of the articulated shape. Changes to the shape will be saved as property keyframes on the pose layer to create an animation of the motion.

Figure 10.50. Moving one bone in the armature drags the other bones along in a continuous chain that controls the motion and form of the articulated shape. Changes to the shape will be saved as property keyframes on the pose layer to create an animation of the motion.

Bones can be selected with the Bind tool to show the points that are bound to them (left), or points can be selected with the Bind tool to show which bone(s) they are bound to (right).

Figure 10.51. Bones can be selected with the Bind tool to show the points that are bound to them (left), or points can be selected with the Bind tool to show which bone(s) they are bound to (right).

In this way, you can get a clearer idea of how the shape is tied or bound to the bones. More important, you can reassign points or bind them to different bones within the armature. To do this, simply click a point on the edge of the shape with the Bind tool and drag the yellow highlight to the bone that you want it to be tied to, or conversely, you can click a bone with the Bind tool and then drag highlights to specific points along the edge of the shape. Either way, you will be able to adjust the way that the shape reacts to changes in the position of the bones. Keep in mind that points can be bound to more than one bone. The Bind tool is most helpful for smoothing out distortion around joints that are very close together, where outline points may be connected to the wrong bone(s).

Although the IK tools (the Bone tool and the Bind tool) make the task of animating related shapes infinitely easier, they do not eliminate the learning curve for creating this type of animation. It takes a lot of experience to make the most of IK and to anticipate exactly how an armature should be designed and tuned to support different shapes and poses.

Note

As you push your skills into new territory, it helps to find some animation role models who can lead you in defining your style and exploring the full potential of the tools. You can find some inspiring examples and some approachable tutorials online at www.coldhardflash.com, a site that features work from a range of independent Flash animators and Flash animation studios.

Runtime bitmap caching

We're all waiting for the day when intensive animation plays as smoothly on the Web as it does when output for offline viewing. That day is getting closer with every build of the Flash Player. Flash 8 introduced a feature to optimize playback of complex vector graphics in Movie clip or Button symbols by caching them as bitmaps, or surfaces, at runtime. The benefit of caching complex vectors as bitmaps is that the Flash Player does not have to tie up the CPU by constantly redrawing these background vectors as other elements are animating in front of them. Your animation will play back faster and smoother. You can apply this option with ActionScript or by selecting a Movie clip (or Button) instance in the Document window and selecting the check box in the Properties panel to Use runtime bitmap caching.

Runtime bitmap caching optimizes Web playback only for Flash movies with complex background images that are static or panned vertically or horizontally. The position, but not the content, of the cached symbol can change without requiring the Flash Player to redraw the vector information. Bitmap caching fails if the Movie clip (or Button symbol) is larger than 2880 pixels in any direction or if the Movie clip is rotated. You will not notice a significant improvement with bitmap caching on simple vector graphics. Before you publish your final Flash movie, it is always best to test with bitmap caching turned on and turned off to see which delivers the best performance for the specific graphics and animation in your file.

Bitmaps

As I mention previously, when you're designing with Flash for the Web, use raster (bitmap) images with a careful eye on their file size. But for broadcast output, there's no limit. Not only can you use as many images as you'd like (within system constraints), but also doing so makes a richer, far more attractive finished product. And, unlike the SWF format, when they're output as raster video, even animations built with a lot of bitmaps play at the proper frame rate. So move, animate, scale, and rotate them — even play sequences of them. The sky and RAM are the only limits.

Make Flash work for you

I could fill an entire book with illustrations of the various ways that you can move, edit, and recombine your animated timeline sequences, but the basic principles are always the same. Use symbols to keep your files optimized and your options open. Nest symbols to keep your project organized. Try to keep your Main Timeline uncluttered and easy to modify by putting frame-by-frame animation and tweens on symbol timelines. Use Movie clip symbols if you plan to target instances of the symbol with ActionScript. Let Flash do as much work for you as possible, but don't be afraid to manually tweak animated sequences by applying custom tween curves, inserting property keyframes, or modifying artwork. Use layers to keep elements organized and when you need to animate multiple items on the same span of the Timeline. Plan and design your animation in logical sections rather than in complex groups — you can add complexity by nesting multiple symbols. Avoid redundant work and keep your files small and easy to manage by reusing artwork and animation whenever possible.

Summary

  • The Flash authoring environment includes several features that have been adapted from tools that are used for creating traditional animation. Onion skinning, keyframes, and tweens are the digital equivalents of layered transparent cels, key art, and manual in-betweens.

  • There are three basic ways to create animation: frame-by-frame animation, two types of keyframed animation (shape and classic motion tweens), and a new object-based motion tween that uses property keyframes rather than standard keyframes. Most projects require a combination of all three types of animation.

  • The new motion tween model is object based, which makes it possible to delete the target object without "breaking" the tween and transfer the animation properties easily to a new target object. Object-based tweens do not require keyframes but instead track changes made to the target object on auto-inserted property keyframes. Property keyframes can be modified (along with animation curves and easing curves), using the new Motion Editor panel.

  • Tween spans for object-based motion tweens exist on tween layers (a new layer type) that limit editing options in order to protect the tween.

  • You can use shape tweens only to interpolate raw shapes (including broken-apart text), and you can use motion tweens only to interpolate editable text or symbols.

  • Tweens add less to file size than frame-by-frame animation because Flash calculates the difference between the keyframes instead of having to store unique artwork for every frame in a sequence. However, tweens can be very processor intensive if complex transitions or alpha layers need to be interpolated and rendered.

  • You can modify the pace of tweened animation by extending or shortening the span of the tween and also by adjusting the Easing settings to create acceleration or deceleration in a sequence.

  • The Motion Editor opens a whole range of possibilities for controlling the interpolation of properties in a tween. Properties can be set to progress along a single curve, or their individual curves can be modified to create more sophisticated tween effects.

  • The Motion Presets panel gives you a list of ready-made animation patterns that can be applied to Movie clip symbols and modified by using the Motion Editor panel.

  • Saving your own motion presets (or importing XML files for other custom motion presets) enables you to reuse animation patterns without having to use ActionScript or repeat tween steps for timeline animation that you want to use on more than one item.

  • The Bone tool and Bind tool make it possible to create poseable chains of symbol instances or shapes with articulated skeletons. These articulated elements are referred to as armatures and enable you to leverage inverse kinematics (IK) to quickly animate related elements on auto-created pose layers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset