Creating an expression
Video: Creating an expressionIf you haven't already, revert back to a clean version of your AEA_expressions.aep project and open up the comp 01-Pick Whip*starter. Again, we have the blue pulley already animating. I'm pressing U to reveal its keyframes, and I'll press 0 on the numeric keypad to RAM Preview. We want the red pulley to perform this exact animation, at least for now. And rather than copying and pasting keyframes, let me show you another way. I am going to click on the red pulley, press S to reveal the Scale and Shift+R to reveal its rotation.
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®.
- Creating and managing expressions
- Linking together different parameters
- Randomizing a layer's movement
- Looping an animation
- Controlling multiple layers from a single source
Creating an expression
If you haven't already, revert back to a clean version of your AEA_expressions.aep project and open up the comp 01-Pick Whip*starter. Again, we have the blue pulley already animating. I'm pressing U to reveal its keyframes, and I'll press 0 on the numeric keypad to RAM Preview. We want the red pulley to perform this exact animation, at least for now. And rather than copying and pasting keyframes, let me show you another way. I am going to click on the red pulley, press S to reveal the Scale and Shift+R to reveal its rotation.
Instead of just clicking on the animation stopwatch for Scale to enable it, instead I am going to hold Option on Mac, or Alt on Windows, then click on its scale. Rather than enabling keyframing, this enables expressions. I am going to drag this column a little bit wider, so see what's going on, and you can see this new line that says expression for Scale. After Effects has already written a little bit of code for us. It says, use the Transform property of Scale to be the scale of this layer, in other words equal yourself, a good starting point.
But instead of equaling ourselves, we want to equal what that other layer is doing. Well, to do that, we'll click on this little Pick Whip icon, drag it to the Scale property of the other layer--and you will see that After Effects highlights different property names and values to show you what you are targeting--release, and now After Effects has written an expression for you. Now I want to emphasize this, for most of this lesson you will not be writing code. After Effects will be writing code for you, and you just need to be making little modifications.
But if you are curious about what this is doing, let's read this. It's saying in this comp is a layer called Blue Pulley and we want to use its Transform property Scale. Straightforward enough. To accept an expression, you can either press the Enter key on the numeric keypad--not the normal keyboard, that will just start a new line--with the numeric keypad, or just click anywhere else in a blank area inside your Timeline panel, and now you have an expression. You see this little equal sign here that indicates that an expression is in force right now, and the parameter color will change to red instead of the default gold.
Now when I press 0 to RAM Preview, you will see that the red pulley is doing exactly the same scale animation as the blue pulley. It's not doing the same rotation. This isn't like parenting where you take out a lot of properties; we've targeted this one property, Scale, and expressed the red pulley to do whatever the blue pulley is doing. And just to show you that it is indeed doing whatever the other pulley is doing, let's go ahead and pick up this keyframe and move it a little bit earlier in time.
As I do so, you will see the red pulley is scaling in sync. I will RAM preview and it continues to copy exactly the same animation move that the blue pulley is doing. That's one of the big benefits of expressions. They are live. Edit the Master layer and the Express layers will automatically take up those changes; no need to copy and paste. Okay, we've got the Scale happening but not the Rotation, so let's go ahead now to add that as well. Again, I will hold down Option on Mac, or Alt on Windows, click on the stop- watch, go to my handy-dandy Pick Whip tool and drag that to the Rotation property for the blue pulley, the master I want to follow.
And this is important tip about expressions, by the way: before you start creating an expression, you need to reveal the properties that you want to connect to. I have already revealed the Rotation for blue pulley so I am in a good shape. Select that. There is my expression. Click off. It's been accepted. The parameter color changes red instead of gold, my equal sign is active, RAM Preview, and these two layers are now doing exactly the same thing. And I want to point out how easy it is to make changes to the master and have the slave follow.
I'll go to the end here. I'll change the Rotation for the blue pulley to -1, RAM Preview. Now they are both rotating exactly the same. I'll move that second keyframe for the blue pulley to equal its last Scale keyframe, RAM Preview, and again, both layers are doing exactly the same thing. And hopefully now you are starting to see some of the usefulness of expressions.
Find answers to the most frequently asked questions about After Effects Apprentice 09: Expressions .
Here are the FAQs that matched your search "" :
- Q: This course was updated on 11/29/2012. What changed?
- A: We have added exercise files designed for After Effects CS6. We also added a movie that shows our premium subscribers how to use the exercise files.
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.