After Effects Expressions

Animation on steroïds.

Published on : April 24, 2019
Last updated on : September 15, 2020

Expressions in After Effects have always been blurry for me. I know they exist, I know they're powerful, I know it could save a lot of time and clean complex keyframe filled compositions but… They are hard to learn!

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.

Parenting the position of the form to a null creates an expression.

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.

Alt + Click the stopwatch to access the shortcuts.

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!

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

Alt + Click the stopwatch.

  • Parent the source text to the slider control through the pickwhip.

Drag and release to link the values.

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.

Telling AE to round the numbers.

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")) + '%'

Adding a percentage to the counter.

And there we go! A fully functioning and customizable counter using a slider controller and expressions.