Screenshot of layers in Adobe After Effects photo by Jacob Miller on Unsplash.

Before you can take your motion graphics to the next level, you need to have a basic understanding of how Expressions power After Effects. In this blog post, we'll break down some of the most essential Expressions and show you how to use them in your own projects. Are you ready? Let's dive in!

First, we need to take a look at what expressions are. An Expression is used in After Effects as a way to simplify the process of creating animation that might otherwise take a lot of time to keyframe. Sometimes a relatively simple line of text can save you from creating hundreds of individual keyframes. Expressions are small pieces of JavaScript that you add to a property in an After Effects layer to animate that property. With a command and some relatively simple math you can drive the animation for everything from the position property of a layer to the intensity of an effect applied to the layer. And if you really dive deep on Expressions you can use them to accomplish some impressively complicated animation. 

We won't get into the complicated side of Expressions here, though. Also, if you're worried you need to be a JavaScript expert to make use of them, you don't even need to know what JavaScript is to take advantage of Expressions in After Effects. All you need to get started with Expressions in After Effects is to open up a project, go into a layer in one of your compositions, and hold down the Alt (for Windows) or Option (for Mac) key and click on the keyframe animation stopwatch next to the property you want to apply the animation to! This will turn the value of that property red to indicate an Expression is being applied and when you first click give you a text box to type in under the layer in the timeline. 

Screenshot of a property in after effects
Screenshot of a property in after effects with an expression applied

Try the following Expressions out in your current or future projects:

  1. Time - Lets start very very simple. After you alt click on the property just type in "time" (without the quotes). That's it. Just time. What's that going to do? Play your timeline and watch as the value of that property increases with time. For example: add time to the rotation property. The rotation will increase by 1 degree per second. It's a pretty simple way to make a clock ticking off seconds. Now change it to "time*2" that's time multiplied by 2. If applied to the rotation property that ill advance the rotation 2 degrees per second. Change it to 360 and it will make a full rotation per second. You can use this on any property to tie the motion to the time. 
  2. Wiggle - Wiggle is one of the options available in Expressions where we can have some fun. One issue that comes up sometimes in motion graphics is our animations can look a bit rigid and almost even robotic when we keyframe them. Our elements move in straight lines without much variation. Most things in the real world don't move in those perfectly straight lines. Most have a little bit of a wiggle to them because of gravity, momentum, wind, an uneven surface and so on. The wiggle expression can help you add this to your animations.

    Pick an animation, for example you have a circle moving from one side of the screen to the other. Alt/Option click on the stopwatch next to the position and type in "wiggle(2,20)" (again leave off those quotes). What you'll see is the circle will slowly wiggle as it moves across the screen. Twice per second it will move as much as 20 points on the x and/or y axes. The whole expression breaks down as wiggle(frequency, amplitude). Frequency is how many times per second (we chose two) and the amplitude is the maximum amount of change when it wiggles (we chose twenty). Try different combinations of frequency and amplitude to get the effect you want. Oftentimes just a subtle wiggle can add a lot.

  3. Random - Random is basically that: random. Alt/Option click the stopwatch and type in "random(100)" and After Effects will randomly choose a new value for the property between 0 and 100. Change 100 to 500 and it will be a random value between 0 and 500. Change it to 5 and it will be a random value from 0 to 5. This value will change every frame within the range you set. For example if you want a bunch of squares to vary in opacity throughout the animation you could add random(100) to the opacity parameter and they'll all randomly change opacity throughout the video. This will give it a flickering effect.
  4. LoopOut - Creating an animation loop can get time consuming. Let's say you want to create an animation that has a bouncing circle. If that animation needs to last just a few second it might not be too much trouble. At least not until you need to adjust the speed of the bounce, then you have to redo all the keyframes and just a simple 10 second animation can start to get cumbersome. With LoopOut you could accomplish the same thing with just 3 keyframes and adjust your timing just by adjusting those 3 keyframes.

    Set your 3 keyframes to have your circle go up and then come back down: one bounce. Alt/Option click on the stopwatch and type in "loopOut()". Hit play and watch your circle bounce up and down for the entire duration of the timeline.

    What if you need your circle to bounce across the screen? Set your 3 keyframes to define that first bounce so you have your starting point, the high point of the bounce, and the landing. Then, Alt/Option click your stopwatch and type in "loopOut("offset")" (you do need to include the quotes around offset). Now, when you hit play the animation will continue that same motion offsetting it based on the final keyframe position and the circle will bounce across the screen.

  5. Name - The name function just pulls the name of the layer the parameter is associated with. How could that be useful? Well, if you have a text layer, let's say for a Lower 3rd graphic you created that you want to reuse in multiple projects, you might want to simplify your workflow for using and reusing that graphic. Sure you could double click on the text for the name and rewrite it, but then when you look at your layers the layer still has the old name. That can get confusing if you have a complicated graphic and then you need to go and change the name of the layer as well. Instead just find the Source Text property in the text layer, Alt/Option click on the stopwatch, and type "name" into the expressions text box. Now, the text will change to whatever you've set the name of the layer to be. You can easily go in and change that text in the layer and make your change while also keeping your project properly organized.

These are just a few simple expressions to get you started. Expressions can get very complex if you dive in deep, but even these simple ones can save you time on your motion graphics projects. If you'd like to explore even more Expressions,  Alt/Option click on the stopwatch and you'll see a new row of options for Expressions under the property including a triangle in a circle. Click on that triangle and you'll get a menu with all the options for Expressions which you can click and it will be added to that property. Some of these, like the ones we added above, will make changes to your animation without additional parameters, many will need a little bit more. Explore them and see what else you can create with your motion graphics projects.

Screenshot of Adobe After Effects with the Expressions menu displayed

For more information, tips and tricks visit www.mnn.org/learn for free workshops, professional courses, filmmaking intensives, and more resources to make your productions successful. 

Want more? Click here for our in-person classes!