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
After Effects CS4: Apprentice's Guide to Key Features is a series of guided tours with Chris and Trish Meyer. It is designed as a gentle introduction to some of the major features of After Effects CS4. This quick–start course is for beginners who already know how to animate, users who are not familiar with the latest version, or those who need to get up to speed with advanced tools. Chris and Trish cover features such as text animators, shape layers, expressions, and motion tracking. These guided tours are also included with the second edition of Chris and Trish Meyer's book, After Effects Apprentice (Focal Press).
To learn the basics of animating in After Effects CS4, check out After Effects CS4 Getting Started with Chad Perkins in the lynda.com Online Training Library®. To go deeper, see Chad's After Effects CS4 Essential Training. To get an overview of the new features in After Effects CS4, watch After Effects CS4 New Creative Techniques with Chris and Trish Meyer.
To purchase After Effects Apprentice—the book—go to www.amazon.com.
- Understanding 3D Axis Arrows and Camera Tools
- Working with Text Essentials and Animators
- Using Tracker controls
Skill Level Intermediate
One of the most powerful features in After Effects is Expressions. An Expression is a small piece of code that allows the parameter of one layer or one effect to follow another parameter or another layer or another effect, whatever you choose. It can be thought as an alternative to keyframing. Rather than having to copy and paste keyframes, you can just express one parameter to follow another parameter. For example, here I have already keyframed the blue pulley and now I want to make the red pulley follow along. Well the first thing you need to do is reveal the parameters you wish to express. I have already got Scale and Rotation revealed for the blue pulley. I will select the red pulley, type S to reveal its Scale, then Shift+R to also add its Rotation value.
To enable Expression, I will hold down the Option key on Mac or Alt key on the Windows and click on the animation stopwatch. Once I do so, you will see an extra line gets revealed in the Timeline panel. The Expression for Scale. And After Effects will write a dummy initial Expression for me, basically saying, follow myself, my own transform value for Scale. Now there is a couple of ways of making this value follow another value. The handiest is to use the Pick Whip tool. The Expression Pick Whip allows me to point at what I want to follow. So I will click on the Pick Whip for my value that I am expressing and drag it to the value I want to follow and you will see After Effects does some subtle highlighting as I pick a value that I can express to.
So I will go ahead and pick Scale. When I release the mouse, you will see After Effects writes the Expression for me. It says in thisComp is a layer named Blue Pulley and we are going to use its transform value for Scale, very simple. There is two ways to accept an Expression. One is to press the Enter key on the new numeric keypad, not the normal keyboard but the numeric keypad. The other way is simply to click anywhere else in the Timeline panel and there the Expression's been accepted. Now as I drag the current time indicator through this Timeline, you will see that the red pulley is scaling up by the same amount as the blue pulley, but you will notice that the red pulley is not rotating. Only the expressed value is being copied over. If I want to make Rotation follow along as well, it's pretty simple. I hold down Option or Alt, click on the stopwatch, use the Pick Whip and drag to the Rotation parameter of the other layer I want to follow.
Press Enter and now you will see that both layers scale and rotate together. Now you may be thinking I could have just copied and pasted keyframes, why bother all this Expression stuff? Well, here is the reason why. If you want to make changes to your Master layer, your Slave layer, the one that has Expression will follow automatically. For example, say I changed this keyframe value to two rotations instead of just one. I will press Enter. Now as I drag my time indicator, you will notice that both pulleys got the increased rotation, not just the blue pulley. So it's like doing the copy and paste for me automatically. You write the Expression once and it will always follow along. Well if you want to temporarily disable an Expression.
Well notice down here in the Timeline panel, there is this little equal symbol. That equal symbol indicates that Expression is enabled. If I want to temporarily disable an Expression I click on this equal sign; it will change to a not equal sign. That means it's temporarily turned off. As I drag my current time indicator you will notice that the red pulley is no longer rotating. To turn it back on, just click on equal again and my Expression would be re-enabled. If I want to delete an Expression there is a couple of different ways of doing that.
I can select the text, hit Delete, hit Enter and now the Expression is gone. I will undo to get back to where it was. Now I will turn it back open so you can see my expressed layer. The other way is to hold down the Option or Alt key and either click on the animation stopwatch as you did before or click on the equal sign and that will also delete the Expression. And I will undo to get back to where I was. And by the way you might have noticed that when a value is expressed its text turns red. If I disable Expressions, you will go back to your normal color. Enable, the red text shows you that this parameter is being expressed.
There are a few ways of revealing Expressions in the Timeline. For example, I am going to just quickly add an Opacity animation to this layer. Type zero here. And twirl it up. Now you may know that the U key reveals keyframes for a layer. Well, it also reveals Expressions as well. So as I type U it reveals both my keyframe properties and my expressed properties for a layer. Say you want to look at just the Expressions. If you type EE, two Es in quick succession, it will reveal just the Expressions not the keyframes. So those are the two keyboard shortcuts, I want to reveal my Opacity again and just set it back so I can see what's going on in my layer.
Now the nice thing is that After Effects will automatically write for me most of the code that I need for most of my Expressions. But if you do need to modify the code, it's very, very, simple. It is just a matter of adding some simple math operations on to the end. For example, say that I wanted the red pulley to rotate twice as fast as the blue pulley. I will select the Expression, you see it's now highlighted, I will put my cursor at the end of the Expression and type times two. Notice that I had to use the asterisks key which is what computers use rather than the letter x.
Type, Enter, drag my time indicator and now you see the red pulley is indeed rotating twice as fast. Say that I want the red pulley to rotate only half as fast. Instead of times two, I will do divided by two and again I'm having to use the computer convention of a slash rather than using the divide symbol. Press Enter and now you will see that the red pulley is only moving half as fast. And you can confirm that in these values here on the Timeline panel. There are also simple math things that you can do. Say you want to rotate in the opposite direction. Do times minus one. Enter. Now you see that the red pulley rotates in the opposite direction of the blue pulley. Say that you want to offset a value. There is a couple of ways of doing that. One way would be just to say plus, so say 45 degrees. So it's put at a slight angle, now as I drag my time indicator, I will rotate the same amount but the red pulley is offset and again, you can see that now the value is here.
You can indeed mix Expressions and keyframes for underlying values. Let me go ahead, delete my +45 here at the end. Press enter and turn off Expressions for a second, say that I had this Rotation value initially set to a value such as 22 degrees. And I want to take that value and always add it to my Expression. I will select my Expression text and go + value. Value says always add Expression or multiply it or whatever by the original value this parameter had. Press Enter and now you will see that as I drag the time indicator again, the red pulley is following the blue pulley but it's being offset by that underlined value and I guess, we will go ahead and see it and even scrub it to offset, maybe even to say a negative value like -60.
So Expressions are not exclusive, they can be used in conjunction with underlying values or with keyframes. Now there are times when you will accidentally break an Expression and for something incorrect, say rather than value, I put in some nonsense word here like, some, + some. If I Press Enter, I will get this error dialog. Initially it's a bit scary, but let's go ahead and read through it. It's basically telling me that there is no such thing as a property called some and that the Expression has been disabled. The error occurred in the first line of my Expression in the Comp Pick Whip starter on Layer 2 on this Rotation property. So it does help me to find my errors. Click OK and you will see down here in the Timeline panel I have got a little exclamation symbol indicating there is an error with this Expression.
Well, don't panic, just start about fixing it. You can either undo to get back to where you were and that removes the word some. We will just go ahead and manually edit it to be correct again. Error has been cleared. Expression works again, no problem. Now you can do an awful lot with the Pick Whip but there will come times when it's useful to type in an Expression of your own. For example, there is a really handy Expression in After Effects called Wiggle. Wiggle automatically wiggles, randomizes, however you want to think about it, your chosen parameter. For example this animation, say we wanted that little Gizmo in the middle there and wiggle its position so it bounces about the screen. Again to apply Expressions, first reveal the parameters that you want to work with. P for position, hold down Option or Alt, click on the stopwatch to enable Expressions and to use the Wiggle Expression, it is very simple, you type wiggle, open parenthesis, enter the value for how fast you want to wiggle, in this case say one wiggle per second, and then enter how much you want to wiggle by, in this case I want to wiggle by say 50 pixels, 50 close parenthesis. And as before you would hit Enter, we will just click anywhere else in the Timeline panel.
Now as I build up a preview you will see that the position of my Gizmo is wiggling, moving randomly around the screen. To edit it, say I want to wiggle by a larger amount, I will just select my Expression to enable it, change a number like 200 pixels, press Enter. Ram Preview again and now you see it's wandering around by a much larger amount. And again you can wiggle virtually any parameter. For example, to wiggle Rotation, I will do Shift+R to reveal Rotation, hold down Alt or Option and type wiggle. Let's wiggle by an amount of three times a second, 90 degrees.
That's going to be pretty crazy. We are in Preview and you see that not only is the position wiggling, the rotation is also wiggling as well and that's a lot of fun. The Wiggle Expression is the one that we use most often. By the way there are some animation presets underneath the behaviors of the section. That also includes various preset wiggle Expressions that can be applied directly to layers for you. Now let's say you cannot remember the code you want to type in for a particular Expression. What After Effects does is something called the Expression Language and menu that can help show you some of the most common Expressions that you might otherwise want to type.
In this example, we have already keyframed the minute hand to go around the style. Say that we want to time a transition, a radial wipe, so the background is revealed while the minute hand goes around. In one of our background layers I will apply an Effect > Transition > Radial Wipe. The problem is Rotation goes from zero to 360 degrees. But Transitions go from 0% to 100%. We want to match up those two different parameter ranges using an Expression, but let's say we cannot remember what Expression does that or exactly how we type it or what its parameters are. Okay, as always, let's reveal the parameter we want to express in our timeline panel. I will hold down Option or Alt, click on the stopwatch in the Effect Controls panel and After Effects will reveal that for me down in the Timeline panel.
Then I will use this little handy Expression language menu to help remind me what are some of the Expression codes I can enter. In this case, I want to use interpolation, I want to interpolate one value to another and pick the linear interpolation. What linear does is say as a master value, T goes from its minimum to its maximum, I want to go from my own minimum value to my own maximum value. At this point you can start using the Pick Whip or just typing numbers to replace what you need to. In this case, I will select the T master value and use the Pick Whip to say follow that other layer's Rotation. As it goes, from zero to 360, I want my own value to go from 0 to 100. I will press enter and now as the minute hand rotates from 0 to 360 degrees, you will see my transition completion is going form 0 to 100%.
Linear is another one of those really handy Expressions worth remembering but if you can't remember it, use the Expression Language menu to help you out. I know that Expressions can be intimating to a lot of people, particularly, you know, your right-brain artist types. Code is scary and it seems non-creative but in reality, Expressions can do a lot to help you save time and also to help you pull off more difficult animations like coordinating these two different parameters so that you don't need to keep pulling out a calculator and figuring these things out for yourself. It's a great thing. It's worth learning a little bit, just to make your life go easier.