Adjusting the shape of the mask – Working with Masks

The neighboring objects should cast a shadow, but it shouldn’t affect the entire screen. You’ll use the Pen tools to reduce the mask to cover only the lower right section of the screen.

  1. Select the Delete Vertex tool (Delete Vertex tool icon), hidden beneath the Convert Vertex tool in the Tools panel.
  2. Click the upper left vertex to delete it.
  1. Select the Selection tool ( ) in the Tools panel, and then drag the lower left and upper right vertices closer to the lower right corner of the screen, as in the following image.
  1. Select the Add Vertex tool ( ), hidden beneath the Delete Vertex tool in the Tools panel.
  2. Add vertices to the upper path (currently a diagonal line), and then use the Convert Vertex ( ) and Selection tools to position and shape the path into a curve similar to the following images.

Feathering the edges of the shadow
Shadows rarely have sharp edges. You’ll adjust the feather for the mask so that the shadow fades into the rest of the screen.

  1. Go to 3:15.
  2. Select the Mask Feather tool ( ), hidden beneath the Convert Vertex tool ( ) in the Tools panel.
    You used the Mask Feather property to adjust the width of the feather the same amount all the way around the original mask. However, the Mask Feather tool gives you more flexibility, letting you vary the feathering width at points you define on the closed mask.
  3. In the Timeline panel, select the Shadow layer. Then, in the Composition panel, click the lower left vertex to create a feather point.
  4. Click the feather point again, and without releasing the mouse button, drag that feather point outward to increase the feathering margin for the entire mask.

Currently the feather, represented by dashed lines, extends evenly across the mask. You’ll add more feather points for greater flexibility.

  1. Click the vertex on the right side of the sea urchin.

A feathering point is created, and the feather shrinks back to the mask edge on the lower and right sides of the screen, but the feathering remains on the upper side of the mask. The objects that are casting the shadow shouldn’t be shadowed.

  1. Click the dashed line just under the vertex on the left side of the sea urchin, and drag the feathering boundary up to the screen.
  1. (Optional) Adjust the feathering elsewhere by creating a feather point on the boundary and dragging it.
    Now the shadow doesn’t appear on any of the objects.
    The shape of the shadow is good, but it’s obscuring the image. You’ll change the opacity to reduce its effect.
  2. Select the Shadow layer in the Timeline panel, and then change its Opacity value to 20% in the Properties panel.

9. Hide all properties in the Timeline panel, and then press F2 or click an empty area in the Timeline panel to deselect all layers.

Repositioning and resizing the clip – Working with Masks

The sea turtle clip is a little too big for the tablet screen and it’s not quite the right angle. You’ll convert it to a 3D layer, which will give you more control over its shape and size.

  1. Still at 2:07, select the SeaTurtle.mov layer.
  2. With the SeaTurtle.mov layer selected in the Timeline panel, click the 3D switch (3D switch icon) for the layer.

The 3D Transformation Gizmo appears in the Composition panel, and the Properties panel includes the Orientation property and multiple Rotation properties. Most properties in the Properties panel now have three values: From left to right, they represent the x, y, and z axes of the image. The z axis controls the depth of the layer. These axes are represented in the 3D Transformation Gizmo.
Note
You’ll learn more about 3D layers in Lessons 12, “Using 3D Features,” and 13, “Working with the 3D Camera Tracker.”

  1. In the Properties panel, change the Scale to 90%.
  2. Make sure the Selection tool is selected, and then use the 3D Transformation Gizmo in the Composition panel to adjust the position of the video in the screen.
    Drag the red arrow to move the layer horizontally, the green arrow to move it vertically, and the blue arrow to change the depth. Drag the ball along the curved red line to rotate the layer around the x axis; drag the green ball along the curved green line to rotate it around the y axis; and drag the blue ball along the curved blue line to rotate it around the z axis.
  3. Make any additional adjustments, including changes to the Rotation values, so that your composition resembles the following image. Your values may not match ours, depending on how you shifted the SeaTurtle layer earlier.

Tip
To specify whether the 3D Transformation Gizmo affects Rotation or Orientation values, select the Rotation tool in the Tools panel and choose an option from the Set menu. You can also type values directly in the Properties panel instead of dragging in the Composition panel.

  1. Choose File > Save to save your work.

Adjusting the opacity
The video appears abruptly. You’ll smooth its appearance by adjusting the opacity at the beginning.

  1. Make sure you are still at 2:07 in the time ruler and the SeaTurtle.mov layer is selected.
  2. In the Properties panel, change the Opacity to 0%, and then click the stopwatch icon ( ) to create an initial keyframe.
  3. Go to 3:15, and change the Opacity to 100%.
  4. Hide properties for all layers in the Timeline panel, and deselect all layers.
  5. Press the Home key or move the current-time indicator to the beginning of the time ruler, and then press the spacebar to preview your work. Press the spacebar again when you’re done.

Adding a shadow

The masked image looks convincing, but you can make it look even more realistic by adding a shadow to the screen.

  1. Click an empty area in the Timeline panel to deselect all layers, and then choose Layer > New > Solid.
  2. In the Solid Settings dialog box, name the layer Shadow, click the Make Comp Size button, choose a dark gray color (we used R=34, G=34, B=34,), and then click OK.
    Instead of trying to exactly re-create the shape of the TabletVideo.mov layer’s mask, it’s easier to copy it to the Shadow layer and adjust it.
  3. Press the Home key or move the current-time indicator to the beginning of the time ruler.
  4. Select the TabletVideo.mov layer in the Timeline panel, and press the M key to display the Mask Path property for the mask.
  5. Select Mask 1, and then choose Edit > Copy or press Ctrl+C (Windows) or Command+C (macOS).
  6. Select the Shadow layer in the Timeline panel, and then choose Edit > Paste or press Ctrl+V (Windows) or Command+V (macOS).
  7. Hide the properties for the TabletVideo.mov layer.
    This time, you want to keep the area inside the mask opaque and make the area outside the mask transparent.
  8. Select the Shadow layer, and press the F key to reveal the Mask Feather property for the mask.
  1. Change the Mask Feather value to 0 (zero).
  2. Deselect the Inverted option.

The Shadow layer now obscures the SeaTurtle.mov layer.

About masks – Working with Masks

Lesson overview

In this lesson, you’ll learn how to do the following:

  • Create a mask using the Pen tool.
  • Change a mask’s mode.
  • Edit a mask shape by controlling vertices and direction handles.
  • Feather a mask edge.
  • Replace the contents of a mask shape.
  • Adjust the position of a layer in 3D space to blend it with the rest of a shot.
  • Create a shadow effect.
  • Create a vignette.

This lesson will take about an hour to complete. If you haven’t already done so, download the project files for this lesson from peachpit.com/AfterEffectsCIB2024, following the instructions in the Getting Started section under “Accessing the lesson files and Web Edition.”

PROJECT: SEQUENCE FROM A COMMERCIAL

There will be times when you won’t need (or want) everything in a shot to be included in the final composite. Use masks to control what appears.

About masks

A mask in Adobe After Effects is a path, or outline, that is used to modify layer effects and properties. The most common use of masks is to modify a layer’s alpha channel. A mask consists of segments and vertices: Segments are the lines or curves that connect vertices. Vertices define where each segment of a path starts and ends.

A mask can be either an open or a closed path. An open path has a beginning point that is not the same as its end point; for example, a straight line is an open path. A closed path is continuous and has no beginning or end, such as a circle. Closed-path masks can create transparent areas for a layer. Open paths cannot create transparent areas for a layer, but are useful as parameters for an effect. For example, you can use an effect to generate a running light around a mask.

A mask belongs to a specific layer. Each layer can contain multiple masks.

You can draw masks in common geometric shapes—including polygons, ellipses, and stars—with the shape tools, or you can use the Pen tool to draw an arbitrary path. If you draw a shape when a layer is selected, the shape becomes a mask for that layer; the cursor displays a masked box (Cursor with masked box icon) as you start to draw. If you draw a shape when no layer is selected, After Effects creates a shape layer; the cursor displays a star (Cursor with star icon) as you start to draw.

Remapping time – Animating Layers

You’re ready to manipulate the speed and direction of time in your project.

  1. With the Pre-comp 1 layer selected in the Timeline panel, choose Layer > Time > Enable Time Remapping.

After Effects adds two keyframes, at the first and last frames of the layer, visible in the time ruler. A Time Remap property also appears under the layer name in the Timeline panel; this property lets you control which frame is displayed at a given point in time.

  1. With the Pre-comp 1 layer active, choose Layer > Open Layer to open it in the Layer panel.

The Layer panel provides a visual reference of the frames you change when you remap time. It displays two time rulers: The time ruler at the bottom of the panel displays the current time. The Source Time ruler, just above the time ruler, has a remap-time marker that indicates which frame is playing at the current time.

  1. Press the spacebar to preview the layer, and notice that the source-time and current-time markers in the two Layer panel rulers are synchronized. That will change as you remap time.
    Over the first four seconds, the lights come on slowly. You’ll speed that section up so that the lights come on twice as fast.
  2. Go to 2:00, and change the Time Remap value to 4:00.
    This remaps time so that frame 4:00 plays at 2:00. In other words, the clip now plays back at twice the speed for the first two seconds of the composition.
  1. Press the spacebar to preview the animation. The composition now runs at double-speed until 2:00, and at a slower speed thereafter. Press the spacebar again when you have finished previewing the animation.

Viewing time remapping in the Graph Editor
Using the Graph Editor, you can view and manipulate all aspects of effects and animations, including effect property values, keyframes, and interpolation. The Graph Editor displays changes in effects and animations as a two-dimensional graph, with playback time represented horizontally (from left to right). In layer bar mode, in contrast, the time ruler represents only the horizontal time element, without a graphical display of changing values.

  1. Make sure the Time Remap property is selected for the Pre-comp 1 layer in the Timeline panel.
  2. Click the Graph Editor button ( ) to display the Graph Editor.

The Graph Editor displays a time-remap graph that shows a white line connecting the keyframes at 0:00, 2:00, and 10:00. The angle of the line is steep up to 2:00, and then becomes shallower. The steeper the line, the faster the playback time.

Viewing render times for layers – Animating Layers

In a complex project, it can be helpful to know which components are contributing to long render times. For example, you may find it helpful to turn off some layers or specific effects while you work on other aspects of your project.

You can see the overall render time for the current frame at the bottom of the Timeline panel. When you turn on the Composition Profiler, you can see the rendering time of each layer, effect, mask, and layer style in the current frame in the Render Time column.

  1. Click the snail icon (Snail icon) at the bottom of the Timeline panel.

The Render Time column appears in the Timeline panel, displaying the render time for each layer active in the current frame.

  1. Drag the current-time indicator across the time ruler to see how render times differ for each layer on different frames.
  2. Expand the Starburst layer. Notice that the layer styles that were applied in Photoshop increase the render time.
  1. Hide layer properties. Click the snail icon again to turn off the Composition profiler, or leave it on if you want to see how rendering times are affected by changes you make to layers.

Retiming the composition
So far, you have created a straightforward time-lapse simulation. That’s fine, but After Effects offers more ways to play with time using the time-remapping feature. Time remapping lets you dynamically speed up, slow down, stop, or reverse footage.
Tip
You can get even finer control with the Timewarp effect, which you’ll use in Lesson 14, “Advanced Editing Techniques.”
You can also use it to do things like create a freeze-frame result. The Graph Editor and the Layer panel are a big help when remapping time, as you’ll see in the following exercise, when you retime the project so that the time-lapse speed changes over the course of the movie.

Precomposing layers
For this exercise, you’ll duplicate the composition and then precompose the layers, which will be easier to remap than the original.

  1. Select the marquee composition in the Project panel, and choose Edit > Duplicate.
    A marquee 2 composition appears in the Project panel.
  2. Double-click the marquee 2 composition to open it in the Composition and Timeline panels.
  1. In the marquee 2 Timeline panel, select the Starburst layer and then Shift-select the Unlit marquee layer, so that all the layers are selected.
  2. Choose Layer > Pre-compose.
  3. In the Pre-compose dialog box, make sure Move All Attributes Into The New Composition is selected, and then click OK.

After Effects creates a new composition named Pre-comp 1, which replaces the layers you selected in the marquee 2 composition. Now you can remap all of the elements of the project at once.

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.

Duplicating an animation using the pick whip – Animating Layers

The Starburst layer includes the Bevel And Emboss layer style from Photoshop. You’ll animate the bevel, which makes the starburst appear backlit, so that it lights up as the marquee does.

To do this, you’ll use the pick whip to duplicate the animation you just created. You can use the pick whip to create expressions that link the values of one property or effect to another. In this case, you’ll link the opacity of the Lit marquee layer to the Depth property of the Bevel And Emboss effect in the Starburst layer.

  1. Press the Home key or move the current-time indicator to the beginning of the time ruler.
  2. Expand the Starburst layer, and then expand its Layer Styles > Bevel And Emboss properties.
  1. If necessary, enlarge the Timeline panel so that you can see both the Lit marquee and Starburst properties.
  2. Make sure the Opacity property is still visible for the Lit marquee layer.
  3. Click the pick whip icon ( ) for the Depth property in the Starburst layer, and drag it to the Opacity property name for the Lit marquee layer. When you release the mouse, the pick whip snaps, and the Depth property value is red.
  1. Expand the Depth property for the Starburst layer. An expression in the Starburst layer time ruler now reads “thisComp.layer(“Lit marquee”).transform.opacity.” This means that the Opacity value for the Lit marquee layer replaces the previous Depth value (105%) for the Starburst layer.
  1. Drag the current-time indicator from 0:00 to 4:00. Notice that the Opacity value for the Lit marquee layer and the Depth property for the Starburst layer increase simultaneously. The area around the starburst and the marquee light bulbs brighten in sync.
  1. Hide the properties for all layers to keep the Timeline panel tidy. If you enlarged the Timeline panel, return it to its original size.
  2. Choose File > Save to save your project.

About Photoshop layer styles

Adobe Photoshop provides a variety of layer styles—such as shadows, glows, and bevels—that change the appearance of a layer. After Effects can preserve these layer styles when you import Photoshop layers. You can also apply layer styles in After Effects.

Though layer styles are referred to as effects in Photoshop, they behave more like blending modes in After Effects. Layer styles follow transformations in the standard render order, whereas effects precede transformations. Another difference is that each layer style blends directly with the underlying layers in the composition, whereas an effect is rendered on the layer to which it’s applied, the result of which then interacts with the underlying layers as a whole.

The layer style properties are available for the layer in the Timeline panel.

To learn more about working with layer styles in After Effects, see After Effects Help.

Creating the composition – Animating Layers

For this lesson, you’ll use the imported Photoshop file as the basis of the composition.

  1. Double-click the marquee composition in the Project panel to open it in the Composition panel and in the Timeline panel.

Note
If you don’t see the full image, choose Fit from the Magnification Ratio pop-up menu in the Composition window.

  1. Choose Composition > Composition Settings.
  2. In the Composition Settings dialog box, change the Duration to 10:00 to make the composition 10 seconds long if it isn’t already, and then click OK.

Simulating lighting changes

The first part of the animation involves lighting the marquee. You’ll use Opacity keyframes to animate the light.

  1. Go to 4:00.

Currently, the lit background is on top of the regular (unlit) background, obscuring it so the initial frame of the animation is bright. However, you want the marquee to appear dark and then lighten. To accomplish this, you will make the Lit marquee layer initially transparent, and then animate its opacity so that the lights appear to turn on over time.

  1. Select the Lit marquee layer in the Timeline panel, and click the stopwatch icon ( ) next to the Opacity value in the Properties panel to create a keyframe. Note that the Opacity value is 100%.
  1. Press the Home key or drag the current-time indicator to 0:00. Then change the Opacity to 0%. After Effects adds a keyframe.

Now, when the animation begins, the Lit marquee layer is transparent, which allows the Unlit marquee layer to show through.

  1. Click the Play/Pause button ( ) in the Preview panel, or press the spacebar, to preview the animation.

The bulbs around the marquee transition until they are brightly lit.

  1. Press the spacebar to stop playback at any time after 4:00.
  2. Choose File > Save.

Importing the footage – Animating Layers

You need to import one source item for this lesson.

  1. Double-click an empty area of the Project panel to open the Import File dialog box.
  2. Navigate to the Lessons/Lesson06/Assets folder on your hard disk, and select the marquee.psd file.
  3. Choose Composition – Retain Layer Sizes from the Import As menu, so the dimensions of each layer will match the layer’s content. (In macOS, you may need to click Options to see the Import As menu.)
  4. Click Import or Open.
  1. In the marquee.psd dialog box, make sure Editable Layer Styles is selected in the Layer Options area, and click OK.
    Before continuing, take a moment to study the layers of the file you just imported.
  2. In the Project panel, expand the marquee Layers folder to see the Photoshop layers. Resize the Name column to make it wider and easier to read, if necessary.

Each of the elements you’ll animate in After Effects—such as the starburst—is on a separate layer. In addition, there is one layer representing the initial marquee with plain light bulbs (Unlit marquee) and a second layer that represents the final marquee with the bulbs brightly lit (Lit marquee).

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, which you don’t happen to be using in this project.

Preparing layered Photoshop files

Before you import a layered Photoshop file, name its layers carefully to reduce preview and rendering time, and to avoid problems importing and updating the layers:

  • Organize and name layers. If you change a layer name in a Photoshop file after you have imported the file into After Effects, After Effects retains the link to the original layer. However, if you delete a layer in a Photoshop file after you have imported the file into After Effects, After Effects will be unable to find the original layer and will list it as missing in the Project panel.
  • To avoid confusion, make sure that each layer has a unique name.

Applying the effects – Animating a Multimedia Presentation

You’re ready to apply the effects to the solid layer. The Fractal Noise effect will create the gust of wind. The Directional Blur effect will create a blur in the direction the canvas flies.

  1. In the Effects & Presets panel, search for the Fractal Noise effect; it’s in the Noise & Grain category. Double-click the Fractal Noise effect to apply it.
  2. In the Effect Controls panel, do the following:

• Choose Smeary for the Fractal Type.
• Choose Soft Linear for the Noise Type.
• Set the Contrast to 700.
• Set the Brightness to 59.
• Expand the Transform properties, and set the Scale to 800.

  1. Click the stopwatch icon next to Offset Turbulence to create an initial keyframe at the beginning of the time ruler.
  2. Go to 2:00, and change the x value for Offset Turbulence to 20,000.
  3. Hide the Fractal Noise properties in the Effect Controls panel.
  4. In the Effects & Presets panel, search for the Directional Blur effect, and then double-click it to apply it.
  5. In the Effect Controls panel, set the Direction to 90 degrees and the Blur Length to 236.

You’ve created a sense of motion. Now you need to add the Wind composition to the Balloon Scene composition.

  1. Switch to the Balloon Scene Timeline panel.
  2. Click the Project tab, and then drag the Wind composition from the Project window into the Balloon Scene Timeline above all the other layers.
  3. Go to 8:10, and then press the left bracket key ([) so that the Wind layer starts at 8:10.
    Finally, you’ll apply a blending mode and adjust the opacity to make the effect of the wind more subtle.
  4. Click Toggle Switches/Modes at the bottom of the Timeline panel to view the Mode column.
  5. Choose Screen from the Wind layer’s Mode pop-up menu.
  6. With the Wind layer selected, click the stopwatch icon for the Opacity property in the Properties panel to create a keyframe at the beginning of the layer (8:10).
  1. Go to 8:20, and change the opacity to 35%.
  2. Go to 10:20, and change the opacity to 0%.
  3. Hide the Opacity property in the Timeline panel, and then save your work so far.