Automation

How to get started with expressions and level up your motion design today

Learning a little code can give you After Effects super powers

By Shea Lord |
February 4th, 2023
Automation

How to get started with expressions and level up your motion design today

Learning a little code can give you After Effects super powers

By Shea Lord |
February 4th, 2023

Read time: 4 minutes

One of the quickest ways to elevate your work and workflow is to learn expressions. With a little code you can get:

  • Automation
  • Randomness
  • Responsiveness
  • Systems and templates

The problem is, if you’ve never worked with code before, expressions are super intimidating.

Here I’ll give you some resources. Then I’ll quickly look at 5 expressions (beginner + intermediate) that you can start using today. I’ve thrown in a few preset freebies to boot.

Yes, you can really do this.

After assistant-teaching expressions to a couple hundred students, from teenagers to retirees, software engineers and single moms who’ve never written code, I’m not an expert but I have picked up on some patterns.

  • The imposter syndrome is normal. Even with professional programmers.
  • Coding has a muscle memory aspect. It takes repetition and sinks in over time.
  • You do not have to memorize syntaxEven the pros use google.
  • It’s also totally normal to arrive at answers without the process “clicking” right away. It might not click until the 3rd or 4th time you use the expression.

If it works, it works. There are 100 ways to do any one thing. Don’t worry about hacking something together. Most people are.

Resource Guide

1. 
The best way to learn is with a well-designed curriculum + guidance and feedback.

  • Expression Session by School of Motion has it covered. Whenever you get stuck, just ask a TA and they’ll help you get unstuck. Plus, they can usually point out alternative methods and tricks.

2.
The second best way to learn is with DIY free courses, like the one at Animoplex. For $10 you can also get the project files and extra documentation.

3.
Another highly effective way to learn is by stealing other people’s code (and then reverse engineering how it works). If you’ve been copying and pasting expressions and can dig into it enough to make your own adjustments, you’re well on your way.

  • If you’ve ever tried troubleshooting on Creative Cow, you’ve read answers from Dan Ebberts. His site motionscript.com is another resource for learning expressions. I don’t recommend it for total beginners, but it is chock-full of amazing info.

4.
Grab some expressions presets. But don’t just use them— dig into them. Can you identify what functions are making them work?

  • Years ago, I picked up Paul Conigliaro’s Conigs Mixtape of great expressions-driven presets. It’s pay what you can, suggested at $13 on gumroad.
  • I still use some of these all the time, except now I actually know how they work. 😅 Highly recommend!

 

5.
Let ChatGPT write expressions for you. It’s not a perfect process, but that might be even better for learning as you can identify how the AI adjusts the code along the way. This great demo by Sophia Kornienko shows how it’s done.

 

6. 
A good ol’ textbook. The Power of Expression by François Lefebvre. $39 for the ebook. Honestly, just read the free sample at the bottom of the page to get an idea of how incredible a job he’s done.

5 Expressions to Learn Today + Tips

If you’ve never written an expression before, these are the ones to google:

If you’re a little more advanced, these are the next step:

 

Tip 1. Expression Controls

This is like using expressions without knowing expressions. You can just pickwhip. If you want to control several elements from one central place (like a null layer at the top of your comp), or be able to keyframe the values of your expressions, all you need is to add an expression control.

The incomparable Jake Bartlett gives a great (and fast!) overview here.

  • Example: You want an object to wiggle, but only for a couples seconds.
  • You know a wiggle() takes two arguments: the frequency and the amplitude. wiggle(f,a)
  • Instead of writing a number for the amplitude, point it to a slider and keyframe that value to change over time however you like.

Expression controls are essential for building rigs and templates and breaking into motion systems design.

 

Tip 2. Single vs Multi-Dimensional values

This commonly causes a lot of confusion and frustration for beginners. Not because it’s difficult, but because it so often isn’t clearly explained.

  • Opacity has one dimension. So your expression needs to provide it with one value.
  • Position has two dimensions, x and y. It needs to be given two values. Three values if 3D is enabled (x, y, and z).
  • These values are written as an array. Learn about arrays here.

 

Tip 3. wiggle() vs random()

Both provide randomness, but in different ways. Basically, random() gives us a random number, while wiggle() gives us random movement.

  • Random(25-50) will give us any random number between 25 and 50. It could give us repeated numbers.
  • Wiggle(1,25) will move up and down from the initial value by no more than 25.
  • You could imagine wiggle() as something that slides up and down a scale, while random() is just throwing darts at a scale.
  • Wiggle also has a frequency value built into the function. Random changes every frame.

Jake gives a great explanation here.

 

Tip 4. Save your own presets

Another totally normal thing about expressions is finally getting a working solution and not remembering how the heck you wrote it. Save presets to easily apply the same code later on.

I put a couple of my favorites for you to download here.

  • A jumpy rotation and position wiggle for a cute stop-motion type jitter.
  • Random hover. Meant to be applied to many objects you’d like gently floating in place but not in-sync.
  • Pulse scale… does just that.

Drop them into your User Presets folder and dig in!