After Effects Expressions
Animation on steroïds.
An ever lasting battle
There is very little documentation and the existing one is hard to find or very old. Very often I just don’t have the time to dive into expression learning while animating even though it could help the entire project on the long term. So the last time I had to do a complex animation, I took the damn time!
The begining of the end (of keyframes).
Everyone uses expressions whether they know it or not. Most of the time it’s a rather transparent process for the animator. For example: when parenting a property to another one, After Effects creates an expression for us.
Over the last updates, Adobe has made an effort to make expressions more accessible to everyone. For example, the expression box is now resembling a code editor thanks to code-coloring and auto-completion features. After Effects expression feel like JavaScript with custom functions.
Those custom functions can be called through a menu once you enabled the expressions on a property. It offers organized shortcut and proper syntax to all of AE native functions and a bunch of JavaScript standard ones.
So I need to learn javascript to do motion design now?
Why bother?
I know that most animators don’t have any kind of development background. However, if Adobe thought it best to let us use expressions, I think we ought to, at least, try.
A lot of incredible professionals like Mt Mograph and Video Copilot use expressions.
Like every optimization process, building an expressions knowledge takes time. However, like all optimization process, you will benefit from it afterwards.
Where to learn
I’ve gathered a list of my favourite learning grounds. Plenty more exist, go get’em!
- Adobe official expression starter guide (FR)
- Adobe official expression basic (EN)
- Adobe forums for expressions
- Creative Cow expressions forums
- Youtube channel about expressions
- All expressions explained
- All expressions explained again
- Nice examples of basic expressions
Real world example
Number counter
Let’s say you need to animate a rather simple counter from 0% to 100%.
- Start by creating a text layer. Define your typographic choices, colours, etc.
- On the effect menu add expression options > slider control
- Alt + Click the Source text property
- Parent the source text to the slider control through the pickwhip.
You should get something like this in the expressions panel:
effect("Slider Control")("Slider")
- Set two keyframes on the slider from 0 to 100. The text should update accordingly.
- By default, After Effects does not round numbers. In the expression panel, wrap your expression with the
Math.round()
function.
Math.round(effect("Slider Control")("Slider"))
Great! We have a working counter. But we wanted a percentage counter. We could add a % glyph in another text layer but let’s not.
Still in the expression panel, we’re going to add a string containing the % glyph, using basic JavaScript concatenation: + '%'
Math.round(effect("Slider Control")("Slider")) + '%'
And there we go! A fully functioning and customizable counter using a slider controller and expressions.