Inverting the mask – Working with Masks

For this project, you need everything inside the mask to be transparent and everything outside the mask to be opaque. You’ll invert the mask now.

  1. Select the TabletVideo.mov layer in the Timeline panel, and press the M key to see the Mask Path property for the mask.

Tip
Pressing the M key twice in quick succession displays all mask properties for the selected layer.
There are two ways to invert this mask: by choosing Subtract from the Mask Mode pop-up menu, or by selecting the Inverted option.

  1. Select the Inverted option for Mask 1.

The mask inverts.

  1. Press F2 or click an empty area of the Timeline panel to deselect the TabletVideo.mov layer.

Creating curved masks
Curved or freeform masks use Bezier curves to define the shape of the mask. Bezier curves give you the greatest control over a mask’s shape. With them, you can create straight lines with sharp angles, perfectly smooth curves, or a combination of the two.
You’ll use Bezier curves to adjust the mask’s edges around the fabric, red ball, and sea urchin shell that obscure part of the screen.

  1. In the Timeline panel, select Mask 1, the mask for the TabletVideo.mov layer. Selecting Mask 1 makes the mask active and also selects all the vertices.
  2. In the Tools panel, select the Add Vertex tool (Add Vertex tool icon), which is hidden behind the Pen tool.
  3. With the Add Vertex tool, click along the bottom edge of the mask to add a vertex.
  4. Drag the new vertex down to the point where the red ball intersects with the screen.
  5. Add another vertex next to the fabric, and drag it down to the point where the fabric and red ball intersect.
  6. Add vertices at the two points where the sea urchin shell intersects the bottom edge of the screen.
  1. In the Tools panel, select the Convert Vertex tool ( ), which is hidden behind the Add Vertex tool.
  2. In the Composition panel, click the vertex where the fabric and red ball intersect. The Convert Vertex tool changes the corner vertex to smooth points.
  3. Adjust the direction handles until the mask follows the contour of the fabric and the red ball.
  1. Deselect the TabletVideo.mov layer in the Timeline panel to check the edge of your mask. If you need to make adjustments, select Mask 1 in the TabletVideo.mov layer, and use the Convert Vertex tool to fine-tune the shape of the mask.
  2. Choose File > Save to save your work.

Creating a mask with the Pen tool – Working with Masks

The tablet screen is currently blank. To fill it with the video of a sea turtle, you need to mask the screen.

Tip

You can also create a mask using the Mocha effect. To learn more about using the Mocha effect, see After Effects Help.

  1. Go to 2:00, where the video is in full color.
  2. Make sure the TabletVideo.mov layer is selected in the Timeline panel, and then select the Pen tool (Pen tool icon) in the Tools panel.

The Pen tool creates straight lines or curved segments. The tablet screen itself is rectangular, so you’ll try using straight lines first.

  1. Click the lower left corner of the tablet screen to place the first vertex.
  2. Click the upper left corner of the tablet screen to place the second vertex. After Effects connects the two points with a segment.
  3. Click to place a third vertex in the upper right corner of the tablet screen, and then click to place a fourth vertex where the fabric intersects with the right edge of the screen.
  4. Move the Pen tool over the first vertex you created (in the lower left corner). When a circle appears next to the pointer (as in the image on the right below), click to close the mask path.

Tips for creating masks

If you have worked with Adobe Illustrator or Photoshop, or similar applications, you’re probably familiar with masks and Bezier curves. If not, here are a few additional tips to help you create them effectively:

  • Use as few vertices as possible.
  • You can close a mask by clicking the starting vertex. To open a closed mask, click a mask segment, choose Layer > Mask And Shape Path, and deselect Closed.
  • To add points to an open path, press Ctrl (Windows) or Command (macOS), and click the last point on the path with the Pen tool. When the point is selected, you can continue adding points.

About mask modes

Blending modes for masks (mask modes) control how masks within a layer interact with one another. By default, all masks are set to Add, which combines the transparency values of any masks that overlap on the same layer. You can apply one mode to each mask, but you cannot change a mask’s mode over time.

The first mask you create interacts with the layer’s alpha channel. If that channel doesn’t define the entire image as opaque, then the mask interacts with the layer frame. Each additional mask that you create interacts with masks located above it in the Timeline panel. The results of mask modes vary depending on the modes set for the masks higher up in the Timeline panel. You can use mask modes only between masks in the same layer. Using mask modes, you can create complex mask shapes with multiple transparent areas. For example, you can set a mask mode that combines masks and sets the opaque area to the regions where the masks intersect.

Editing a mask

Instead of masking the information inside the tablet, the mask has removed everything outside the tablet. You need to invert the mask. You’ll also use Bezier curves to create a more accurate mask.

Getting started – Working with Masks

In this lesson, you will create a mask for the screen of a tablet and replace the screen’s original content with a movie. Then you’ll adjust the positioning of the new footage so that it fits the perspective of the shot. Finally, you’ll polish the scene by adding a shadow and creating a vignette effect.
Begin by previewing the movie and setting up the project.

  1. Make sure the following files are in the Lessons/Lesson07 folder on your hard disk, or download them from peachpit.com now:
    • In the Assets folder: SeaTurtle.mov, TabletVideo.mov
    • In the Sample_Movie folder: Lesson07.mp4
  2. Open and play the Lesson07.mp4 sample movie in Windows Movies & TV or QuickTime Player to see what you will create in this lesson. When you are done, close Windows Movies & TV or QuickTime Player. You may delete the sample movie from your hard disk if you have limited storage space.
    When you begin the lesson, restore the default application settings for After Effects. See “Restoring default preferences” on page 3.
  3. Start After Effects, and then immediately hold down Ctrl+Alt+Shift (Windows) or Command+Option+Shift (macOS) to restore default preferences settings. In the Startup Repair Options dialog box, click Reset Preferences. Then, click New Project in the Home window.
    After Effects opens to display a new, untitled project.
  4. Choose File > Save As > Save As, and navigate to the Lessons/Lesson07/Finished_Project folder.
  5. Name the project Lesson07_Finished.aep, and then click Save.

Creating the composition
You’ll import two footage items for this exercise. Then, you’ll create the composition based on the aspect ratio and duration of one of the footage items.

  1. Double-click an empty area of the Project panel to open the Import File dialog box.
  2. Navigate to the Lessons/Lesson07/Assets folder, Shift-click to select the SeaTurtle.mov and TabletVideo.mov files, and then click Import or Open.
  3. Deselect both files in the Project panel. Then select the TabletVideo.mov footage item, and drag it onto the Create A New Composition button ( ) at the bottom of the Project panel.

After Effects creates a composition named TabletVideo and opens it in the Composition and Timeline panels.

  1. Choose File > Save to save your work so far.

Adding Easy Ease – Animating Layers

You’ll soften the shift in time that occurs when the lights blink with Easy Ease.

  1. Click to select the keyframe at 1:00, and then click the Easy Ease icon (Easy Ease icon) at the bottom of the Graph Editor. This slows the shift into reverse so that the lights stay bright just a little longer.
  2. Click to select the keyframe at 3:00, and apply Easy Ease for the same effect.

Notice that there are Bezier handles where you added ease. You can refine the amount of ease on a transition further by dragging the Bezier handle. If you drag the handle further from the keyframe, the transition is softer; if you drag it down or closer to the keyframe, the transition is more pronounced.

  1. Go to the beginning of the time ruler, and preview the entire movie.
  1. Choose File > Save to save the final project.

Congratulations. You’ve completed a complex animation, including shifts in time. You can render and export the time-remap project if you’d like. See Lesson 15, “Rendering and Outputting,” for detailed instructions on rendering and exporting a composition.

Review questions
1 Why would you import a layered Photoshop file as a composition?
2 What is the pick whip, and how do you use it?
3 What is a track matte, and how do you use it?
4 How do you remap time in After Effects?

Review answers

1 When you import a layered Photoshop file into After Effects as a composition, After Effects preserves the layer order, transparency data, and layer styles from the source Photoshop document. It also preserves other features, such as adjustment layers and type.

2 The pick whip creates expressions that link the values of one property or effect to another layer. The pick whip is also a way to create parenting relationships. To use the pick whip, simply drag the pick whip icon from one property to another.

3 When you want one layer to show through a hole in another layer, you can use a track matte. To create a track matte, you need two layers: one to act as a matte, and another to fill the hole in the matte. You can animate either the track matte layer or the fill layer. When you animate the track matte layer, you create a traveling matte.

4 There are several ways to remap time in After Effects. Time remapping lets you dynamically speed up, slow down, stop, or reverse footage. When remapping time, you can use the values in the time-remap graph in the Graph Editor to determine and control which frame of the movie plays at which point in time. When you enable time remapping for a layer, After Effects adds a Time Remap keyframe at the start and end points of the layer. By setting additional Time Remap keyframes, you can create complex motion effects. Every time you add a Time Remap keyframe, you create another point at which you can change the playback speed or direction.

Using the Graph Editor to remap time – Animating Layers

When remapping time, you can use the values in the time-remap graph to determine and control which frame of the movie plays at which point in time. Each Time Remap keyframe has a time value associated with it that corresponds to a specific frame in the layer; this value is represented vertically on the time-remap graph. When you enable time remapping for a layer, After Effects adds a Time Remap keyframe at the start and end points of the layer. These initial Time Remap keyframes have vertical time values equal to their horizontal positions.

By setting additional Time Remap keyframes, you can create complex motion effects. Every time you add a Time Remap keyframe, you create another point at which you can change the playback speed or direction. As you move the keyframe up or down in the time-remap graph, you adjust which frame of the video is set to play at the current time.

You’ll have some fun with the timing of this project.

Tip

Watch the Info panel as you drag to see more information as you adjust the keyframe.

  1. Select the Selection tool in the Tools panel.
  2. In the Timeline panel, go to 3:00.
  3. In the time-remap graph, Ctrl-click (Windows) or Command-click (macOS) the line at 3:00 to create a new keyframe.
  1. Drag the new keyframe down to 0 seconds.
  1. Go to 0:00, and then press the spacebar to preview the results. Watch the time ruler and Source Time ruler in the Layer panel to see which frames are playing at any given point in time.
    The animation progresses rapidly over the first two seconds of the composition, and then plays in reverse for a second, and the lights go out. The entire animation plays again.
  2. Press the spacebar to stop the preview.
    Having fun yet? Keep going. You’ll adjust the timing so that the lights blink twice before coming on permanently.
  3. Drag the keyframe from 2:00 to 1:00, so that the lights come on in the first second. Then move the next keyframe to 2:00, so that the lights blink off.

Shifting the keyframe affects the timing for the rest of the clip as well. Currently, it’s set to play the 10-second point in the composition at ten seconds, so the angle of speed adjusts accordingly.
You’ll set the lights to blink one more time before continuing the animation. Notice how the angle for the rest of the animation changes as a result; it becomes steeper because there is more animation to cover in less time.

  1. Ctrl-click (Windows) or Command-click (macOS) the line to create additional keyframes at 3:00 and 4:00, moving them to the 4-second and 0-second marks, respectively, so that the lights blink on and off again before the animation begins to play in full.
    Tip
    You can scale the entire animation in time: Click the Time Remap property name to select all of its keyframes, so that you see a free-transform selection box. Then resize the selection box.
  1. Press the spacebar to preview the animation, and press it again to stop it.
    The lights blink on and off, but the text scrolls across the ticker too quickly. You’ll adjust the timing so that it moves more slowly, even though it means the entire text won’t appear before the end of the clip.
  2. Go to 10:00. Then enter 7:00 for the Time Remap value.
  1. Press the Home key or move the current-time indicator to the beginning of the time ruler, and then press the spacebar to preview the animation. Press the spacebar again when you’re done.
    The clip plays for ten seconds, but it ends at the 7-second point in the composition. Now the text moves more slowly—and much more realistically—across the ticker.
  2. Choose File > Save to save your work so far.

Simulating a darkening sky – Animating Layers

The lights come on, but the sky and building remain in daylight. The background should darken as the marquee lights up, showing off the marquee contents and creating a sense of excitement. You’ll use a mask, a solid layer, and a blending mode to provide the contrast.

Creating a mask
You want darkness to fall on the building and sky behind the theater sign. You’ll duplicate the layer, and then create a mask to isolate the area you want to darken.

  1. Press the Home key or move the current-time indicator to the beginning of the time ruler.
  2. In the Timeline panel, select the Lit marquee layer.
  3. Choose Edit > Duplicate. After Effects adds a Lit marquee 2 layer to the layer stack, immediately above the Lit marquee layer.
  4. Select the Pen tool ( ) in the Tools panel.
  5. With the Lit marquee 2 layer selected in the Timeline panel, click the upper left corner of the marquee to start drawing.
  1. Click additional points to continue the mask around the left edge of the marquee, the left and upper edge of the background, and the theatre sign, as in the image below. You’ll need to create some points of the mask on the pasteboard outside the image.
  1. Continue around the theatre sign, and then click your starting point again to close the mask.

Adding a solid layer

Now that you’ve masked the background, you’ll add the layer that will affect it, and then animate the opacity of that layer.

  1. Select the Lit marquee layer in the Timeline panel.
  2. Choose Layer > New > Solid.
  3. In the Solid Settings dialog box, make sure a dark gray color is selected, click Make Comp Size, and then click OK. After Effects adds a layer named Dark Gray Solid 1 between the Lit marquee and Lit marquee 2 layers.

With the current-time indicator at the beginning of the time ruler, most of the image will darken, because neither the Lit marquee layer nor the Lit marquee 2 layer (with its mask) are visible yet. Don’t worry; you’ll animate the solid layer’s opacity to account for that.

  1. Select the Lit marquee 2 layer, and press M if the Mask property isn’t already displayed.
  2. Choose Darken from the Mask Mode menu, and select Inverted.
    You drew around the background, but that’s the area you want to remain unmasked. When you invert the mask, the unselected area becomes masked instead.
  1. Select the Dark Gray Solid layer. Make sure the current-time indicator is at the beginning of the time ruler (0:00). Then, change the Opacity value to 0% in the Properties panel, and click the stopwatch icon ( ) to create an initial keyframe.
  1. Go to 1:23, and change the Opacity to 5%.
  2. Go to 4:09, and click the Add Or Remove Keyframe button to create an additional keyframe with Opacity at 5%.

9. Go to 7:00, and change the Opacity to 75%.

  1. Press the Home key or move the current-time indicator to the beginning of the time ruler. Press the spacebar to preview the animation. When you’re done, press the spacebar again.

As the lights brighten and the text begins to move, the surrounding building and sky gradually darken. Your scene is complete.

  1. Hide the properties for all layers, and save your work.

Creating the track matte – Animating Layers

The text scrolls well, but it overlaps the rest of the marquee, and even the lights on the left side. You’ll use a track matte to confine the text to the black ticker field. You’ll use the alpha channel of the Scroll area layer for the track matte.

  1. Click Toggle Switches/Modes at the bottom of the Timeline panel to display the Track Matte column, so you can apply the track matte.
  2. Select the Scroll text layer, and choose “3. Scroll area” from the Track Matte pop-up menu.

The alpha channel of the layer you selected (Scroll area) is used to set transparency for the Scroll text layer, so the contents of that layer appear only within the matte defined by the Scroll area layer. The video switch is automatically deselected for the Scroll area layer when you apply the track matte.
With the Scroll area layer deselected there are light artifacts at the top of the text area. You’ll make the layer visible to hide those lights without compromising the track matte.

  1. Click the eye icon ( ) for the Scroll area layer in the Timeline panel.
  2. Deselect all layers, and hide all layer properties.
  3. Press the Home key or move the current-time indicator to the beginning of the time ruler, and then press the spacebar to preview the animation. Press the spacebar again when you’re done.
  1. Choose File > Save to save your project.

About track mattes and traveling mattes
When you want one layer to show through a hole in another layer, set up a track matte. You’ll need two layers—one to act as a matte, the other to fill the hole in the matte. You can animate either the track matte layer or the fill layer. When you animate the track matte layer, you create a traveling matte. If you want to animate the track matte and fill layers using identical settings, you can precompose them.


You define transparency in a track matte using values from either its alpha channel or the luminance of its pixels. Using luminance is handy when you want to create a track matte from a layer without an alpha channel, or a layer imported from a program that can’t create an alpha channel. In both alpha-channel mattes and luminance mattes, pixels with higher values are more transparent. In most cases, you use a high-contrast matte so that areas are either completely transparent or completely opaque. Intermediate shades should appear only where you want partial or gradual transparency, such as along a soft edge.
By default, After Effects uses alpha channel values to create a track matte. To use the luminance values instead, click the circle icon ( ) next to the Track Matte column to change it to the sun icon ( ). To invert the matte, click the empty square so that it displays the inverted icon ( ).

Anatomy of a traveling matte

A. Track matte layer: A solid with a rectangular mask, set to Luma Matte. The mask is animated to travel across the screen.

B. Fill layer: A solid with a pattern effect.

C. Result: The pattern is seen in the track matte’s shape and added to the image layer, which is below the track matte layer.

About expressions – Animating Layers

When you want to create and link complex animations, such as multiple car wheels spinning, but want to avoid creating tens or hundreds of keyframes by hand, you can use expressions instead. With expressions, you can create relationships between layer properties and use one property’s keyframes to dynamically animate another layer. For example, if you set rotation keyframes for a layer and then apply the Drop Shadow effect, you can use an expression to link the Rotation property’s values with the Drop Shadow effect’s Direction values; that way, the drop shadow changes with the layer as it rotates.

You work with expressions in the Timeline panel or the Effect Controls panel. You can use the pick whip to create expressions, or you can enter and edit expressions manually in the expression field—a text field in the time graph under the property.

Expressions are based on the JavaScript language, but you don’t need to know JavaScript to use them. You can create expressions using the pick whip, by using simple examples and modifying them to suit your needs, or by chaining objects and methods together.

For more information about expressions, see After Effects Help.

Using a track matte to confine animation

Text should scroll across the bottom of the marquee, but only in the black field. You’ll animate the text, and then create a track matte to confine it to the designated area, so that it appears to be an electronic ticker.

Animating the text

The text should start scrolling after the marquee lights up, and it should continue scrolling until the end of the clip.

  1. In the Timeline panel, select the Scroll text layer.
  2. Go to 4:10.
  3. Press Alt+[ (Windows) or Option+[ (macOS) to set the In point to 4:10.

The text will appear on screen at 4:10, shortly after the marquee is fully lit.

  1. With the Scroll text layer selected, change the Position property in the Properties panel to 4994, 1106.
    Only the first character of the text appears in the black ticker area.
  2. Click the stopwatch icon ( ) to create an initial keyframe.
  1. Go to 9:29, the last frame in the clip.
  2. Change the Position property to 462, 2121.

After Effects creates a keyframe. The last character in the text is visible in the ticker field.

  1. Press the spacebar to preview the scrolling text. Press the spacebar again to end the preview.

Adding an audio track – Animating a Multimedia Presentation

Give yourself a hand—you’ve done a lot of animating in this project. But you’re not quite done. You’ll add a soundtrack that matches the lighthearted mood of the video, and fade it out. You’ll also shorten the composition, since the last few seconds are static.

  1. Click the Project tab to bring the Project panel forward. Then, double-click an empty area of the Project panel to open the Import File dialog box.
  2. Navigate to the Lessons/Lesson05/Assets folder, and double-click the Soundtrack.wav file.
  3. Drag the Soundtrack.wav item from the Project panel into the Balloon Scene Timeline panel, placing it at the bottom of the layer stack.
  4. Preview the movie. The music changes just as the canvas flies off the balloon.
  5. Go to 18:00, and press N to move the work area end point to the current time.
  6. Choose Composition > Trim Comp to Work Area.
  7. Go to 16:00. Expand the Soundtrack.wav layer and the Audio properties.
  8. Click the stopwatch icon to create an initial keyframe for the Audio Levels value.
  9. Go to 18:00, and change the Audio Levels value to –40 dB.
  10. Preview the animation, and then save it.

Congratulations. You’ve just created a complex animation, practicing all kinds of After Effects techniques and capabilities along the way.

Editing audio files in Adobe Audition

You can make some very simple changes to audio in After Effects. For more substantial edits, use Adobe Audition. Audition is available with a full Adobe Creative Cloud membership.

You can use Audition to change the length of an audio file, alter its pitch, or change its tempo. You can apply effects, record new audio, mix multitrack sessions, and more.

To edit an audio clip you’ve used in After Effects, select the file in the Project panel, and choose Edit > Edit In Adobe Audition. Then, make your changes in Audition, and save the file. The changes you made are automatically reflected in your After Effects project.

Review questions

1 How does After Effects display an animation of the Position property?

2 What is a solid-color layer, and what can you do with it?

3 What types of audio can you import into an After Effects project?

Review answers

1 When you animate the Position property, After Effects displays the movement as a motion path. You can create a motion path for the position of the layer or for the anchor point of a layer. A position motion path appears in the Composition panel; an anchor-point motion path appears in the Layer panel. The motion path appears as a sequence of dots, where each dot marks the position of the layer at each frame. A box in the path marks the position of a keyframe.

2 You can create solid images of any color or size (up to 30,000 x 30,000 pixels) in After Effects. After Effects treats solids as it does any other footage item: You can modify the mask, transform properties, and apply effects to the solid layer. If you change settings for a solid that is used by more than one layer, you can apply the changes to all layers that use the solid or to only the single occurrence of the solid. Use solid layers to color a background or create simple graphic images.

3 You can import any of the following types of audio files into After Effects: Advanced Audio Coding (AAC, M4A), Audio Interchange File Format (AIF, AIFF), MP3 (MP3, MPEG, MPG, MPA, MPE), and Waveform (WAV).

Trimming a layer – Animating a Multimedia Presentation

You don’t need the Wave Warp effect until the canvas flies off the balloon, but even if the values are 0, After Effects will have to calculate the effect for the entire layer. So you’ll trim the layer to speed up the time it takes to render the file.

  1. Go to 9:12.
  2. Press Alt+[ (Windows) or Option+[ (macOS) to set the In point to 9:12.
    Note
    Press [ to move the In point of a clip without changing its duration. Press Alt+[ or Option+[ to trim a clip to a new In point, shortening its duration.
  3. Return to the Balloon Scene Timeline panel.
  4. Press the spacebar to preview the movie. Press the spacebar again to stop the preview.

  1. Save your work so far.

Animating the background
The movie should end with the revelation that the canvas from the balloon has been draped on the clouds. But right now, the canvas flies off and the balloon floats away. You need to animate the sky so that the canvas-covered clouds are centered at the end of the scene.

  1. In the Balloon Scene Timeline panel, go to the beginning of the time ruler (0:00).
  2. Select the Sky layer. In the Properties panel, click the stopwatch icon for the Position property to create an initial keyframe.
  3. Go to 16:00, and drag the Sky layer down and to the left until the wrapped clouds are in the center of the frame. (Our values are –236.4, 566.7.)
  4. Go to 8:00, and move the wrapped clouds completely off the screen, far off to the right.
  5. Right-click or Control-click the first keyframe, and choose Keyframe Assistant > Easy Ease Out.
  6. Right-click the middle keyframe, and choose Keyframe Assistant > Easy Ease, and then right-click the last keyframe, and choose Keyframe Assistant > Easy Ease In.
  7. Move the current-time indicator through the time ruler to see how the departure of the canvas matches up with the appearance of the canvas-covered clouds. The canvas should be completely offscreen before the canvas-covered clouds appear.
  8. Move the middle keyframe forward and backward in the time ruler to adjust the sky animation so that it matches the progress of the canvas and the balloon. The bare balloon should float in front of at least a few of the canvas-covered clouds before it disappears.
  9. Press the spacebar to preview the entire video. Press the spacebar again to stop the preview.
  1. Adjust the motion paths and rotations for the balloon, canvas pieces, or the sky as necessary.
  2. Hide the properties for all layers, and save the project.

Supported audio file formats
You can import any of the following types of audio files into After Effects:
• Advanced Audio Coding (AAC, M4A)
• Audio Interchange File Format (AIF, AIFF)
• MP3 (MP3, MPEG, MPG, MPA, MPE)
• Waveform (WAV)