Expressions

A focused collection of reusable expressions for After Effects.

expressions across categories.

Looping

Loop Out

Repeats the existing keyframes after the final keyframe.

Expression
loopOut('cycle');

Use on properties with at least two keyframes.

Loop In and Out

Extends an animation before the first keyframe and after the last keyframe.

Expression
loopIn('cycle') + loopOut('cycle') - value;

Useful when a looping element needs to exist across the full comp.

Ping-Pong Loop

Loops keyframes forward, then backward, for a seamless back-and-forth motion.

Expression
loopOut('pingpong');

Wiggle

Subtle Position Drift

Adds slow organic movement without making the layer feel unstable.

Expression
wiggle(0.4, 24);

Best for background elements, floating details, or soft camera movement.

Posterized Wiggle

Creates stepped random motion instead of constantly interpolated motion.

Expression
posterizeTime(8);
wiggle(3, 18);

Good for stop-motion, jitter, or intentionally graphic movement.

Time

Time-Based Rotation

Rotates continuously at a predictable speed without keyframes.

Expression
time * 45;

Change 45 to control degrees per second.

Loop by Seconds

Repeats a section of time using the current comp time.

Expression
duration = 2;
t = time % duration;
valueAtTime(inPoint + t);

Helpful for looping prebuilt motion without trimming the layer.

Text

Character Counter

Rounds a slider value and displays it as text.

Expression
Math.round(effect('Slider Control')('Slider'));

Add a Slider Control effect to the text layer first.

Line Break From Marker

Uses a layer marker comment as editable source text.

Expression
marker.numKeys > 0 ? marker.key(1).comment : value;

Good for quickly changing text without opening the Source Text property.

Shape Layers

Rectangle Size From Text

Sizes a shape layer rectangle to match another layer with padding.

Expression
textLayer = thisComp.layer('Text');
padding = [48, 28];
box = textLayer.sourceRectAtTime(time, false);
[box.width + padding[0], box.height + padding[1]];

Apply to a Rectangle Path Size property.

Utility

Anchor Point to Center

Centers the anchor point based on the layer bounds.

Expression
box = sourceRectAtTime(time, false);
[box.left + box.width / 2, box.top + box.height / 2];

Apply to Anchor Point on text or shape layers.

Clamp Slider

Keeps a slider-driven value inside a predictable range.

Expression
slider = effect('Slider Control')('Slider');
clamp(slider, 0, 100);

Useful when exposing controls through Essential Graphics.