Tutorial: An Introduction to After Effects Expressions

An Introduction to After Effects Expressions

After Effects expressions are small pieces of code that can be plugged into an After Effects project to achieve a desired effect without using complex keyframing.

Expressions use JavaScript, and you do need some programming knowledge to make the most of them. However, there are many great examples of both beginner and advanced expressions, so you can accomplish a lot without. An expression is different than a script. Scripts tell an application to do something, while an expression tells a specific property (like position or scale) to do something. An expression saves animators from having to animate a large number of keyframes.

To use expressions, hold the Alt key while you click on the keyframe icon on the property you want to apply an expression to. An expression box will show up and you can use it to write and edit expressions.

See the latest After Effects Templates added to the marketplace! Cover photo by: Jacob Miller

Basics of After Effects Expressions Guide

Editing Expressions

After Effects expressions can be modified using simple math. The plus sign, minus sign, and other simple math symbols can be used to adjust expressions. You can also adjust numbers in expressions to change the animation.

Sometimes, animation presets include expressions, meaning you can edit based on the expression rather than using the controls for the effect.

after effects expressions closer look

You can always access a full menu of expression elements by clicking the corresponding symbol near the expression box.

Unfortunately, just looking at the expressions menu is not very helpful unless you already know the syntax for each effect. After Effects does not specify what variables go into each expression.

Simple Expressions

Plenty of After Effects expressions are simple and just require a single element with some variable numbers. Even a beginner to After Effects could utilize these effects well.

 

Wiggle

Wiggle – After Effects Expressions

 

Wiggle is one of the most basic and popular expressions. It will let the layer randomly change over a set period of time. You can apply this to scale, position, rotation, or another property, to produce randomness. Just type the following expression into the text box.

wiggle(0,0)

The first number is the number of wiggles per second, and the second number is the intensity of the wiggle, so set the numbers higher to get a quicker and more intense wiggle.

Time

Wiggle – After Effects Expressions

Time*360 on a 1 degree rotation

The Time expression changes how fast the animation takes place, making it good for a constant animation. Use the following expression and adjust the number to achieve your desired speed.

time*0

Advanced Expressions

These are the ones you might want to just copy and paste. Unless you’re well-versed in Javascript and expressions in general, you might have a hard time parsing through these or creating your own that is this complex. Speaking of which, if you have some After Effects templates you’re looking to sell, you can learn all about selling your templates on FilterGrade, here.

Revolve in a Circle

Revolve in a Circle – After Effects Expressions

Settings same as below

You can make a layer revolve around in a circle. The expression for this one is a bit more complex, but it’s easy to customize. Apply this expression to the Position property. You can adjust the numbers to change the intensity of the revolution.

var centerOfComp = [ ( thisComp.width / 2 ), ( thisComp.height / 2) ]; 

var circleOverTime = [ Math.sin( time ) * 50, -Math.cos( time ) * 50 ]; 

centerOfComp + circleOverTime;

Overshoot

Overshoot – After Effects Expressions

Settings same as below

This expression is great for animation. Something that really sells an animated element is an overshoot effect, in which a moving element overshoots its destination and bounces back. It looks more dynamic and natural than just a simple sliding effect. There are a lot of variable numbers here to adjust, but the effect looks great with the default settings.

n = 0; if (numKeys > 0){ n = nearestKey(time).index;

if (key(n).time > time){ n–; } }

if (n == 0){ t = 0; }else{ t = time – key(n).time; }

if (n > 0){ v = velocityAtTime(key(n).time – thisComp.frameDuration/10); amp = .05; freq = 4.0; decay = 2.0; value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); }else{ value; }


While some of these expressions are simple, they can get incredibly complex. Knowing Javascript is not necessary for using expressions, as many great examples and tutorials exist online. But if you want to become a power-user of expressions, it can’t hurt to learn. To learn more about expressions, we recommend the AE Enhancers discussion forums.

Read next: Top 10 After Effects Blogs in 2020

Leave a Reply

Your email address will not be published. Required fields are marked *