Expression Wizardry

WIP. Last update: 16 July 2021


Coding and expressions are powerful tools that let you take any creative idea to the next level in After Effects. Designing procedures and algorithms open up possibilities of creating complex animation and design that would be impossible through doing things manually. You will be more focus on the creative aspect of the design and not be bounded by technical limitation or repetitive taks..

Learning to write your own expressions or gaining more control over its usage can a fairly difficult one if you have no coding or programming background. However, that does not mean you are not able to pick up this skill or knowledge. It will take some time for your brain to "rewire" itself to thinking more in code and procedural fashion. Hence, do not feel pressured to gain comprehension when you first start out.

Why should you use Expressions?

Learning anything is a good use of our time, but the question is what should we learn to make best use of our time.

Ask yourself these questions:

  • Why are you learning expressions?

  • Do you really need to learn them to make better works?

  • What are the pros and cons of using expressions in your motion design workflow?

  • How would you implement expressions in the animation or design process?

  • What do you think you can create with expressions, and what can you not do with it?

Benefits of using Expressions

Reduces repetitive work and errors

When it comes to performing simple repetitive tasks like switching out the text in a lower-third, there are two challenges: how tedious it is as well the possibilities of human error (eg.typo). By using coding, we can design procedural workflow to eliminate or reduce these factors.

Save hours with automation

If you have to make 100 of lower-thirds or arrange layers in random position in After Effects by hand, you would be spending hours to get the job done. What happens if the client wants changes, will you have to restart from scratch and repeat the process. Learning

The processes of defining a computer program to create form is often initially slower than creating the form directly by hand. But once the program is completed it can be very fast to try many variations.

Build your own tools and processes

When you are also limited by what After Effects presents in front you, you are given a extremely narrow possibilities of what you as an artist can do. However, creating your own rigs or setups using expressions can allow more control of executing your vision. In addition, you can also build tools for your team to enhance productivity and creativity.

Focus more on the creative bit

Part of the creative production process is inhibited by technical limitations and iterative tasks, and you often have to switch modes between a creative and being a software operator. Having mastery over code, allow you focus on making great creative work and not mind little small things that will hinder your process.

Who benefit most from using Expressions?

  • Broadcast - versioning

  • Data visualization

  • Animators with technical direction, who want to engineer new innovative solutions, troubleshoot

  • Procedural design and animation

How does this course work?

Kesson's technique: Lectures of techniques, and coding walkthrough, create a project based on each topic, think of innovative applications, process page review, move on

Introduction to Computational Thinking

Learning the language of code: Machine Talk πŸ€–

Many people find coding intimidating and might say "it's too hard and not for me", however, I believe it is because they have not develop fluency to read and write to communicate to the machine that is After Effects. Learning to code is indeed tough because it is learning a new language which is one of the toughest thing you can do in this world. This course serves as primer to develop a mental model of how approach coding and expressions. It will take a lot of time and effort to study and practice but mostly importantly you must be patient with your learning process because you learn in your own unique way.

Consider this: What is the #1 challenge you have when it comes to coding? Why is it intimidating for you?

Machine talk #1πŸ€–

The world of expressions will involve you speaking to a higher power within your software, I tend to refer to them as robots and machines. They lack agency, and by that I mean that they need to be told what to do at every single step like a baby or a child. To put it another way, you want to see yourself as a chef writing a highly specific instructional recipe for the machine to cook on their own; so you need to specify the ingredients, the procedures and tools used, and where to get them. We will start with how machines listen to instructions and something we are all familiar with: a file folder tree.

Object Model: demystifying expression syntax with file folder tree

​Hierarchy diagram of the main After Effects scripting objects​


When we retrieve a file from our desktop, you notice that it has a path directory and that is how your computer stores its data. Coding in After Effects works the same way when you are referencing parameters and properties.

Consider this scenario: You are telling After Effects to "animate a ball from left to right of the screen within 4 seconds in this composition".

AE would be confused because it does not understand:

  • What composition are we using?

  • What is a ball? Which layer is it?

  • What is left and right? How many pixel is that in X or Y axis?

  • what co

These are our human language terms, and we need to refrain from talking to AE like that. What AE wants to hear is : thisComp("demo").layer("square").transform.position[1].

To break down the meaning, it translates as "in this composition called "demo", the layer "square", get the position property X. Notice how names are in double quotes.


Introduction to expressions

What is an expression?

  • javascript

  • how to insert an expression? pickwhip

  • Difference between expression, script, scriptUI, plugin

    • script - folderstructurer

    • scriptUI - tilecomp

    • CEP panels & extensions

    • plugin

  • Why expressions and what can you do

    • generative art

    • automation - lower thirds

    • toolkit building

    • eliminate repetitive tasks - z repeater

    • animation presets building

    • advanced techniques


  • do not be pressure to be fluent in expressions or scripting

  • but be informed enough that you can speak to someone who is knowledgeable and request him or her to write expressions for you to increase your productivity and do things faster or easier

  • It is possible to be self-taught because I did it myself


Developing our intentions

Discovering why

Expressions are small pieces of JavaScript code that you can plug into animated properties in your After Effects projects, that evaluate to a single value for a single layer property at a specific point in time. They can help us

  1. Avoid manual repetitive tasks & save hours

  2. Develop advanced motion techniques

  3. Create complex generative art & design

  4. Tool development

    1. custom animation toolkit, setups and rigs

    2. Animation presets building

  5. Automation eg. lower-thirds versioning


  1. How do I use an expression?

  2. Do I need to learn Javascript?

  3. How do I get good at it

Arrays & Variables

Expression focus:

Core skill: pickwhip expressions, troubleshooting, repetition

  • Animation preset creating color controls - shape layer

  • ternary operator

  • modulus operator - creating alternating color controls


  1. Arithmetic & Mathematics: (not allowed to use pickwhip)

    1. Using the Circle shape layer, have the repeater automatically rotation itself and a radius control

    2. Do the same thing without the repeater, have the shape scale down smaller by 5% and rotation by 15% for each iteration.

  2. Arrays & Variables

  3. What is a variable and why? Variable containers for storing data values, be it numbers, arrays, or text strings.

  4. What cannot be an variable? Declaring variables or Arithmetic

  5. What is an array: An Array is a type of object that stores an ordered set of numbers. An Array is represented as a list of numbers separated by commas and surrounded by brackets

    • You can assign an Array object to a variable, making it easy to refer to array values in other areas of the expression. For example:

  6. What is an element? 0 and 1 on & off confusion (boolean)

    • You can access the individual elements of an Array object by using brackets and an index number to indicate which element you want. The elements in an Array object are indexed starting from 0. Using the previous example, myArray[0] is 10 and myArray[1] is 23.

  7. Keep in mind: Javascript is a case-sensitive language, so be sure type in the correct variable names: these variables: myVariable, myvariable,MYVARIABLE are all different variables.

  8. Quiz: Which of these transform property is an array?

  9. Quiz: Which is element number is .... , (answers are in the caption)

  10. challenge recreate this simple wiggle array exercise: 1. create a variable called x and assign the first element of the wiggle function to it, then create

x = wiggle(10,200)[0];[x,value[1]];

Hello friends, here is Part 3 to Expression Wizardry ! This week we learn about variables and arrays. These are the basic building blocks of coding, you have to know this if you want to write expressions with ease! I even included quizzes and a challenge to test your comprehension and understanding. Please let me know if you have any questions or if things are not clear enough for you!

Here is the answer for the expression challenge: x = wiggle(10,200)[0]; [x,position[1]];

  1. Conditional

  2. What is a conditional statement: Conditional statements are used to perform different actions based on different conditions. Use the if statement to specify a block of JavaScript code to be executed if a condition is true.

  3. example if(x>50) x<50

  4. common trap: =50 use ==

  5. Comparison Operators & Logical Operators:

    1. operators that compare values and return true or false

    2. operators that combine multiple boolean expressions or values and provide a single boolean output.

    3. boolean: is a data type with two possible values: true or false.

  6. the else statement: Use the else statement to specify a block of code to be executed if the condition is false.

  7. example

  8. ChallengeQuiz: Decipher this lines of code + answers in description

  9. For Loop

  10. What is a loop statement: Loops can execute a block of code a number of times, saving you the need to copy and paste or otherwise repeat lines of code. There are different types of loops such as the for loop, while loop, or do while loop.

  11. A commonly used loop is the for loop which allows you to repeat the body of a loop a specified number of time.

  12. Here is how it works, the counter variable (i) is set starting at 0, then the boolean expression is checked (whether the condition is true), if it is true, execute the loop and if false, stop the loop. The counter variable is incremented again, and the boolean expression is checked again, and the whole process repeats

    for(i=0; i<10;i++){
    //statement to execute
  13. To simplify the explanation, a for loop starts at 0, a conditional expression is checked, if true, execute then increment denote. i++ simply means i+1 after each loop have been completed

    //statement to execute
    Statement 1 is executed (one time) before the execution of the code block.
    Statement 2 defines the condition for executing the code block.
    Statement 3 is executed (every time) after the code block has been executed.
  14. Keep in mind these elements are separated by semicolons not commas!

  15. video Here is an example of how for-loop can repeat source text in a text layer for a specific number of times. The number of times to repeat is denoted by the variable "n" which equals to 20. That means the code will add the sourcetext to itself by 20 times, hence a text repeater

    s = mytext = value;
    n = 20;
    s+= mytext;
  16. You can connect the n variable to a slider, and control it via the effects panel or save it out as an animation preset

  17. cta give this expression a try, and watch my tutorial "text repeater preset setup" (link in bio)


A script is a series of commands that tells an application to perform a series of operations.

Automate repetitive tasks, perform complex calculations, and even use some functionality not directly exposed through the graphical user interface

Think of it as a cooking recipe that give to After Effects

Difficulty: 1/10

  1. Script:

A script is a series of commands that tells an application to perform a series of operations.

Automate repetitive tasks, perform complex calculations, and even use some functionality not directly exposed through the graphical user interface

Think of it as a cooking recipe that give to After Effects

Difficulty: 5/10

  1. ScriptUI

  2. ​

Works just like a script but you get a user interface that allows you to specify additional settings.

Examples: Ease & Whizz, Ray Dynamic Color

Difficulty: 6 / 10

  1. Extension

  2. Plugins

  3. ​

"A plugin is a component that adds a specific function or feature to an already existing software. Plugins are almost universally developed by third-party developers, and not the developers of the original software itself (Adobe)." β€” School of Motion Blog

Written in C++

Difficulty: 10/10

Examples: Deep Glow, Trapcode Particular, Element 3D

  1. cta

  2. How to troubleshoot

  3. typos

  4. missing semi-colons

  5. uppercase or lowercase

  6. SourceRectAtTime

  7. how does it work?

  8. video

  9. when should you usw

01 Basics

  • How do use an expression

  • Do visit

  • No knowing what to do when there’s an error - troubleshooting

    • typo mistakes: wrong letter case for function, accidentally type wrong symbols such as "comma" for "dots"

Week 4 Setups

  • string operations

Expressions focus: sourceRectAtTime, valueAtTime()


  1. Recreate this workout counter from the Youtube workout video. Your setup should consist of

    • Use of one composition

    • The size of the boxes must be constant

    • Responsive sizing of text to the size of the box

  • Box Boy Lantern setup

  • Z-repeater

  • Random

  • Responsive lower-thirds

  • Cool stuff - Oscillations

300 - level innovative solutions

  • simulation createPath

  • ​

  • visual analysis training, breaking down a reference animation, mastercopies

  • ludic experiments

  • "point" vision

  • building your repository and