<img src="https://certify.alexametrics.com/atrk.gif?account=43vOv1Y1Mn20Io" style="display:none" height="1" width="1" alt="">

How to use Expressions in After Effects to automate animation

4 minute read
How to use Expressions in After Effects to automate animation
6:07

Learn how to streamline your animation workflow in After Effects by using Expressions. Shiv Rajagopal is your guide to automating tedious tasks and creating consistent results effortlessly.

How to use Expressions in After Effects to automate animation
6:07

Adobe’s After Effects program is an industry staple for creating motion graphics, animation, and visual effects. However, it has a learning curve. Creating an animated sequence on After Effects, for example, requires manually creating hundreds of keyframes. This process is tedious and time-consuming, especially for beginners who don’t know their way around the UI. 

This is where Expressions come in handy! By using the expressions function on After Effects, you can automate repetitive tasks, allowing for a more efficient workflow. In this article, we will explain what expressions are and provide a step-by-step guide on how to use them to streamline your animation workflow on After Effects. 

hero_image_expression

What are Expressions?

Expressions in After Effects refer to lines of code that you can apply to layers on your project timeline. They are frequently used to adjust the properties of layers, such as the Anchor Point, Position, Scale, Rotation, and Opacity. You can also add expressions to any effects added to the layer. 

The snippets of code that make up expressions are written in JavaScript language. A basic understanding of Java is helpful but not necessary to use expressions. Check out this article if you’d like to understand the expression language at a deeper level.

Traditionally, animators would have to manually set keyframes for each movement. However, users can interlink layers with expressions to create more complex animation at a faster pace. Using expressions significantly reduces the amount of manual labor required to animate a scene. By leveraging expressions, animators can also obtain consistent results, which would require much longer if done manually. By automating certain tedious tasks, expressions enable animators to focus on the more creative aspects of the project. 

Getting started

To start using expressions, open After Effects and navigate to your Composition, the project's primary workspace. To create a New Composition, navigate to the Composition menu at the top of the screen and select New Composition. 

new composition

Next, select the layer that you wish to animate. This can be any basic shape or text. If you are starting from scratch, you can use the Shape Tool to draw your desired object/shape.

shape tool

Similarly, you can use the Text Tool to type in your desired text. 

text tool

Once you have finalized the shape or text, it’s time to introduce expressions to the mix. To add an expression, press the Alt (Windows) or Option (Mac) key and click the stopwatch icon next to the specific property you want to animate. 

expression basics

When you add an expression to the timeline, the details will change color from blue to red. A textbox, known as the Expression Editor, will also appear on the timeline. To create an animated sequence, type in or paste an expression code into the editor, and After Effects will execute the animation. 

Now that we’ve covered the basics let’s explore some basic expressions you can integrate into your project today! 

Basic Expressions examples 

To effectively use expressions, you must first understand the syntax behind it. Below, we will break down three basic expressions and explain their syntax. 

Wiggle Expression

One of the most commonly used commands is the wiggle expression. The general formula for this expression is wiggle(frequency, amplitude). In this instance, frequency refers to the number of times you want the object to move, and amplitude refers to how much it moves. Therefore, an expression scripted as wiggle(5, 10)would result in the layer randomly moving five times per second by a distance of ten pixels. 

wiggle 5,10

loopOut Expression

Another helpful expression to streamline animation workflow is loopOut. Often, animators must work on repetitive sequences such as a ball bouncing or a character walking. Instead of manually creating keyframes for the entire clip, you can simply make the initial animation and use the loopOut expression to loop the animation. To set a keyframe, click the stopwatch icon and adjust the layer's properties accordingly. 

loopOut expression

The syntax for the loopOut expression is loopOut(). Leaving the parentheses blank will loop the keyframe animation. You can also experiment with other commands like cycle, pingpong, offset, or continue for different effects/movements. Simply type these between the parentheses to audition different looping animations. 

time*value Expression

Editors can use this expression to create a variety of animations based on the time and property they choose to manipulate. For example, you can use this expression on the rotation function to create a smooth spinning effect. 

The syntax of this expression is written as time*value. The time variable represents the current time in seconds, and the value variable represents the value by which you will manipulate the layer. 

To create a smooth spinning effect, select the layer and navigate to the rotation icon. Press alt (Windows) or option (Mac), and click the stopwatch icon to open the expression editor. Type or paste time*value into the text box. In this instance, the value represents the speed at which the shape will rotate per second. Therefore, an expression scripted as time*90 means that the shape will rotate at a speed of 90 degrees per second. Click out of the text box and watch your animation come to life!

time_value

Conclusion

Leveraging expressions in After Effects is a great way to automate tedious animation tasks. Without having to manually set and adjust keyframes, editors can save time and be more efficient. The expressions detailed above only scratch the surface of what's possible with this functionality too, so experiment and play around with the feature. There's a learning curve, sure, but the result will be a far more streamlined animation workflow.

Tl;dr

  • Expressions in After Effects are lines of code that automate repetitive tasks and can be used to adjust layer properties and effects.
  • JavaScript language is used to write expressions, and it's helpful to have a basic understanding of Java.
  • Using expressions reduces manual labor and allows for more complex animation at a faster pace.
  • Basic expressions include Wiggle expression for random movement, loopOut expression for looping animations, and time*value expression for creating smooth spinning effects.
  • These basic expressions use specific syntax and can be customized for different effects and movements.

 

Tags: Post & VFX Editing Adobe Editing Training

Comments