Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Expressions are one of the most powerful but underused features in After Effects. They can be used to animate layer properties with code, as compared to explicitly keyframing every value in the Timeline, and have multiple parameters and layers that follow the lead of a master layer or controller effect, making it much easier to coordinate complex animations and quickly accommodate client changes. In this introduction, Chris Meyer shows how to let After Effects do most of the work by creating simple but very useful expressions that can be put to work on a wide variety of jobs.
The After Effects Apprentice videos on lynda.com were created by Trish and Chris Meyer and are designed to be used on their own and as a companion to their book After Effects Apprentice. We are honored to host these tutorials in the lynda.com Online Training Library®.
In the last movie, we showed you how to use Effect > Expression Controls to create the user interface for an expression applied to a layer. In this movie, we're going to show you how to use Expression controls to create one set of master controls that affect multiple layers. To do that, let's go ahead and close this up, Close All, just clean up our interface, go to the Project panel and this time open up 07-Master Controls*starter. Here we have a bunch of text and a bar created using shape layers that are all boring white. And we know the client is going to want these to be different color, and we know the client has a way of changing their mind.
So, instead of changing the color for every one of these layers every time the client does change his/her mind, instead let's create one set of controls that can apply to all of these layers. Now I could choose one of these layers to be the layer that has these master controls, or I can create a brand-new layer that has just the controllers. In one of the previous After Effects Lessons on parenting, we mentioned that null objects made great parents, because they don't render. Well, null objects also make great Controller layers, again, because you don't need to worry about them rendering; you can just attach things to them.
So I've added my null object. I want to give it a useful name, so I go to Layer > Solid Settings--nulls are just specials versions of solids--and call this MASTER CONTROL, click OK and turn off the video switch for this layer, because I don't even need to see its outlined in the Comp panel. Now the item I want to control is Color, so with my Master Control layer selected, I'll go to Effect > Expression Controls > Color Control, and now you see I get a nice color swatch here in my Effects Control panel.
Colors in After Effects tend to default to this really bright red, which isn't NTSC safe, and it is not very pretty in the first place. I am just going to immediately change it to a different color, so that you can tell the difference between this color and any default color from any effect I am about to apply. Okay, let's change the color of this layer, REASONS TO UPGRADE. As you might remember from the Type and Music chapter, the color of a text layer--and I'll open Window > Character--is actually controlled over here in the Character panel. That means this is not a keyframed parameter.
Expressions can only be connected to things that can be keyframed, so you cannot directly control the color in the Character panel using expressions. I'll tidy this up. However, you can apply an effect and use an expression to control the effect. In this case, I want to fill this with the color. I can never remember which effect category Fill is under, so I am going to go to my Effects & Presets panel and type into the search box up top, fill. There it is, it's underneath generate. I always forget that.
I'll apply to REASONS TO UPGRADE. You see that it has that lovely default red. Type E to reveal it in the Effects Control panel and twirl it open so I've got that color exposed. What I want to do is connect this master color control to the color for this fill. To do that, just like any other expression, I'll hold down Option on Mac, Alt on Windows, click on the stopwatch next to the color, I have got my little pick whip, and I'll just drag it to the color on my master control.
I can press Enter on numeric keypad or just click off somewhere, and now you see that that text has taken on the color of my master control. And just to verify that's working, you can actually click on the swatch and drag right down here on the Timeline panel and you can see that this type changes to match that color that I am changing my master controller to. I'll put over there to a more orangey color, release, and now you can see it's automatically changed. Let's wire up another layer. This underscore is actually created with something called a shape layer.
Now, shapes are something we'll dive into in a future After Effects Apprentice lesson, but shape layers typically contain strokes and fills. In this case, it's just a simple line that's been stroked. I'll twirl that open, and lo and behold, it has a stroke color. Well, if I can keyframe it, I can attach an expression to it. Option+Click or Alt+Click. I have got the beginning of an expression. I grab my pick whip and drag it up to my color master control, click off to accept, and now you will see my stroke has taken on the same color as my master control, and I think if I change its color, both my stroke and my text change, very cool! Now you might be thing next, you just have to do the exact same thing for these three remaining text layers. Not true.
As you well know, effects can be copied and pasted between layers. Whenever you copy and paste an effect, any keyframes attached come along as well. It's no different for expressions. An expression attached to layer will also come along. So let's go ahead and select fill, Command+C or Ctrl+C to copy, go to these other layers, and then paste, paste that one, paste that line of text and then that line of text. But once I've done that, I'll go up to my master control, click on the swatch, open up my Color Picker dialog, and now I can interactively change the color for all of my layers at once, from one master control.
And trust me, this will save you so much time when a client is changing their mind about what color they want things to be. If you tie everything to one master controller, you just need to change one color instead of the color for every single layer. This has saved us lots of times on jobs as well. I click OK. By the way, one more trick I'll show you, normally when you would select a layer, the Effect Control panel changes to show the effects attached to that layer. However, the Effects Control panel does have a lock icon. So if I was to lock this layer and select another layer, that master control will remain up in the Effects Control panel.
So even though I might be working with other layers and have them selected, I can still go back up here, change my color, and everybody will update, even though that wasn't the layer that was selected up in the Effects Controls. And oh yes, color does have a little animation stopwatch and you can keyframe it as well. So you have seen how to type in expressions. You've seen how to use Effect > Expression Controls to add a user interface to expression. Well, there is yet one more trick, and that's using the sound to control your expressions.
But that requires a couple more steps. We'll show that in the next movie.
Find answers to the most frequently asked questions about After Effects Apprentice 09: Expressions.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.