Adobe After Effects: Masks & Track Mattes

You might want to hide and reveal parts of a layer in your animation. Masks and Mattes can help you achieve this. While Masks are applied to an existing layer (and will be created as a sublayer), Mattes are created as independent layers that are subsequently paired with another one.

Screen Shot 2018-08-21 at 9.19.54 AM
Mask applied to a Text Layer (inside the Text Layer in the Timeline Window)

Creating and animating Masks

Masks have to be created within an existing layer and will move alongside it (i.e: if a layer moves from the top to the bottom of the composition, its mask will follow it). Masks also have their own properties and can change over the course of the animation.

This simple tutorial will demonstrate how to create and edit Masks You can watch the finished example below and download the .aep file here:

https://vimeo.com/285880974

Let’s start by creating a new Composition

  • Go to Composition > New Composition (or Command + N) and use the following Settings:
    • Name: “Mask Example”
    • Preset dropdown: HDTV 1080 29.97
    • Duration: 0;00;05;00
    • Set the background color by clicking on the color swatch at the bottom of the Window

In this example, we’ll mask a Text Layer, but masks can be applied to Solids and Shapes as well. Let’s create a Text layer:

  • Activate the Text tool.
  • Set the options in the Characters and Paragraph panels. In this example we’ll start with:
    • Font: Future, Bold
    • Size: 145px
    • Fill: #FFFEB9, No Stroke
    • Center Text
  • Click on the Composition and type “let there be”, go to the line (Enter)“LIGHT”
  • Highlight “LIGHT” and increase the font size until it’s about as wide as the line above (~290px)

We’ll also center the layer on the Composition:

  • Go to Layer > Transform > Center Anchor Point in layer Content
  • Go to Layer > Transform > Center in View
Screen Shot 2018-08-20 at 1.52.33 PM
Centered Text Layer

The Shape, Pen and Text tools can all be used to create Masks. But in order to do so, (rather than create a new layer) an existing layer must be selected:

  • Make sure the Text Layer is selected/highlighted in the Timeline
  • Select the Ellipse tool from the Shape tool dropdown. You’ll notice that there are no Fill/Stroke options since the shape will be applied as a mask on the active layer.
  • Click and drag on the Composition to create your Mask. In this instance we’re creating small circle on the “I” of “LIGHT”. Notice that a Mask 1 tab has been added to the Text Layer
Screen Shot 2018-08-20 at 1.54.38 PM
Mask applied to the Text Layer
Screen Shot 2018-08-20 at 1.55.51 PM
Mask 1 tab added to the Text Layer

A mask can change over time. Its properties are located within the Mask 1 tab. We’ll start by increasing and decreasing the feathering of the ellipse to mimick a pulsing light:

  • Set the Time Indicator to where you want the feathering to start (0;00;00;00)
  • Toggle the arrow next to the Mask 1 tab
  • Click on the little Stop Watch next to the Mask Feather property and set its value to the lowest feathering point you wish to have (i.e: 2px)
  • Set the Time Indicator to how long you want the increase of feathering to take (0;00;00;20)
  • Set the value of the Mask Feather property the highest feathering value you wish to have (i.e: 5px)
  • Select both Keyframes, copy them (Command + N) and paste them (Command + V) every 20 frames (starting at frame 0;00;01;10)
Screen Shot 2018-08-20 at 2.06.08 PM
Keyframes on the Mask Feather property (from 2px to 5px every 20 frames)

You can also change the way the Mask is interacting with the layer by changing the Blending Mode dropdown and/or turning the Inverted option on and off. In this instance we’ll keep the default values (Blending: Add; Inverted: Off), but you should play around with these values to see how they affect the Composition.

Screen Shot 2018-08-21 at 9.26.21 AM
Blending Mode and Inverted options

Next, we’ll expand the mask to reveal the text:

  • Set the Time Indicator to where you want the expansion to start (0;00;03;15)
  • Click on the little Stop Watch next to the Mask Expansion property. Don’t change its current value
  • Set the Time Indicator to where you want the expansion to stop (0;00;03;20)
  • Increase the Mask Expansion property value until you can see the entire text (~905px)
Screen Shot 2018-08-20 at 2.13.37 PM
Mask expanding in the Composition
Screen Shot 2018-08-20 at 2.13.30 PM
Keyframes on the Mask Expansion property (from 0px to 905px)

As mentioned at the beginning of this tutorial, a Mask will move alongside its Layer. Let’s demonstrate this by moving the animating the Text Layer dropping from the top to the center of the Composition:

  • Set the Time Indicator to where you want the Text to reach its final (center) position (0;00;02;15)
  • Toggle the arrow next to the Text Layer’s Transform tab
  • Click on the little Stop Watch next to the Position property. Don’t change its current value (since we previously centered the layer)
  • Set the Time Indicator to where you want the Text to start (0;00;00;00)
  • Lower the value of the Y axis in the Position property until the mask is above the Composition (~-230).
Screen Shot 2018-08-20 at 2.19.31 PM
Keyframes on the Text Layer’s Position property (from bottom to center of the Composition)

Creating and animating Track Mattes

When you want the layer to move independently from its masking element, Track Mattes are a great solution. Unlike Masks, they are created on their own layer and paired with the layer below  to hide/reveal it.

This simple tutorial will demonstrate how to create and edit Track Mattes. You can watch the finished example below and download the .aep file here:

https://vimeo.com/286011756

I’ll be using an Illustrator file as the background image. You can download it here.

Let’s start by creating a new Composition

  • Launch Adobe After Effects and create and save a new Project
  • Go to Composition > New Composition (or Command + N) and use the following Settings:
    • Name: “Track Matte Example”
    • Preset dropdown: HDTV 1080 29.97
    • Duration: 0;00;05;00
    • Set the background color by clicking on the color swatch at the bottom of the Window

Next, we’ll import and adjust our background image:

  • Go to File > Import > File… (or Command + I) and select the file you wish to use in your composition (in this example: “week10_trackMatte_coffee.ai”). Notice that the file has been added to the Project panel.
Screen Shot 2018-08-21 at 10.25.23 AM
Imported Adobe Illustrator file
  • Drag and drop the newly imported file onto the Composition. Notice that it’s also been added as a layer in the Timeline.
  • Scale the image so it fits comfortably in the Composition: Toggle the arrow next to the layer’s name, toggle the Transform menu and adjust the Scale property (and any other property you’d like).
Screen Shot 2018-08-21 at 10.29.38 AM
Illustrator file’s Transform properties (in the Timeline window).
Screen Shot 2018-08-21 at 10.28.38 AM
Illustrator file in the Composition

Next, we’ll create the layer we want to partially hide/reveal through the course of the animation. In order to create a seamless loop, we’ll start and end with the same word.

Set the options in the Characters and Paragraph panels. In this example we’ll use with:

  • Font: Gill Sans, Bold
  • Size: 100px
  • Fill: #FFCC56, No Stroke
  • All Caps

Now, let’s type our text:

  • Activate the Text tool
  • Click on the Composition and type “COFFEE LATTE ESPRESSO CAPPUCCINO COFFEE”. Make sure there is a fair amount of space between each word (hit the tabkey three times between each one)
  • Position the Text layer where you’d like it to appear on the cup once it is masked.
Screen Shot 2018-08-21 at 10.50.00 AM
Text layer positioned on the Composition

Next, we’ll create the Shape we want to use for our Matte. We’ll use the Pen tool to outline the shape of the coffee mug’s cardboard:

  • Make sure the Text Layer isn’t selected
  • Activate the Pen tool.
  • Since this shape will be applied at as a Matte, it’s Fill and Stroke doesn’t really matter.
  • Click to create a shape that covers part of the cup’s cardboard. Don’t worry about it being perfect that first time around. You can always adjust anchor points with the Pen tool. You’ll also notice that a new Shape Layer has been created in the Timeline.
  • Let’s rename our layer “Cardboard Matte”.
Screen Shot 2018-08-21 at 11.26.27 AM
Shape created with the Pen tool for the Matte

We now must tell our Text Layer to use our “Cardboard Matte” Shape Layer as a Matte:

  • Make sure that the Mode and Track Matte options are visible in the Timeline window by Toggling the “Toggle Switches/Modes” button at the bottom of the panel.
  • Set the Track matte dropdown of the Text Layer to Alpha Matte “Cardboard Matte”. Notice that the Cardboard Matte layer is automatically hidden (the little eye icon is off) and that only the text currently positioned inside the Matte is visible.
Screen Shot 2018-08-21 at 11.34.32 AM
Toggle Switches / Modes button (to show the Mode and TrkMat options), Text Layer set to follow the Alpha Matte, Cardboard Matte layer hidden
Screen Shot 2018-08-21 at 11.33.29 AM
Alpha Track Matte “Cardboard matte” applied to the Text Layer

We can now get our text layer to scroll, while our Matte stays in place:

  • Display the Transform properties of the Text Layer
  • Bring the Time Indicator to where you’d like the scrolling to start (0;00;00;00)
  • Click on the little Stop Watch icon next to the Position property and adjust the X value until the first word is displayed in the center of the cup.
  • Bring the Time Indicator to where you’d like the scrolling to end (0;00;04;29)
  • Adjust the X value until the last word is displayed in the center of the cup.
  • Hit the Spacebarto Preview the animation. The text should scroll from left to right and loop seamlessly.
Screen Shot 2018-08-21 at 11.41.59 AM
Position property of the Text Layer and its 2 keyframes (scrolling the text)