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.

Creating a Bezier mask – Working with Masks

You used the Convert Vertex tool to change a corner vertex to a smooth point with Bezier handles, but you could have created a Bezier mask in the first place. To do so, click in the Composition panel with the Pen tool where you want to place the first vertex. Then click where you want to place the next vertex, and drag in the direction you want to create a curve. When you are satisfied with the curve, release the mouse button. Continue to add points until you’ve created the shape you want. Close the mask by either clicking on the first vertex or double-clicking the last vertex. Then switch to the Selection tool to refine the mask.

Feathering the edges of a mask

The mask looks good, but the edge of the screen looks a little too sharp and unrealistic. To address this, you’ll feather, or soften, the edges.

  1. Select the TabletVideo.mov layer in the Timeline panel, and press the F key to display the Mask Feather property for the mask.
  2. Increase the Mask Feather amount to 3.0, 3.0 pixels.
  1. Hide the properties for the TabletVideo.mov layer, and then choose File > Save to save your work.

Replacing the content of the mask
You are now ready to replace the background with the video of a sea turtle and blend it with the overall shot.
Tip
In effects that reference layers, you can use masks for greater control over the effect’s influence. You can also use expressions to animate mask points.

  1. In the Project panel, select the SeaTurtle.mov file and drag it to the Timeline panel, placing it below the TabletVideo.mov layer.
  1. Choose Fit Up To 100% from the Magnification Ratio pop-up menu at the bottom of the Composition panel so that you can see the whole composition.
    Note
    If you’re using a Mac with Retina display, you’ll see Fit Up To 200%.
  2. Select the Selection tool ( ), and then drag the SeaTurtle.mov layer in the Composition panel slightly to the left, centering it in the tablet screen.
  3. Go to 2:07. In the Timeline panel, drag the entire SeaTurtle.mov layer to the right so that it begins at 2:07 and ends at the same time as the TabletVideo.mov layer.

Zooming and panning by touch

If you’re using a touch-enabled device, such as a Microsoft Surface, Wacom Cintiq Touch, or multi-touch trackpad, you can use your fingers to zoom and pan. Touch gestures let you zoom and pan in the Composition, Layer, Footage, and Timeline panels.

To zoom: Pinch two fingers closer together to zoom in, or move them further apart to zoom out.

To pan: Move two fingers in unison to pan up, down, left, or right in the panel’s current view.

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.

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.

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.

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.