From the course: After Effects CC 2022 Essential Training
Creating and animating masks - After Effects Tutorial
From the course: After Effects CC 2022 Essential Training
Creating and animating masks
- [Narrator] In After Effects masks are an important tool used to create transparency by allowing us to hide or reveal portions of a layer. A layer can have one or more masks and can either be static or animated. Here we'll take a look at how to create masks and how to animate them. Here I've got some footage and a layer of text on top. And what I'd like to do is come up with a creative way to reveal this text and we can use animated masks to do that. So what I'd like to do is turn off this bottom layer. And just with my text layer selected, I'm going to come over to the pen tool, and the pen tool works very similarly to the one in Photoshop and Illustrator. If you're familiar with those. The pen tool has an option for automatically creating curvature with the RotoBezier option. I'll make sure this is off so that we can draw that in ourselves. What we want to do is just click and drag inside of our composition window. And I'm creating a handle with this. And these handles are what's responsible for the smooth curvature in our mask shape. So I'll draw another one out here, again, drag out the handle. Without any handles you'll get sharp corners if you want that. But in this case, I'm going for something fairly organic. I want this to kind of resemble maybe some waves or something. So I'm just going to draw in a couple of points and then I'll come over here around the frame and then come back to the top here to close this out. And now that we've done that. You can see that I have some portion of it still revealed. So let's rewind to the beginning here. And under my mask property I'll set a key frame for mask path. Now to move this I'll go to my selection tool and I can double click on the path to grab this bounding box which allows me to scale it down. I can rotate this if I wanted to. And that's the free transformation tool. I'll drag here in the middle and move this down to the bottom. And at frame 20, let's do the same thing. We'll double click on that and reveal the entire text. And now you can see, I have this animated mask moving across in time, and it's tied to the layer. If I select the layer and go to its transform properties like position, scale and rotation. You can see that I'm moving this bit of text and the mask moves along with it. It also scales with it and of course rotates as well. So let's take this and let's make another instance of this entire text. I'll hit Command or Ctrl + D on the keyboard. And this time I'll hit M on the keyboard to reveal my mask path. I'm going to make some alterations to the mask itself. So at frame 20, let's go back to our pen tool except this time let's do the add vertex tool. I'm going to add a bit more detail here on the in-betweens. And we'll make some alterations here to these points. Let's come back to the selection tool. And what we can do is grab these points and hit that free transform form tool. This time I'll right click and say, mask shape and path free transform points. And now I can freely move this around. Maybe this is inverted of sorts. Let's just make this happen like that. And maybe we get a bit more of a rotation like so. And I'm just going to tweak some of these points out just to get a little bit more contrast in our curves here. And when we go back to the first frame remember this first frame hasn't been changed yet. So this maintains the original shape that we had. So let's make an alteration here as well. Same thing, I'll select these points and hit Ctrl or Command + T, and let's invert this and maybe we enlarge this. Let's try this. There we go. So now, if we look at this, that's going to scale down and we should say some interesting things happening here because we have two masks going on at the same time. And these two layers have two blending modes of linear dodge enabled. And with each wipe, that's going to increase the brightness. So we have our first wipe followed by our second wipe. So that's not really too obvious here. So what I'll do is take this top layer and just shuffle it in time a little bit. We'll just move it down. And now we have our first wipe follow by our second wipe. Let's see this in real time as we play this back in preview. I'm liking that. One thing that we can really do to help integrate this shot a little bit better is take another instance of this footage. We'll duplicate it and put it on top. And here what we can do is use these animated masks to animate around the head so that we have a little bit of some over overlap here in the foreground and put the text in between the foreground and the background. So to do that, just like the animated mask before I'll come over to my pen tool and start drawing in a mask. And this is going to be very rudimentary because ultimately here, while this is an option you can start to see why this is a very tedious process. This whole thing of taking out a foreground from the background, this act of rotoscoping is pretty tedious with these tools to do it manually. There's one portion of it. And if we scrub through, you can see because this is live action. Each frame is unique and different. And so we need to make our mask move along with it. So with that layer one selected, I'll hit M on the keyboard and let's make a key frame for this so we can animate it. And we'll take that first key frame, throw it back to the very beginning. And here let's alter the masks to fit this particular frame. I'll come over to my selection tool and just double click on my entire path and move this down accordingly. We'll nudge forward again, maybe down on frame 40. Again select our layer, select our mask path, double click to get that free transform tool going. Here we go. And we can keep on going with this process, making tweaks to the overall shape and responding to how the footage moves. And obviously the length and complexity of this process really just depends on in your footage and the length of your shot, but here with just four key frames, we've kind of roughed this in And let's play this back. So this process here is a bit tedious and there are better tools suited for this task. It's just important to note that with these animated masks you can use them on static images to hide or reveal that image. Or on moving footage you can use it to track along and reveal or hide that portion of the footage as well.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.