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
Avoid manual repetitive tasks & save hours
Develop advanced motion techniques
Create complex generative art & design
Tool development
custom animation toolkit, setups and rigs
Animation presets building
Automation eg. lower-thirds versioning
FAQs
How do I use an expression?
Do I need to learn Javascript?
How do I get good at it
β
β
Coding can be difficult when starting out, it is no different from learning a foreign language, and it takes considerable amount of time before you actually achieve fluency. Before we get into the coding segment, you need to develop a mental model of how coding work.
video
Consider this scenario: Imagine After Effects is an actual person, and you asking it 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?
This is what is going on:
You : Comp( "???").thisLayer( "???").propertyGroup( "???").property[?]
AE: Comp( "scene").thisLayer( "ball").transform.position[0]
To break it down, notice each part is separated by a period (.) operator and it translate as in composition "scene" > layer "ball" > transform properties > position > X
Think of it as βMachine Talkβ. You are talking to a robot that needs really specific instructions.
video
you notice this when you pickwhip a properties into the expression box
notice the period (.) operator.
Week 1 assignments
In the Exercise 1.1 After Effects file, write down the following code for all the layers. You are not allowed to use the pickwhip.
x position
rotation
slider control
Expression focus:
Core skill: pickwhip expressions, troubleshooting, repetition
Animation preset creating color controls - shape layer
ternary operator
modulus operator - creating alternating color controls
Arithmetic & Mathematics: (not allowed to use pickwhip)
Using the Circle shape layer, have the repeater automatically rotation itself and a radius control
Do the same thing without the repeater, have the shape scale down smaller by 5% and rotation by 15% for each iteration.
Arrays & Variables
What is a variable and why? Variable containers for storing data values, be it numbers, arrays, or text strings.
What cannot be an variable? Declaring variables or Arithmetic
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:
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.
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.
Quiz: Which of these transform property is an array?
Quiz: Which is element number is .... , (answers are in the caption)
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]];
Conditional
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.
example
if(x>50) x<50
common trap: =50 use ==
Comparison Operators & Logical Operators:
operators that compare values and return true or false
operators that combine multiple boolean expressions or values and provide a single boolean output.
boolean: is a data type with two possible values: true or false.
the else statement: Use the else statement to specify a block of code to be executed if the condition is false.
example
ChallengeQuiz: Decipher this lines of code + answers in description
For Loop
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.
A commonly used loop is the for loop which allows you to repeat the body of a loop a specified number of time.
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}
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
for(start;condition;increment){//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.
Keep in mind these elements are separated by semicolons not commas!
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;βfor(i=1;i<n;i++){s+= mytext;}s;
You can connect the n variable to a slider, and control it via the effects panel or save it out as an animation preset
cta
give this expression a try, and watch my tutorial "text repeater preset setup" (link in bio)
Double quotes
Parsing string into number
Parsing number into string
Getting dates and concatenating text
using text as read out: sourceRect & pickwhip slider
Aenhancers: masks
expression: numLayers, thisComp.name, length
challenge
Get
String operators: split, regex, replace, substitute
Functions
think of them as robots which can only perform one tasks or small computations
Functions (robots with no agency) insert emoji
visuals
Random displacement
Animating in a circle and a spiral fashion
Making an image carousel
radial scale up staggering - Buck Apeel with valueAtTime
Commonly used expression
time & drift
slider controls
random
wiggle
posterizeTime
sourceRectAtTime
What do I do if forget what an expression do? Expression Aehancers,
Wiggle
general (see ukra)
time
Basics: Difference
brief
it is about to know the difference between the following
we know that expression a code snippet
Animation Preset
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
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
ScriptUI
β
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
Extension
Plugins
β
"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
cta
How to troubleshoot
typos
missing semi-colons
uppercase or lowercase
SourceRectAtTime
how does it work?
video
when should you usw
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"
string operations
Expressions focus: sourceRectAtTime
, valueAtTime()
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
Recreating the Matrix
text-repeater : for loop statement
spreadsheet to comp
Variable var fruit = π or var π,π,π String "string is text" Array var fruits = [π,π,π,π,π,π,π,π] Conditional if (fruit){ statement} else {statement} For for( i = 0; i < value ; i++) Object var x = {firstName:"John", lastName:"Doe"}; //
Focus on building rigs and setups for the team
masterproperties
simulation createPath
β
visual analysis training, breaking down a reference animation, mastercopies
ludic experiments
"point" vision
building your repository and
β