Expressions are the secret weapon of any motion graphics designer. You can automate repetitive tasks with expressions, create flexible rigs, and stretch your capabilities far past whatever is possible with keyframes alone. If you've been looking forward to adding this incredible skill to your Motion Graphics animation toolkit, your quest is finally over. 

Today, I will show you when and how to add Expressions in After Effects. Besides, we shall also explore the commonly used Expressions in After Effects.

New to Expressions? No worries! Keep reading, and you'll be all set in no time.

What is an Expression?

After Effects (AE) is an exceptional tool for creating UI animations, character animationsHUD animation; however, we’re constantly looking for ways to speed up our workflow. After Effects comes with support for expressions, which form relationships between layer properties or keyframes. So, if you want to create and link intricate animations, try using expressions to avoid making tens or hundreds of keyframes by hand.

It is basically a small code that you can add into animated properties in your After Effects projects that further helps you assess a single value for a single layer property at a particular point in time.

Expressions are an intelligent addition to any workflow or project. These code snippets can reduce the number of keyframes and layers on the timeline, transform values for animation flexibility, and consolidate multiple properties to a single control. They provide artists the ability to modify values with math operations and design dynamic animation controls; however, you don’t really need to be a programmer to use them. 

Exciting, right?

ae expressions gif 1

Expressions Language

Unlike a script, which instructs the application to perform a task, an expression instructs a property to do something. For instance, you have a ball rolling across the screen from left to right, but you want that ball to wiggle as well. In that case, instead of animating the position property with keyframes, you can simply apply a wiggle expression to it.

The expressions language is derived from the standard JavaScript language, although you do not need to be a JavaScript specialist to get started with expressions. You can create amazing expressions by simply using the pick whip or copying basic examples and adjusting them as per your needs. 

How to add Expressions

It’s pretty straightforward to add an expression. 

  • Right-click on the final keyframe.
  • Go to the Keyframe Assistant menu, and select Easy Ease Out. Specifying Easy Ease Out will slow down the animation towards the end, which works great while working with the inertia expression.
keyframe assistant menu
  • Then, hold ‘alt’ and left-click on the stopwatch icon next to “Position.” This will enable expressions on this layer and open a text area-style field where you’ll put the expression.
transform position

Watch this video clip to learn how to add an expression.

Common Expressions in After Effects

Expressions are easy, to begin with, automate tasks, and offer immediate and high returns with minimal effort. 

Every Expression you know is a time-saving, work-streamlining tool. The more Expressions in your tool kit, the better suited you are for After Effects projects, particularly those with tight deadlines.

So, have a look at some of my favorite expressions!

Wiggle

The wiggle expression is perhaps one of the most popular After Effects expressions.

For those who are not well aware of the wiggle expression, it’s a fabulous way to create random and infinite movement. Wiggle is written using one line of code which results in clean motion and requires no keyframes.

However, it can additionally be applied using the Wiggler panel in the After Effects interface, although this process creates many keyframes. 

wiggle expression after effects

Now, let's see how to use wiggle expression in after effects.

wiggle(2, 20)

The numbers within the parentheses specify the wiggle. The first number is the number of wiggles per second, i.e., frequency, and the second number is the amount of wiggle, i.e., amplitude. So, a Position property having an expression of wiggle(2,20) will wiggle twice per second by up to 20 pixels.

wiggle effect 1

Time

Time is undoubtedly the backbone of After Effects, and a great deal of potential gets unlatched when you mix time with expressions. An incredible application of time-based animation is Rotation or Fractal Noise. The time expression will yield a value related to the position of your playhead in seconds. 

For most motion graphic elements, you will probably want to multiply the time expression so that it returns a greater value. In that case, you have to tell After Effects to do some elementary calculations.

time expression after effects

Now let's see how to use time expression in after effects.

Time*90

Adding the Time expression to any layer's rotation will make it rotate from its axis point by one degree every second. You can add basic mathematical functions, using * for multiply and / for divide, to speed that up.

time

Loop

Using multiple keyframes to create repetitive animation can be time-consuming. However, you can use the loop expression to automate this and create intricate looping animations.

loop expression after effects

There are primarily two types of looping – loopIn and loopOut.

The loopOut expression is widely used, and an example is given below.

loop expression

Text Values

You can link the value of text to that of the current time. Simply click on the stopwatch and add in the time expression. 

Math.round(effect(“Slider Control”)(“Slider”));

text value expression after effects

By default, the numbers will contain numbers beyond the decimal point, so I recommend using the Math.round() function in order to round up to the closest whole number.

text value

How to edit Expression Manually

  • Enter the text-editing mode by clicking on the expression field.
  • Type and edit text in the expression field using the Expression Language menu.
how to edit expressions manually
  • Watch the video to see how to edit expressions manually.
  • To exit the text-editing mode and activate the expression, do one of the following:
  • You can customize how expressions look in the Expression Editor – located in the Timeline panel, using the Scripting & Expressions preferences. 
  • To open it, go to After Effects > Preferences > Scripting & Expressions (Mac) or Application > Preferences > Expressions (Windows).

Wrapping Up

Creating fun animations in After Effects is often relatively simple; however, using expressions will make things even easier. Hopefully, this article will help you understand how to add expressions in After Effects and improve your animation skills.

So, what are you waiting for?

Set the power of Expressions to work in some amazing animations with controls and effectiveness unlikely to achieve using traditional keyframing techniques.

And remember, practice will make your skills perfect, so play around and find out what turns out best for you. Excited to use expressions to create some incredible animations? Get started now!

Feel free to reach out to us if you have any queries. And if you are looking for a motion graphics artist to create some cool animation videos for you, contact us now and get a personalized quotation!

Frequently Asked Questions

In After Effects, expressions are typically added to properties of layers or effects. To find expressions for a specific property, you can open the property's dropdown menu in the Timeline panel, revealing a stopwatch icon. Clicking on this stopwatch icon will open the Expression Editor, where you can write or paste expressions to control that property's behavior. Additionally, you can access expressions by selecting a layer, going to the “Window” menu, and choosing “Expressions” to open the Expressions panel.

To add an expression keyframe in After Effects, follow these steps:

  • Select the property you want to animate with an expression in the Timeline panel.
  • Click the stopwatch icon next to the property to open the Expression Editor.
  • Write or paste your expression into the Expression Editor.
  • After you've added your expression code, hit the Enter key on your keyboard to confirm it.
  • A keyframe will be automatically created at the current time indicator (CTI) on the timeline, indicating that the expression is active for that property.

An expression code in After Effects is a piece of scripting or programming language used to control and automate the behavior of properties or effects applied to layers. Expressions can be as simple as adjusting the position of an object based on time or as complex as creating dynamic animations based on mathematical equations, variables, or other layer properties. Expressions provide a powerful way to create dynamic animations and effects without manual keyframing.

To add expressions to rotation in After Effects, follow these steps:

  • Select the layer whose rotation you want to control with an expression.
  • In the Timeline panel, click the stopwatch icon next to the “Rotation” property.
  • This will open the Expression Editor.
  • Write or paste your desired expression code to control the rotation property.
  • Confirm the expression by pressing the Enter key.
  • The rotation property will now be animated based on the expression, allowing you to create dynamic and automated rotations for your layer.