Master the technique of adding masks to layers, using track mattes, and applying effects in After Effects with this detailed tutorial.
This exercise is excerpted from Noble Desktop’s Adobe After Effects training materials and is compatible with After Effects updates through 2023. To learn current skills in After Effects with hands-on training, check out our After Effects Bootcamp, Motion Graphics Certificate, and motion graphics design classes in-person and live online.
Topics covered in this After Effects tutorial:
Adding Masks to Layers, Using Track Mattes, Adding Effects
Exercise Preview
Exercise Overview
In this exercise you’ll learn how to hide parts of layers using Masks and Track Mattes.
Getting Started
-
You should still have Your Name - Infographic Animation.aep open in After Effects. If you closed it, re-open it now by going to File > Open Project then Desktop > Class Files > After Effects Class > Infographic Animation.
If you did not complete the previous exercise (3A) including the optional bonus, do the following sidebar.
If You Did Not Complete the Previous Exercise Including Bonus
- If a project is open in After Effects, go to File > Save, then File > Close Project.
- Go to File > Open Project and navigate to Desktop > Class Files > After Effects Class > Infographic Animation > Finished Projects.
- Double–click on Infographic Animation - Ready for Masks.aep.
-
Go to File > Save As > Save As and:
- Name the file Your Name - Infographic Animation.aep
- Save it to Desktop > Class Files > After Effects Class > Infographic Animation (replacing the file if it’s already there).
Animating the Headline
While we can convert imported Illustrator layers into After Effects Shape layers, we cannot convert Illustrator text layers into After Effects text layers (that only works with imported Photoshop text layers).
To animate the headline as two separate pieces, we’ll use masks to break it up.
Move the playhead to the beginning of the Timeline.
-
At the bottom of the Composition panel, click the Grid & Guide Option button
and choose Proportional Grid.
The Proportional Grid gives us a reference for where to move our layer while animating it and also later for how large to make our masks.
- In the Timeline, drag the Headline layer to the top of the layer stack.
- Select the Headline layer.
- Press P to reveal the Position property.
- Move the playhead to 0;10
- Click on the Position stopwatch
.
- Move the playhead to the beginning of the Timeline.
- Hover the cursor over the second Position value and drag it to the right until the text moves a bit below the first grid line (we made it 260).
- It’s time to add the overshoot. Move the playhead to 0;06
- Hover over the second Position value and drag to the left until the layer is vertically centered in the top row of the grid (we made it 90).
Ctrl–click (Mac) or Right–click (Windows) on the new (middle) keyframe and choose Keyframe Assistant > Easy Ease.
-
Use the Spacebar to preview the animation.
The headline should quickly move up, overshoot its final position slightly and drop down into the final position.
- Move the playhead to any time after the end of the headline animation (so we can see the headline in its final position).
At the bottom of the Composition panel, click the Grid & Guide Option button
and choose Proportional Grid to hide it.
Adding Masks to Layers
-
Ctrl–click (Mac) or Right–click (Windows) on the Headline layer and choose Rename.
- Rename the layer Headline 1 and hit Return (Mac) or Enter (Windows) to apply it.
With the Headline 1 layer selected, hit Cmd–D (Mac) or Ctrl–D (Windows) to duplicate it, creating Headline 2.
-
In the Tools panel, select the Rectangle tool
.
If you do not see the Rectangle tool, you should see another shape tool (Ellipse, Polygon, etc). Click and hold on the shape tool and choose the Rectangle tool.
With the Headline 2 layer still selected, draw a rectangle around the words Use Social Media.
- Select the Headline 1 layer.
Draw a rectangular mask around the words How Many U.S. Adults.
- In the Timeline, click the eye
off and on for both layers to see each layer only shows the words inside its layer mask.
- Make sure both layers are visible.
- Select both Headline layers (click on one, then Shift–click the other).
- Hit Cmd–Tilde (Mac) or Ctrl–Tilde (Windows) to hide their visible properties.
Hit Cmd–Shift–A (Mac) or Ctrl–Shift–A (Windows) to deselect all layers.
Using Track Mattes
In After Effects, a track matte a technique that uses one layer to control the transparency of another layer. The term is also used to refer to the layer that is being used as the matte. This matting effect can be based on either a layer’s alpha (transparency) or its luminance (brightness).
-
Move the playhead to the beginning of the timeline.
Notice the text is already visible. We want to initially hide it, and have it appear as it slides up. We’ll do this with track mattes.
Move the playhead to 0;10 (which is after the headline animation is done).
Select the Headline 1 layer.
-
Choose Layer > New > Solid or press Cmd–Y (Mac) or Ctrl–Y (Windows).
We’ll use this layer to matte out (hide parts of) the headline animation.
Do NOT click OK until we tell you to. Uncheck Lock Aspect Ratio.
Click the Make Comp Size button to make the new layer’s dimensions match the composition.
-
We want this layer to be 1/5th of the height of comp. In the Height field type 1080/5 and press Tab.
Notice that After Effects did the math for you!
NOTE: You can do math in most fields of Adobe apps. Use plus (+) for addition, minus (-) for subtraction, slash (/) for division, and asterix (*) for multiplication.
-
Change the Name to Headline Solid.
NOTE: The color is irrelevant for what we’re going to use it for.
- Click OK.
- In the Tools panel, choose the Selection tool
.
- To the right of the Tools panel, check on Snapping.
- In the Composition panel, position the cursor at the top of the solid shape and drag it to the top of the composition (it should snap to the top edge).
- To the right of the Tools panel, uncheck Snapping.
- Click on the Headline Solid layer in the Timeline.
-
Press Return (Mac) or Enter (Windows) and rename the layer Matte 1.
Press Return (Mac) or Enter (Windows) again to finalize the change.
If you are currently viewing the layer switches
, go to the bottom of the Timeline and click the Toggle Switches/Modes button.
For the Headline 1 layer, set the Track Matte menu to Matte 1.
- Select the Matte 1 layer.
- Press Cmd–D (Mac) or Ctrl–D (Windows) to duplicate it.
- Drag the new Matte 2 layer above the Headline 2 layer.
- For the Headline 2 layer, set the Track Matte menu to Matte 2.
-
Move the playhead to the beginning of the timeline.
Notice the text is now hidden, so it will appear as it slides up.
-
Use the Spacebar to preview the animation.
The headline is only visible within the shape of the track matte layer, giving the impression that it’s appearing out of thin air.
Choose File > Save or hit Cmd–S (Mac) or Ctrl–S (Windows).
Adding & Copying Effects
Effects can be added to any layer and are usually used to alter its appearance. Let’s add a drop shadow effect to mimic the appearance of the infographic layers.
- Position the playhead so you can see the headline text.
- Select the Headline 2 layer.
- If you don’t see the Effects & Presets panel on the right of the window, choose Window > Effects & Presets.
- In the Effects & Presets panel’s search field type drop
Double–click on the Drop Shadow effect (it’s under Perspective) to apply it to the selected layer.
-
In the Effect Controls panel (at the top left of the window) set the following:
- Distance: 13
- Softness: 36
- Opacity: 40
- Direction: 0x+224
At the top of Effect Controls panel, Ctrl–click (Mac) or Right–click (Windows) on the Drop Shadow effect name and choose Copy.
- In the Timeline, select the Headline 1 layer.
- Hit Cmd–V (Mac) or Ctrl–V (Windows) or choose Edit > Paste.
- Select the Matte 2 layer.
- Hold Shift and click on the Headline 1 layer to select it and all layers in between.
-
Click on the label color for any of the selected layers and choose Yellow.
This helps us quickly identify that the matte layers go with the headline layers.
Hit Cmd–Shift–A (Mac) or Ctrl–Shift–A (Windows) to deselect all the layers.
Manually Sequencing Layers
We want each social media animation to appear one after another (in a sequence), and we want the 2 parts of the headline to come in slightly staggered. We’ll show you several techniques for positioning layers within the timeline.
- In the Timeline, select the Matte 2 layer.
Hold Shift and select the Headline 2 layer.
Move the playhead to 0;03
Hit the
[
left bracket key to move the In point of the selected layers to the playhead.Use the Spacebar to preview the headline animation (the parts are now staggered).
Select the 4 purple Twitter layers (click on the first, then Shift–click the last).
Move the playhead to 0;20
-
Drag the Twitter layers towards the playhead:
- Press and hold Shift as you drag the layers.
- Stop dragging when the Twitter Logo layer snaps to the playhead.
- Press Cmd–Shift–A (Mac) or Ctrl–Shift–A (Windows) to deselect all the layers.
Move the playhead to 1;20 (1 second 20 frames).
Select the 4 red Instagram layers.
-
Drag the Instagram layers towards the playhead:
- Press and hold Shift as you drag the layers.
- Stop dragging when the Instagram Logo layer snaps to the playhead.
- Press Cmd–Shift–A (Mac) or Ctrl–Shift–A (Windows) to deselect all the layers.
Move the playhead to 2;20
Select the 4 blue Facebook layers.
-
Drag the Instagram layers towards the playhead:
- Press and hold Shift as you drag the layers.
- Stop dragging when the Facebook Logo layer snaps to the playhead.
- Press Cmd–Shift–A (Mac) or Ctrl–Shift–A (Windows) to deselect all the layers.
-
Use the Spacebar to preview the animation.
Each social media chart animation is now starting at a different time, created an animation that’s easier to understand for the viewer (and more visually appealing).
Choose File > Save or hit Cmd–S (Mac) or Ctrl–S (Windows).
Informational: Mask vs. Track Mattes
Masks and track mattes can both be used to control the visibility of a layer. The main difference between the two is the mask is a part of a layer, whereas the track matte effect uses a completely independent layer.
So a mask will rotate, scale, and move as the layer it’s on does, while a track matte is good if you need independent control of each layer’s transform properties.