Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Video and personalized recommendations.Start Your Free Trial Now
- View Offline
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
Skill Level Intermediate
If you have access to the exercise files that came with this lesson, open up the project AEA_Expressions.aep. If instead you are following along using our book After Effects Apprentice, 2nd Edition, go ahead and open up the project file that came with Lesson 07, Expressions and Time Games. Before you dive into expressions, first we'd like to give you a taste of what could go wrong if you rely too much on using keyframes for all of your animations. Inside of the Comps folder double-click 01-Pick Whip* Starter to bring that open.
Click on the RAM Preview button at the far right of the Preview panel or just press 0 on the numeric keypad. Here we have a very simple animation of a pulley that's rotating and scaling, and to verify that, I'll select the layer and press U to reveal all of its animating properties. Let's say I want the red pulley to do exactly the same thing. Easy enough. I'll click on the word Scale to select all the scale keyframes, hold Shift and click on the word Rotation to select all those keyframes as well.
Then press Command+C on Mac, Ctrl+C on Windows, to copy those keyframes. Make sure your Current Time Indicator is moved back to the time where you want that first keyframe to start. Select the red pulley and Command+V or Ctrl+V to paste. I'll press U to verify the keyframes are in the right places. They are. Let's give it a RAM Preview. The client sees this and says, "Yeah, I like this. I like the idea of multiple layers coordinated and doing the same thing.
I like it so much, could you make more layers to the same thing?" And you go, "Yeah, that's easy enough." I'll select the blue pulley, Command+D or Ctrl+D to duplicate, and start moving these copies around the screen. Do the same thing with the red pulley: Command+D or Ctrl+D and drag to a few new locations, maybe one here and one down here. Just to give them a better distribution, I'll reorder some of them inside my Timeline panel.
So the red and blue pulleys alternate in the Timeline panel stack. 0 to RAM Preview, and now we have a bunch of pulleys filling the screen, doing this coordinated animation. Client sees this and says, "That's a lot of fun. But right there, right there where they are moving really fast, it's kind of hard to tell what the spokes are doing. Could you slow down that last rotation bit right in through there?" And you go, "Oh, now I have nine layers." I could edit the last rotation keyframe for everybody, or I know what will be even easier, let's go to the last one, change its value to only -1 revolutions, click on the word Rotation to select all of the keyframes, Command or Ctrl+C to copy, make sure the Time Indicator is back at the start, Command or Ctrl+A to select all the layers, Command or Ctrl+V to paste.
They should all have the same rotation keyframes now. Let's RAM Preview again, and there is a little bit slower motion. That's what the client wanted. Great! So you showed this proof to the client, and they go, "Better, yes, I like the slow motion. But you know, I'm still finding it distracting that's it's rotating in that last scale-down. Could you just stop the rotation before that scale-down?" Now you go, "Okay." I am in a little bit of danger here because if I just move one keyframe, copy, go to another layer and paste, I actually will get an extra keyframe.
I won't just move the keyframes. That's not going to work. Oh, I know, I'll select all the layers, press R for rotation, marquee-select all of those keyframes, and drag them all up earlier in time, maybe right around here. Reveal those scale keyframes. I'll press Shift+S to reveal them. Yeah, coordinated with those, right at the same time. RAM Preview that, and the client sees this proof and goes, "Yeah, that's what I had in mind. I like that scale-down without rotation. It's something different. It's a nice resolution. But you know what would be even better? What if all the pulleys were a slightly different size, or maybe rotated at a slightly different speed? I mean, I want the animation to still be coordinated like it is, just different." And at this point you are going, "I am never going to get any sleep tonight.
I am never going to ship this in time." Well, this is an extreme example. However, the point is to show you that whenever you do have multiple layers performing the same or a coordinated action where the movement of one layer is based on the movements of another, there is an easier way than just keyframing every layer individually, and that easier way is called expressions, and that is what we're going to be focusing on for the entire remainder of this lesson. But before we go there, we need to get rid of this mess we've made.
You can either select all these other layers and delete them and get rid of the keyframes of the red pulley, or even easier, just go File > Revert > Yes, and we are back to where we started. Okay, now let's start having some real fun.