Any property or control with a stopwatch can have expressions, which is pretty much every control in After Effects. In order to add an expression, simply Alt+Click on the stopwatch of the property.
A few things happen when you do this:
- Below the control, you get “Expression: ~” referring what it’s applying to, as well as a few buttons.
- In the timeline, a text box appears (which we can refer to as the Expressions Box) and it immediately has a code that refers to the current control it’s applied to.
- The numbers of the control turn red, which is a good indication of whether an expression is applied to something if you’re not in the timeline (like in the Effects panel).
- A little triangle appears on the far-left, which toggles the appearance of the expression box.
When you alt+click a control, you immediately get a code that refers to that control. If you were to click away at this point, the expression would be applied but nothing would really change because we’ve just told the control to use itself to produce its value, or to put it better, to use its initial value as its final value.
So if you were to alt+click on Scale, you’d get transform.scale and Opacity transform.opacity.
This is a good way to remind you what controls are referred to in the expressions world. If, say, you wanted your scale to be equal to the opacity, you’d simply alt+click on the Scale’s stopwatch and insert “transform.opacity” as the expression. What we’re telling AE is “take the transform property of opacity and make it the value for this control”.
There’s something else you should note as well:
As you can see above, Scale, Rotation and Opacity have expressions (the red digits), however the stopwatch for Opacity is active. This is because it has keyframes. The stopwatch still works as usual. If you click on it (without holding Alt), you’ll apply keyframes as usual.
It’s also important to note that expressions are CASE-SENSITIVE. If you had transform.Rotation, you’d get an error. Keep this in mind (it get annoying sometimes).
Now when you know what expressions are and how to apply them, let us use an expression and create a percentage counter in After Effects.