The Best 10 After Effects Expressions You Need to Know
After Effects expressions are a powerful tool for animators and motion designers. They can automate animations, link properties, and create complex effects with minimal effort. Here’s a list of 10 essential expressions every After Effects user should know, along with a brief explanation and example for each.

1. Time Expression
Expression:
javascript
Copy code
time
Description: The time expression is one of the most basic but useful expressions in After Effects. It simply returns the current time in seconds. It’s perfect for creating animations that loop or progress over time.
Example Usage: Apply this expression to a layer's position to make it move continuously across the screen:
javascript
Copy code
position + [time*100, 0]
2. Wiggle Expression
Expression:
javascript
Copy code
wiggle(frequency, amount)
Description: The wiggle expression adds random movement to a property. It’s useful for creating natural, organic motions or effects like shaking.
Example Usage: Apply this expression to a layer’s position to make it randomly jiggle:
javascript
Copy code
wiggle(5, 20)
This will make the layer wiggle 5 times per second with an amplitude of 20 pixels.
3. Loop Expression
Expression:
javascript
Copy code
loopOut(type = "cycle", numKeyframes = 0)
Description: The loopOut expression creates a looping animation. It can be customized with different types like "cycle", "pingpong", "continue", and "offset".
Example Usage: To loop an animation indefinitely, use:
javascript
Copy code
loopOut()
4. Bounce Expression
Expression:
javascript
Copy code
freq = 4; // Frequency of the bounce
decay = 2; // Decay rate of the bounce
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}
amp = velocityAtTime(key(n).time - thisComp.frameDuration / 10) * .1;
value + amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t);
Description: The bounce expression simulates a bouncing effect, making an animation appear to bounce when it reaches the end of its motion.
Example Usage: Apply this expression to a layer’s position to add a bouncing effect at the end of its animation.
5. Hold Expression
Expression:
javascript
Copy code
holdTime = 2; // Time in seconds to hold the value
t = time - key(1).time;
valueAtTime(key(1).time + Math.min(t, holdTime))
Description: The hold expression makes a property hold its value for a specified time before changing. It’s useful for animations that need to pause at certain points.
Example Usage: Use this expression to hold the value of a layer's opacity for 2 seconds before transitioning to the next keyframe.
6. Look At Expression
Expression:
javascript
Copy code
lookAt(position1, position2)
Description: The lookAt expression makes a layer always face another layer or point in 3D space.
Example Usage: Apply this expression to a camera’s orientation to make it always look at a target layer:
javascript
Copy code
lookAt(thisLayer.position, targetLayer.position)
7. Value At Time Expression
Expression:
javascript
Copy code
valueAtTime(time - 1)
Description: The valueAtTime expression allows you to retrieve the value of a property at a specific time, which is useful for creating complex animations based on past values.
Example Usage: Use this expression to make a layer’s position follow the position of another layer one second earlier:
javascript
Copy code
position.valueAtTime(time - 1)
8. Random Expression
Expression:
javascript
Copy code
random(min, max)
Description: The random expression generates a random value between the specified minimum and maximum values. It’s perfect for creating variations and unpredictability.
Example Usage: Apply this expression to a layer’s position to randomly offset it:
javascript
Copy code
random([-100, -100], [100, 100])
9. Time Remap Expression
Expression:
javascript
Copy code
loopOut(type = "cycle")
Description: The time remap expression allows for more advanced control of time-based animations, including looping and reversing.
Example Usage: Apply this expression to a layer’s time remap property to loop the animation:
javascript
Copy code
loopOut()
10. Ease Expression
Expression:
javascript
Copy code
ease(time, key(1).time, key(2).time, key(1).value, key(2).value)
Description: The ease expression creates smooth transitions between keyframes, adding acceleration and deceleration to animations.
Example Usage: Use this expression to make a layer’s position ease in and out smoothly:
javascript
Copy code
ease(time, key(1).time, key(2).time, key(1).value, key(2).value)