10. Animating with Shape Tweening

Introduction

Shape tweening works similarly to motion tweening. It follows the same structure of keyframing in the Timeline. You can animate many of the same changes such as alpha, color, scale, and position, though its main purpose is to transform the shape of an object into another shape. Whereas motion tweening is applied to groups and symbols, shape tweening must be applied to an editable shape. You can determine whether an object is editable by selecting it with the Selection tool—if it doesn’t have a bounding box when selected, shape tweening can be applied. The reason for this is that when you convert a shape into a symbol, you are essentially protecting it from editing by storing it in its own Timeline. To apply shape tweening to a symbol, you must enter symbol editing mode and apply it to the shape contained inside the symbol. Shapes are created with any of Flash’s drawing tools, such as the Oval or Rectangle tools. By making changes to the shape with any of Flash’s editing tools, you can change the contours of the shape (for example, turn a circle into a square) and then use shape tweening to make this change happen gradually over time. Because the results of a shape tween can be unpredictable, you can set shape hints to let Flash know how to proceed with the tween. This is useful when you are working with complex shapes such as letterforms. In all cases you should only tween one shape at a time in a tweened span for best results.

In addition to shape tweening, you can also animate shapes using Inverse Kinematics (IK), which allows you to stretch and bend shape objects and link groups of symbol instances to make them move together in naturalistic ways using an internal structure of bones to create character animation.

Using Shape Tweening

You can use shape tweening when you need to alter the form of any editable shape gradually. Place artwork in a keyframe and then use any of Flash’s drawing and editing tools to adjust the contours of a shape on another keyframe. When you apply shape tweening, Flash draws the frames in-between the two keyframes so that the object appears to “morph” between the two states. To provide even more control, you can use shape hints.

Creating Complex Animations

Creating a Shape Tween

Creating a Shape Tween

FL 3.1

In most cases, you can easily shape tween any two simple shapes. Geometric forms such as lines, rectangles and circles yield the best results. Because Flash draws the tweened frames mathematically, the simpler the shape, the more likely it will tween without any problems or without having to apply corrections such as shape hints. Experimentation is the key. As long as both keyframes contain an editable shape, Flash will attempt to morph one object into another. Use any of Flash’s drawing tools or import a vector shape from another vector drawing program. If you want to apply a shape tween to grouped artwork or a symbol, you can break apart the group or enter symbol editing mode and apply the shape tween to any editable shape in the symbol’s Timeline. You can quickly view your animation by exporting it with the Test Movie command. By default, Flash loops animations in the Flash Player.

Create a Shape Tween

Create a Shape Tween Create a new Flash document.

Create a Shape Tween With any of Flash’s drawing tools, draw a shape on the Stage at frame 1.

Create a Shape Tween

Create a Shape Tween Select the first frame.

Create a Shape Tween

Create a Shape Tween Click the Insert menu, and then click Shape Tween.

Create a Shape Tween Select frame 10.

Create a Shape Tween

Create a Shape Tween Click the Insert menu, point to Timeline, and then click Blank Keyframe.

Flash tints a shape-tweened span a pale green.

Timesaver

Press F7 to add a blank keyframe.

Timesaver With any of Flash’s drawing tools, draw a different shape on the Stage at frame 10.

Timesaver Click the Control menu, and then click Test Movie to test the animation.

The shape on frame 1 slowly transforms into the shape on frame 10.

Timesaver
Timesaver

Timesaver

Press Timesaver+Return (Mac) or Ctrl+Enter (Win) to test your movie by viewing it in the Flash Player.

Adding and Removing Keyframes from a Shape Tween

The procedure for adding or removing keyframes in a shape tween is similar to that of motion tweens except for one crucial difference. In a motion-tweened framespan you can drag the object on the Stage and a new keyframe is automatically created. In shape-tweened spans, the object is only selectable on a keyframe. To add additional locations or shape changes along a shape-tweened span, you must add the keyframe first and then edit the shape. You can do this by using the Add Keyframe function in the Insert menu. Once the keyframe is added, the shape at that point in the framespan becomes editable.

Add a Keyframe to a Shape Tween

Add a Keyframe to a Shape Tween Place the playhead between any two shape tweened keyframes.

Add a Keyframe to a Shape Tween

Add a Keyframe to a Shape Tween Click the Insert menu, point to Timeline, and then click Keyframe.

Add a Keyframe to a Shape Tween

Timesaver

Press F6 to insert a keyframe.

Remove a Keyframe from a Shape Tween

Remove a Keyframe from a Shape Tween Click on the keyframe you want to remove in the shape tween.

Remove a Keyframe from a Shape Tween

Remove a Keyframe from a Shape Tween Click the Modify menu, point to Timeline, and then click Clear Keyframe.

The keyframe is cleared but the duration of the tween is preserved. The first and last keyframes are automatically reconnected, and Flash redraws the tween.

Remove a Keyframe from a Shape Tween

Timesaver

Press Shift+F6 to remove the keyframe.

Changing Shape Positions with Shape Tweening

To create a shape tween you need to draw or place an editable shape in a keyframe. Use any of Flash’s drawing tools or import a vector shape from another vector drawing program. If you want to apply a shape tween to grouped artwork or a symbol, you can break apart the group or enter symbol editing mode and apply the shape tween to any editable shape in the symbol’s Timeline. You can quickly view your animation by exporting it with the Test Movie command. By default, Flash loops animations in the Flash Player.

Animate a Ball with Shape Tweening

Animate a Ball with Shape Tweening Create a new Flash document.

Animate a Ball with Shape Tweening Select the Oval tool on the Tools panel.

Animate a Ball with Shape Tweening

Animate a Ball with Shape Tweening Set the Stroke Color to None.

Animate a Ball with Shape Tweening On the first frame, draw a circle on the left side of the Stage.

Animate a Ball with Shape Tweening

Animate a Ball with Shape Tweening Select the first frame.

Animate a Ball with Shape Tweening Click the Insert menu, and then click Shape Tween.

Animate a Ball with Shape Tweening Click frame 20 in the Timeline.

Animate a Ball with Shape Tweening Click the Insert menu, point to Timeline, and then click Keyframe.

Flash tints a shape-tweened span a pale green.

Timesaver

Press F6 to add a keyframe.

Timesaver Select the Selection tool on the Tools panel.

Timesaver

Timesaver Select the circle on frame 20 and drag it to the right side of the Stage.

Timesaver

Timesaver Click frame 40 in the Timeline, and then add another keyframe.

Timesaver

Timesaver Select the circle shape on frame 40 and drag it back to the left side of the Stage.

Timesaver Click the Control menu, and then click Test Movie to test the animation.

The ball animates back and forth across the screen.

Changing Shape Position and Form Simultaneously

Many of the same motion effects can be applied using either motion or shape tweening. What differentiates shape tweening from motion tweening is that shape tweening is applied to editable shapes. You can change the form of the shape on either keyframe and these changes will be applied gradually by Flash across the tween, slowly morphing one into the other. Additionally, you can combine movement with this tweening process, so your shape can change its shape as it changes its location.

Combine Shape Tweening and Movement in a Ball Animation

Combine Shape Tweening and Movement in a Ball Animation Create a shape tween of a moving ball that begins on the left side of the Stage, hits the right side of the Stage, and then returns to the left.

Combine Shape Tweening and Movement in a Ball Animation

Combine Shape Tweening and Movement in a Ball Animation Click to place the playhead between the first and second keyframes in the shape tween.

Combine Shape Tweening and Movement in a Ball Animation Click the Insert menu, point to Timeline, and then click Keyframe.

Combine Shape Tweening and Movement in a Ball Animation Select the Selection tool on the Tools panel.

Combine Shape Tweening and Movement in a Ball Animation

Combine Shape Tweening and Movement in a Ball Animation Place the pointer on the left edge of the shape and pull it to create a tail off the circle.

Combine Shape Tweening and Movement in a Ball Animation

The shape must be deselected on the Stage to pull the edges of the shape.

Combine Shape Tweening and Movement in a Ball Animation Click to place the playhead between the second and third keyframes in the shape tween.

Combine Shape Tweening and Movement in a Ball Animation

Combine Shape Tweening and Movement in a Ball Animation Click the Insert menu, point to Timeline, and then click Keyframe.

Combine Shape Tweening and Movement in a Ball Animation With the Selection tool still selected, place the pointer on the right edge of the shape and pull it to create a tail off the circle.

Combine Shape Tweening and Movement in a Ball Animation

Combine Shape Tweening and Movement in a Ball Animation Click the Control menu, and then click Test Movie to test the animation.

The ball stretches as it animates back and forth across the screen.

See Also

See “Changing Shape Positions with Shape Tweening” on page 274 for information on animating a moving ball.

Adjusting Shape Tween Properties

When shape tweens are applied to keyframes, the Property Inspector enables several options for controlling how Flash draws the tweened frames. Settings such as easing in and easing out enable you to control how the shape changes are distributed across the frames in the tween. Frame Blending allows you to set preferences to let Flash know which qualities to maintain during the tween.

Set Shape-Tween Properties

Set Shape-Tween Properties Click the Window menu, and then click Properties to open the Property Inspector.

Set Shape-Tween Properties

Set Shape-Tween Properties Select a keyframe with shape tween applied.

Set Shape-Tween Properties Choose from the following settings:

Ease. This sets the speed at which your object eases in or out of its motion. A positive value eases in, a negative value eases out.

Blend. The Distributive option smoothes out the tweened shapes, while the Angular option preserves corners and straight lines in the shape tweens.

Changing Shape Tweening Color and Alpha Options

Because shape tweening can only be applied to editable shapes, you can’t use the same color style effects that are available to instances. Instead, you must make these changes directly to the shape using the color palettes, the Color Mixer, or the Swatches Panel. When shape tweening is applied, differences in color and alpha are tweened along with any shape changes. This applies to strokes as well as fills.

Change Shape-Tween Color

Change Shape-Tween Color Select the beginning or ending keyframe in a shape tween or select the shape on the Stage.

Change Shape-Tween Color

Change Shape-Tween Color Click the Window menu, and then click Color, if necessary.

Timesaver

Press Shift+F9 to open the Color panel.

Timesaver Make changes to the shape’s stroke and fill colors by entering values in the RGB and Alpha fields, or by using the list arrows to the right of these fields.

Timesaver Click the Control menu, and then click Test Movie to test the color tween.

Did You Know?

You can use any palette available to change the color of a shape in a tween. In addition to the Color Mixer, there are palettes located on the Tools panel, Property Inspector, and Swatches panel.

See Also

See “Modifying Instance Color Styles and Blends” on page 158-159 for more information on working with color and alpha options.

Using Shape Hints

Sometimes it isn’t possible to predict how some, more complicated, shapes will tween. To exercise greater control over the tweening process, you can set shape hints to guide how Flash draws the in-between frames. You simply specify a beginning shape hint and then a corresponding end shape hint. In this way, Flash will know which parts of the shape in the first keyframe will transform into which parts in the end keyframe. Even with shape hints enabled, the results can be unpredictable, but you will have a greater control over the process.

Set Shape Hints

Set Shape Hints Create a shape tween of a simple shape into a complex shape.

Set Shape Hints Click to place the playhead on the first frame of the shape tween.

Set Shape Hints

Set Shape Hints Click the Modify menu, point to Shape, and then click Add Shape Hint.

A small red, circle with a small letter on it appears in the center of the shape. The first letter is “a”. Shape hints appear in alphabetical order “a, b, c...”. You can use up to 26 hints in one tween.

Timesaver

Press Shift+ Timesaver+H (Mac) or Ctrl+Shift+H (Win) to insert a shape hint.

Timesaver Drag the shape hint to an area of the shape you want to control.

Timesaver Click to place the playhead on the last frame of the shape tween.

Timesaver

The corresponding shape hint appears as a small green circle with a corresponding letter that matches the beginning hint.

Did You Know?

You can show all shape hints. Click the View menu, and then click Show Shape Hints.

You can show all shape hints. Drag the corresponding end shape hints to the part of the shape that corresponds to the placement of the beginning shape hint.

“a” should correspond with “a”, “b” should correspond with “b”, etc.

You can show all shape hints.

You can show all shape hints. Move the playhead back to the first frame.

You can show all shape hints. Repeat steps 3, 4, 5, 6, and 7 until you have set and placed shape hints on all areas of the shape you want to control.

You can show all shape hints. Click the Control menu, and then click Test Movie to test the animation.

The shape hints help make complex shape tweens more predictable.

Did You Know?

You can remove shape hints. Drag shape hints off the Stage or click the Modify menu, point to Shape, and then click Remove All Hints.

You should place your shape hints consecutively in a clockwise or counter-clockwise direction. Placing shape hints out of order can confuse Flash and often produces unwanted results.

Creating Animation Using ActionScript

In addition to creating animation using the Timeline and Property Inspector, you can also use ActionScript to animate movie clips, buttons, text, and components. You can animate any instance name with ActionScript. For an ActionScript 3.0 example, see Project 4, “Modifying an Object with ActionScript on page 515. For ActionScript 2.0, you can animate an object over time and change any ActionScript property, such as scale, rotation, color, and transparency. ActionScript provides two events that work well for animation: onEnterFrame and setInterval. The onEnterFrame event is a continuously executing event based on the frame rate of your movie until you stop (delete) it. The setInterval event is a continuously executing event for only a certain period of time. The one disadvantage of these actions is the large use of memory and CPU, so you need to clear it.

onEnterFrameevent. The following example is a frame script that animates a movie clip to the right until it reaches the position it should be in:

myMovieClip.onEnterFrame=function()
{
       if(this._x<300)
           {
                 this._x+=10;
           }
       else
           {
delete this. onEnterFrame;


setIntervalevent. This event requires two parameters: funtionName and an interval (amount of time in milliseconds between executions). If your interval is smaller than your frame rate, the screen cannot refresh. If your interval is greater than your frame rate, it executes as close as possible. The following example moves a TextArea component to the right every 10 milliseconds until it has reached its final location:

myInternval=setInterval(textAreaMove, 10);
function textAreamove() {
        if (textAreaInstance._x<300) {
                  textAreaInstance._x += 10;
        } else
        clearInterval(myInterval);
        }
}


Using Inverse Kinematics

Using Inverse Kinematics

FL 2.3, 3.7

Inverse Kinematic (IK) (New!) allows you to stretch and bend shape objects and link groups of symbol instances to make them move together in naturalistic ways using an internal structure of bones to create character animation.

You can add bones to the interior of a shape or to separate symbol instances. When you move one bone, the other connected bones move in relation to the one that initially moved. A chain of bones is called an armature, which is either linear or branched in structure.

There are two types of Inverse Kinematic animation: those with symbols and those with shapes. For the symbol type, you link them together as a chain. For the shape type, you add bones inside the shape.

When you add bones to a shape or symbol instance, Flash creates a new layer called a pose layer. For a shape, Flash also converts the selected shapes and bones into an IK shape object. Each pose layer can contain only one armature. The first bone in an armature is the root bone. It appears with a circle around the head of the bone. Each bone has a head, the round end, and a tail, known as the pointed end.

After you add bones to an armature, you can change the position and length of a bone, delete bones, and edit objects containing bones.

When you’re ready to animate an armature, all you need to do is add frames to the pose layer and reposition the armature on the Stage to create a keyframe. Keyframes in pose layers are called poses. To insert a frame in a pose layer, right-click (Win) or Option-click (Mac) a frame in a pose layer to the right of any existing frames, and then click Insert Frame. To add a pose to a frame, right-click (Win) or Option-click (Mac) the frame in the pose layer, and then click Insert Pose. After you insert a pose, you can use the Selection tool to change the configuration of the armature. If you want to change the length of the animation, drag the last frame of the pose layer to the right or left in the Timeline to add or remove frames.

You can adjust the speed of an armature animation in frame around each pose by applying an easing motion. To add easing to frames in a pose layer, click a frame in a pose layer, open the Property Inspector, click the Ease popup, select an ease option, and then enter an ease strength value (0-100, where 0 is no easing and 100 is the most easing).

Using Inverse Kinematics

Adding Bones to an Armature

Adding Bones to an Armature

FL 2.3, 3.7

With Inverse Kinematic (IK) (New!), you can use bones to create two types of IK animations: those with symbols and those with shapes. For the symbol type, you link them together as a chain. For the shape type, you add bones inside the shape. When you add bones to a shape or symbol instance, Flash creates a new pose layer. For a shape, Flash also converts the selected shapes and bones into an IK shape object. The first bone in an armature is the root bone. It appears with a circle around the head of the bone. Each bone has a head, the round end, and a tail, known as the pointed end.

Add Bones to a Shape

Add Bones to a Shape Create one or more filled shapes and arrange them the configuration you want.

Add Bones to a Shape

Add Bones to a Shape Select the entire shape on the Stage.

Add Bones to a Shape Click the Bone tool on the Tools panel.

Add Bones to a Shape

Add Bones to a Shape Click inside the shape, and then drag to another location within the shape.

While you drag, a bone appears. When you connect the points, a solid bone appears between them. Flash converts the selected shape into an IK shape object and moves it to a new pose layer in the Timeline.

Add Bones to a Shape To add another bone, drag from the tail of the first bone to another location in the shape.

As you add bone instances, Flash moves each one to a new pose layer in the Timeline.

Add Bones to a Shape To create a branched armature, click the head of an existing bone, and then drag to create a new branch of the first bone.

Add Bones to a Symbol

Add Bones to a Symbol Arrange the instances in the configuration you want.

Add Bones to a Symbol Click the Bone tool on the Tools panel.

Add Bones to a Symbol

Add Bones to a Symbol Click the symbol instance that you want as the root or head of the armature.

Add Bones to a Symbol Drag the symbol instance to another symbol instance to connect it.

While you drag, a bone appears. When you connect the symbols, a solid bone appears between the symbols. As you add bone instances, Flash moves each instance to a new pose layer in the Timeline.

Add Bones to a Symbol To add another bone, drag from the tail of the first bone to the next symbol instance you want to add to the armature.

Add Bones to a Symbol To create a branched armature, click the head of an existing bone, and then drag to create a new branch of the first bone.

You can add as many branches as you want.

Did You Know?

You can move an armature. Select the IK shape object with the Selection tool, and then drag any of the bones to move it.

Editing Armatures and Bones

Editing Armatures and Bones

FL 2.3, 3.7

After you add bones to an armature, you can change the position and length of a bone, delete bones, and edit objects containing bones (New!). An armature can only be edited in pose layers that contain an initial pose in the first frame in which the armature appears in the Timeline. To edit the armature, you need to delete any additional poses after the first frame of the armature.

Edit Armatures, Bones, and Related Objects

Edit Armatures, Bones, and Related Objects Select the bones and associated objects you want:

Bone. Click the Selection tool, and then click a bone. You can Shift-click to select multiple bones.

Armature. Double-click a bone.

IK Shape. Click the shape.

Symbol Instance. Click the instance.

Symbol Instance.

Symbol Instance. To move bones, do any of the following:

Bone. Drag a bone.

IK Shape. Select the shape, and then change its X and Y position in the Property Inspector.

Bone End in IK Shape. Click the Subselection tool, and then drag the end of the bone.

Bone Joint, Head, or Tail. Use the Transform panel to move the transformation point of the symbol instance.

Rotate a Bone. Shift-drag a bone to rotate it with its child bones with out moving the parent bone.

Rotate a Bone. To delete bones, do either of the following:

Bone. Select the bones you want to delete, and then press Delete.

IK Shape or Symbol Instance. Select the shape or symbol, click the Modify menu, and then click Break Apart.

IK Shape or Symbol Instance.

IK Shape or Symbol Instance. To edit an IK shape, do any of the following:

Move the Position of a Bone. Drag a bone endpoint to move the position of a bone without changing the IK shape.

Display Control Points of the Boundary. Click the stroke of the IK shape.

Move Control Point. Drag the control point.

Add Control Point. Click a part of the stroke without any control points. You can also use the Add Anchor Point tool on the Tools panel.

Delete Control Points. Click a control point to select it, and then press Delete. You can also use the Delete Anchor Point tool on the Tools panel.

Delete Control Points. To set motion constraints, open the Property Inspector, and then specify the options you want to move or constrain joints, disable bone rotation around joints, constrain the rotation of a bone, make a bone stationary, or limit the motion speed of a bone.

Binding Bones

Binding Bones

FL 2.3, 3.7

When the stroke of an IK shape doesn’t distort in the way you want, you can use the Bind tool (New!) to edit the connections between individual bones and shape control points to create the appearance you desire. By default, the control points of an IK shape are connected to the bone that is nearest them. The Bind tool allows you to change it. You can bind multiple control points to a bone and multiple bones to a control point.

Bind Bones to Shape Points

Highlight Control Points Connected to a Bone. Click the Bind tool, and then click a bone.

The connected points are highlighted in yellow while the selected bone is highlighted in red.

Highlight Control Points Connected to a Bone.

Add Control Points. Select a bone, and then Shift-click an unhighlighted control point.

Remove Control Points. Ctrl-click (Win) or Option-click (Mac) a control point that is highlighted in yellow.

Highlight Bones Connected to a Control Point. Click the Bind tool, and then click the control point.

The connected bones are highlighted in yellow while the selected control point is highlighted in red.

Add Other Bones to a Control Point. Select a control point, and then Shift-click a bone.

Remove a Bone from a Control Point. Select a control point, and then Ctrl-click (Win) or Option-click (Mac) a bone that is highlighted in yellow.

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

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