← Back to Tools

AE Expression Snippets

Copy-paste After Effects expressions for wiggle, loop, bounce, rotation, and more. Adjust parameters and copy to clipboard with one click.

9 expressions

Wiggle

Adds random oscillation to a property value.

wiggle(5, 50)

Where to apply: Any Property

Time to Frames

Converts current time to frame number.

timeToFrames(time, 1 / thisComp.frameDuration)

Where to apply: Any Property

Random

Generates a random value between min and max.

random(0, 100)

Where to apply: Any Property

Gauss Random

Generates random values with a Gaussian (bell curve) distribution.

gaussRandom(0, 50)

Where to apply: Any Property

Typewriter Effect

Reveals source text one character at a time.

txt = value;
len = Math.round(linear(time, 0, 3, 0, txt.length));
txt.substring(0, len)

Where to apply: Source Text

RGB to Hex Color

Defines a color using hex values (converted to 0-1 range).

hexToRgb("#FF5733")

Where to apply: Any Color Property

Endless Rotation

Continuously rotates a layer at a constant speed. Multiply time by degrees per second.

time * 360

Where to apply: Rotation

Loop

Loops keyframed animation continuously. Choose a loop type below.

loopOut("cycle")

Where to apply: Any Keyframed Property

Bounce Animation

Creates a bouncing effect after the last keyframe.

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;
}
if (n > 0 && t < 1) {
  v = velocityAtTime(key(n).time - thisComp.frameDuration / 10);
  amp = 0.06;
  freq = 3;
  decay = 5;
  value + v * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t);
} else {
  value;
}

Where to apply: Any Keyframed Property

How to Use Expressions in After Effects

To add an expression to any property in After Effects, hold Alt (Windows) or Option (Mac) and click the stopwatch icon next to the property. This opens the expression editor where you can type or paste code that controls the property's value dynamically.

Expressions use JavaScript-based syntax and give you programmatic control over animation properties without manually keyframing every value. They're especially useful for repetitive motion, procedural animation, and linking properties together.

Common Use Cases for AE Expressions

Motion designers use expressions to automate wiggle effects, create seamless loops, build typewriter animations, and drive complex motion systems. The wiggle expression alone is one of the most used tools in After Effects, adding organic randomness to position, scale, rotation, or any other property. Loop expressions eliminate the need to copy and paste keyframes, while time-based expressions create continuous animations that never stop.

Expressions vs Scripts in After Effects

Expressions are applied directly to individual properties and run every frame during playback. Scripts, on the other hand, are standalone programs that run once to perform batch operations, generate layers, or automate workflows. Both use JavaScript, but expressions are embedded in the timeline while scripts run from the Scripts menu or ScriptUI panels.

Tips for Writing Better Expressions

Start simple and build complexity gradually. Use variables to make your expressions readable and adjustable. Link expressions to Slider Controls for keyframeable parameters that are easy to tweak. When troubleshooting, check the expression error message at the bottom of the composition panel - it usually points to the exact line causing issues.

Let's talk

Available for product videos, animation systems, creative direction, and workshops.