6.8. Animating Masks

Problem

You want to create an animated mask.

Solution

Use any of Flash’s animation tools to animate the content in the mask layer, except a motion-guided tween. For motion-guided tween masks, make a movie clip within which the motion-guided tween resides, and use an instance of that movie clip on the mask layer.

Discussion

Nearly all of Flash’s animation features can be applied to masks, including both motion and shape tweens, frame-by-frame animation, and ActionScript-based animation.

One common animated mask effect is that of a spotlight. It is an easy effect to create and animate:

  1. Create the graphic of the background as it should appear with the spotlight off it.

  2. In a new layer, copy and paste the background in place (Edit → Paste in Place). This layer will contain the version of the background when shone in the spotlight.

  3. Brighten the colors of the elements in this layer.

  4. Create a layer above the existing two layers, and draw a circle in it.

  5. Set the top layer, with the circle in it, to a mask layer, and drag the second layer so that it comes under the influence of the new mask layer.

  6. If desired, lock all three layers to preview the effect. Where the circle appears, the background should be brighter. When you are finished, unlock the layers.

  7. Convert the circle mask to a movie clip symbol, and assign it an instance name of mSpotlightMask.

  8. Add a new layer to the timeline, select the first keyframe, and open the Actions panel.

  9. Add the following code to the Actions panel.

Get Flash 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.