Learning a Second Language - Why Motion Designers Need to Understand Scripting and Expressions

Learning a second language can be a daunting task, but as a motion designer you don't need to master a scripting language to begin using it to make your life easier. Trust us, it's worth it. By learning a few simple commands and how they are made, you can start using expressions and scripting today. To begin, let's define each term and how they are used.

What is an expression?

Expressions are used to create relationships between layer or node properties. By using expressions you can make either one layer property mirror or offset another layer property. In After Effects, this is as easy as using the pick whip to link one layer property to another. You can also use expressions to tell a layer property what to do or how to react without using other layers. For instance, you can apply wiggle (10,10) to the position property of a layer. This expression will set that layers position based on time and it's original position. Wiggle Expression in After Effects wiggle(10,10)

What is a script?

A script contains a series of commands that tells an application to do something. When a script is run, After Effects performs the defined operations and then it is finished. Scripts can be used to automate repetitive tasks such as renaming layers to more complex tasks like creating a series of compositions and structuring them in folders. Scripts can also do things that you typically wouldn't see in the UI. For instance, you can have After Effects send you an e-mail when a render is complete. This is helpful if you have other things away from the computer you need to work on and are able to receive email notifications on your phone.   Now that you have a little understanding of how an expression or script can be used, you might be wondering how they can help you be a better artist or designer? Expressions and scripts can save time and lots of if when used throughout your workflow.

How should I start?

As an After Effects user, you should spend some time getting familiar with JavaScript. There are tons of resources out there that can help you understand JavaScript with Mozilla Developer Network being one. You can also can start exploring the possibilities of expressions by using the pick whip within After Effects. After Effects Timeline Alt + Left Click on the stopwatch next to the attribute you wish to apply the expression. After Effects Timeline - Expression Editable text appears where the expression will live. After Effects Timeline - Pick Whip Click and drag the pick whip (spiral icon) to another layer's attribute.

After Effects Timeline - Expression

The expression is then built and attached to that layer's attribute. Once you become comfortable with using the pick whip to build expressions, you can explore what else After Effects has to offer by clicking the carrot next to the pick whip icon. There, you can access many functions that can be used to build your own custom expressions and then create custom controls and sliders to allow you to key frame your expressions. Once you get that far you should be comfortable enough to begin writing your own custom expressions from scratch.

How can scripts and expressions help a motion designer using After Effects?

The issues with animating every individual element within a design is if you make a minor change, you have to update every individual element with the change. This can be very time consuming, especially if you are working with an indecisive client. By creating easy to use controls with expressions, you can make changes to many elements of your project quickly and have those changes automatically update throughout your compositions. Nothing is worse than having a client ask for a change and making that change but forgetting to update it in a single comp. Avoid headaches by tying key elements, text, colors and movements to expression controls and seem like a wizard with your client. Expression for Overlap and Follow through Using expressions, you can link elements and offset them by time, or numerous other variables. Take a look at lesson 14 from this 12 Principles of Animation course in After Effects. Here you will see an expression that allows you to apply a fluid follow through and overlap principle to your animation with the use of expressions. The best part is you only have to edit one layer to modify the animation. You can see how learning scripts and expressions can save you time. However, you aren't just limited to modifying animations. More advanced scripts can automate whole systems for speeding up workflows. Run a script and have it import a video and title, then send it off to render using a render farm. Learn more about what's possible with expressions in After Effects by watching After Effects Expressions Made Easy.