After Effects Expressions for Beginners — 8 You Can Use Today

Expressions in After Effects are small pieces of code that control property values dynamically. They sound intimidating if you have never programmed before, but most useful expressions are short, easy to copy, and you do not need to understand every character to use them effectively.

Here are 8 expressions that solve real production problems.

How to Add an Expression

Alt-click (Windows) or Option-click (Mac) the stopwatch icon next to any property to add an expression. A text field appears in the timeline where you type or paste the expression code.

1. Wiggle — Random Motion

wiggle(2, 20)

Applied to Position, this creates continuous random movement. The first number is frequency (wiggles per second), the second is amplitude (how far it moves in pixels). Use it for camera shake, floating elements, or jittery motion.

2. Loop — Repeat Keyframes

loopOut("cycle")

Repeats all keyframes in a layer indefinitely. Set up 2-3 keyframes for a bounce, rotation, or scale animation, then add this expression to loop it forever without adding more keyframes.

3. Time — Value Based on Time

time * 90

Applied to Rotation, this rotates a layer continuously — 90 degrees per second. Change the number to adjust speed. Applied to other properties, it creates continuous change tied to playback time.

thisComp.layer("Control Null").transform.opacity

This makes one layer's opacity match another layer's opacity exactly. Replace "Control Null" with the name of any layer in your composition, and replace transform.opacity with any property path. Essential for building rigs where one layer controls many others.

5. Convert Degrees to Radians

Not an expression you type directly, but a function you use inside others:

degreesToRadians(45)

Useful when working with trigonometry for circular motion or position calculations.

6. Circular Motion

x = Math.sin(time * 2) * 100;
y = Math.cos(time * 2) * 100;
[x + thisComp.width/2, y + thisComp.height/2]

Applied to Position, this moves a layer in a circle around the centre of the composition. Change the %%CODE0%% values to adjust the circle radius, and %%CODE1%% to adjust speed.

7. Clamp — Limit a Value Range

clamp(value, 0, 100)

Keeps a value within a minimum and maximum. Useful when linking properties and you want to prevent extreme values. For example, preventing opacity from going below 0 or above 100.

8. Index-Based Offset

index * 10

Applied to Rotation, Position offset, or Opacity on multiple layers, this gives each layer a different value based on its position in the layer stack. Layer 1 gets 10, layer 2 gets 20, layer 3 gets 30. Useful for creating staggered effects across many layers without setting values manually.

Going Deeper

These expressions use After Effects' built-in JavaScript environment. If you want to go further, the next step is learning how to reference layer properties with %%CODE0%%, how to use %%CODE1%% statements for conditional animation, and how to write your own utility functions.

For those who want to automate beyond expressions — building multi-layer effects, batch processing, and generating complex rigs automatically — After Effects scripting is the next level. Scripts are run from the Scripts menu and can interact with the full After Effects project, not just a single property.

Back to all posts