Power Up Your Graphics With Animated Masks in After Effects

Of all the great features inside of Adobe After Effects, the mask is my favorite. With only a handful of customizable attributes, this little tool packs a punch. When working with motion graphics, think of it as your Swiss Army Knife.

Masks The Mask

To show you just how versatile the mask is, I’m going to create a quick motion graphics project using masks nearly every step of the way. First, I’ll show you how to bring life to text layers. Then I’ll go over a few different ways to animate objects with a mask. Finally, I’ll bring the whole project together by showing you how to create a variety of different wipe transitions.

I’ll assume that you have a basic idea of how After Effects works.

Let’s get started!

Bringing Text to Life

Okay, so let’s say that we’re working for a travel agency, and they have commissioned us to create a five-second ad that will be posted as an animated gif on various websites. The spot will consist of two different text elements and a handful of other graphics and illustrations.

For the text, I’ll be using the words TRAVEL and EXPLORE. I want both of these words to have a similar minimalist look—something simple yet sleek. Each word will come on and off screen via a reveal animation effect. Here’s what the finished animation will look like.

Masks Animated Text 01

Let’s see how I can use a mask to bring this animation to life.

First off, let me quickly explain how the tools work, because this can be a bit confusing. We’ll be using the pen Tool and the rectangle tool a lot. These two tools help you create various shapes, but there are two different types of shakes that we create in AE: masks, and shape layers.

If you draw a shape with a layer selected, then you will create a mask. A mask is essentially a way to block out part of the layer you’ve selected. If you you draw a shape with no layer selected, then AE will create a new shape layer. This is not a mask—it’s an entirely new element.

For the first step I’ll create my TRAVEL text layer along with a simple horizontal line. I can create the horizontal line using the pen tool (this will be a shape layer, not a mask). Once I have the pen tool selected I will choose a white stroke with a width of 5 pixels and no fill. Two clicks (one shift-click to keep things straight) will give me my line, along with a new shape layer in the timeline panel. This horizontal line will serve as the object I can use to reveal my text layer.

Masks Line

To create the illusion that the horizontal line is revealing the text, I need to apply an animated mask to the text layer. I can add a mask to a layer with the same pen tool that I used to create my line object. In this case, though, I will use the rectangle tool to get a more symmetrical mask.

Masks Text Mask Masks Rectangle Tool Masks Animated Mask Keyframes

To bring the animation to life, I’ll simply add four keyframes to the mask path attribute which will bring the mask in and then back out, revealing the text and then hiding it again.

Once I have the mask animated to reveal the text, I’ll keyframe the position attribute of my line to perfectly align with the movement of the bottom edge of the mask on my text layer. This will give the illusion that the line is revealing the text. Again, this is what I came up with.

Masks Animated Text 01 1

Now that I have this element built, I can simply duplicate this comp to create my other word.

Animate Along a Path

Now that my text is in place and ready to go, I can begin to focus on a few of the other shots. Two shots in particular are going to require some very basic animation. For my first shot I want to have a rocket circling the earth, while the second shot will be a plane flying through the screen. Masks are going to help me out a lot here, too.

Masks Rocket and Earth

For the first shot, I could just go ahead and keyframe the position and rotation attributes of the rocket layer to make it smoothly orbit the earth. While this may only take a few minutes to animate, there is in fact a much faster and more efficient way. I can accomplish this same effect by simply converting a mask path into position keyframes. Essentially, I will tell the rocket to follow the route that I draw with my mask.

First, I’ll select the rocket layer in the timeline and switch my shape tool from rectangle to ellipse. With my rocket layer selected, I’ll click and drag holding shift to create a perfect circle around the earth layer, positioning it specifically where I want my rocket’s flight path to reside. Since I’ve just added a mask to this layer, the rocket will disappear (I’m masking out everything in this layer that’s not inside my circle). I’ll change the mask mode to None, essentially disabling it, so that I can see what I’m doing. Once I’ve got the path roughed in, I’m now ready to convert the path to position keyframes.

Masks Mask Path

Here’s where the magic happens. I will open up the mask properties in the timeline and select the mask path attribute.

Masks Copy Mask Path

All I need to do is simply copy the mask path and then paste directly onto the position attribute of the rocket layer. Once I paste on the position attribute, keyframes will be added following the shape of the original mask path. Now my rocket will orbit the earth layer. However, there’s a slight problem—the rocket is not turning as it orbits the earth.

To fix this, I could go in and keyframe my rotation property, but this is a bit too tedious for my taste. A much easier way is to grab the rocket layer and select Layer > Transform > Auto-Orient > Orient to Path. Now the rocket will rotate accordingly as it follows the path. If it’s still not facing in the right direction, however, I can now manually adjust the rotation so that it will point forward. Once it’s in position I won’t have to add any additional keyframes. Voila, a rocket circling the world.

Masks Animated Path 02

Now that the animation is working properly, I can delete the mask and drag the  the keyframes around however I want to change the timing.

I can apply the same technique to my second shot as well. For this particular shot I want to have my plane fly through the screen with a little bit of extra movement. This time I’ll use the pen tool to create a flight path. I’ll apply the mask directly to my airplane layer with three simple points.

Masks Animated Path

Now I can once again copy the mask path information and paste it directly onto the airplane’s position property. Once pasted, I have new position keyframes and an airplane that is flying through the screen. I now have three position keyframes that correspond to the three points in the mask that I drew, and I can change the timing of the animation by dragging them around in my timeline.  Once I’m happy, I’ll delete the original mask.

Masks Airplane Flying

Be aware that you can also copy the path information of shape layer paths just as you can with masks. Simply open up the shape layer properties in the timeline panel, select and copy the shape path, and then paste to the desired layer’s position attribute.

Create Dynamic Transitions

With both my text and graphic assets prepped, I can now begin to piece these elements together. Instead of using straight cuts, I want to create more dynamic transitions, via animated masks of course.

With masks I can create a wide variety of different wipe transitions. Most of these are extremely easy to make, taking no more than a few minutes to put together. Creating a wipe is as simple as masking a layer and then adding keyframes to animate the mask to move on and off screen. The key to making them work is to be sure that you properly time the transition and overlay the clips accordingly.

Prebuilt wipe effects can often get the job done, of course, but you have far more control if you build the transitions yourself.

For this particular video piece, I want the beginning of my video to quickly transition from a full screen map graphic to my TRAVEL text element animation. To create this, I’ll first add a mask to the map via the rectangle tool. I want my wipe transition to be at an angle, so I’ll grab the bottom left point of my mask and drag it inwards to slightly tweak the edge. Now I can animate the mask path attribute to bring it on and off screen as I like.

When you’re tweaking a mask shape like this, switch to the arrow tool (V) than the pen or rectangle tools.

Masks Wipe Transition Masks Wipe Transition Full

Next, I want to make a quick montage sequence of a number of different map images. Again, as opposed to creating a boring edit with straight cuts, I want to quickly jump between each map via wipe transitions. That way I’ll have multiple maps on screen at the same time. This will definitely give me a more dynamic and interesting look when comparing with straight cuts.

To create the montage, I’ll first layer my eight different map images, one on top of the other. Then I’ll use the ellipse tool to add a mask right in the center of my top map layer. I want to create a perfect circular wipe transition, growing outwards from the center. To do this I’ll switch my mask tool from rectangle to ellipse. Now I’m ready to animate.

Masks Grid

Pro tip: to perfectly position the ellipse mask, turn on the grid display and then go to View > Snap to Grid. Now you’ll have a much easier time manipulating your mask.

As I did with the previous wipe transition, I could add keyframes to my mask path to bring the animation to life. However, due to the nature of this wipe I can more easily work with the mask by simply keyframing the mask expansion attribute. To animate the wipe, I’ll add two keyframes at different expansion points. Check out the results.

Masks Circle Mask

Once I have the initial wipe transition fine-tuned, then I can simply copy and paste the mask to all of the maps. Now it’s just a matter of timing each transition to a look with which I’m happy. Here’s the final sequence.

Now that I know how to create a variety of wipe transitions, I can quickly piece all of my elements together into my final cut.

So there you have it—a variety of different ways to intelligently use masks in your next motion graphics project. Use them to quickly bring life to static text. Or harness the power of mask shapes to more efficiently animate objects to a motion path, taking the tedium out of keyframing everything by hand. And last but not least, use masks to help you avoid boring straight cut transitions.

If you want another reason why you should master the art of the mask, then check out my previous article where I discussed how to utilize masks in Adobe Premiere Pro to make use of a fascinating editing technique called the David Fincher Effect.