Faragiri
English

Choose a language 2

Learn Expressions After Effects

The five expressions that cover almost everything, why the reference is the one that changes a project, and what an expression costs. Worked on forty drifting buoys in Vigo.

6Sections
4Min read
4Depth

Recommended Before This

0 / 2

Five expressions cover almost everything anybody writes in this application, and the first is one line: wiggle(3, 20) on a position property makes a layer drift three times a second by up to twenty pixels, for ever, with no keyframes at all. The second is loopOut(), which repeats whatever keyframes are already there until the layer ends.

Bea builds a set of animated diagrams for an oceanography institute in Vigo: forty buoys drifting on a chart, a needle that follows a slider, and a counter that has to run from 0 to 1 400 000 while a graph draws itself.

The five worth memorising

wiggle(frequency, amount) is random drift, and the two numbers are how often and how far. time * 45 on a rotation property spins at 45 degrees a second, for ever, and it is how anything that turns should be built. loopOut() after two cycles of keyframes gives a hundred cycles.

One institute, forty buoys

The rung an expression is standing on

The rungs are how much the line of code replaces. Only the top two change how a project is put together rather than how long it takes.

  1. 05A reference to a control layerForty layers directed from four sliders in one placea rig
  2. 04linear(t, a, b, v1, v2)One property drives another by arithmetic you chose rather than by copying keysa relationship
  3. 03wiggle(3, 20)Drift nobody could keyframe convincingly, seeded differently per layeran afternoon
  4. 02loopOut()Two cycles authored, as many played as the layer is longa hundred keyframes
  5. 01time * 45A rotation that never drifts and never ends. Nothing to re-timetwo keyframes

The bottom three rungs save time and the top two change who can use the project. A composition whose behaviour lives in one null with four sliders can be handed to somebody else, and one with forty independent expressions cannot.

Live Web Audio Synth, 3-Band EQ & Compressor Lab

Synthesize live audio, sculpt 3-band EQ & compression, and watch the 60fps FFT spectrum.

The fourth is linear(t, tMin, tMax, value1, value2), which maps one range onto another: give it a layer's opacity and it returns a position, so one property drives another with an arithmetic relationship you chose. And the fifth is a reference, thisComp.layer("Ctrl").effect("Slider")("Slider"), which reads a value from a control on another layer and is the whole of how a rig is built.

Why the reference is the important one

Everything above is a shortcut. The fifth is a change in how a project is put together: one null layer with four sliders on it, and forty buoys each reading those sliders through an expression, means the whole set is directed from one place. Changing the drift speed is one number rather than forty layers.

Single-point control

Why routing through one control null turns forty edits into one

All shared parameters gather onto one null layer, pass through pick-whip references, and drive every buoy together.

  1. Drift speed slider
  2. Drift distance slider
  3. Global toggle control
  4. Timing offset slider
Pick-whip layer referenceAlways drag with the pick whip; renaming the control layer later breaks the path silently with a yellow triangle
  1. Buoy layers 1 to 15
  2. Buoy layers 16 to 30
  3. Buoy layers 31 to 40

Changing drift speed across forty buoys takes one slider edit instead of opening forty layers.

The pick whip writes that reference for you. Drag it from the property to the control and the path appears, correctly spelled, which matters because a layer renamed after the expression was written breaks it silently and the error appears as a yellow triangle on a layer nobody was looking at.

What an expression costs

An expression is evaluated once per frame per property, so forty buoys with two expressions each is eighty evaluations a frame, which is nothing, and an expression that references other layers which themselves have expressions is a chain that is evaluated every time. The cost becomes visible in previewing rather than in rendering, and the repair is the same one every time: convert the finished expression to keyframes on the layers that no longer need to be adjustable.

Preview overhead

How chained layer references slow timeline previews

Independent expressions are cheap, but expressions reading other expressions force repeated evaluation on every frame.

When preview responsiveness drops, freeze finished layers by converting their expressions to keyframes.

The one that replaces a hundred keyframes

A counter running from 0 to 1 400 000 cannot be keyframed, because the number has to be drawn as text and text is not a number. An expression on a text layer's source text reads a slider, rounds it, and formats it with separators, and the slider is keyframed twice. Everything about how the number moves is then in two keyframes and everything about how it looks is in three lines.

Driven typography

Three steps to animate a counter from 0 to 1 400 000

Text cannot be interpolated directly as a number, so arithmetic sits between a keyframed slider and Source Text.

  1. 01Keyframe a slider twiceSet the start and end count on an Expression Control slider so two keyframes control all timing
  2. 02Read and round the valuePull the slider value into Source Text and round away decimals on each frame
  3. 03Format with separatorsApply three lines of formatting so large figures read cleanly while counting up

Two keyframes govern how the counter moves, and three lines of code govern how it looks.

That is the shape of most real expression work: a small piece of arithmetic between a property somebody animates and a property somebody sees.

Two things worth using in 2026

JavaScript rather than the legacy engine is a project setting and it has been the default for several versions. It is faster, it uses the same string and number methods as the rest of the world, and it breaks a handful of old snippets copied from forums, which is the only reason anybody still switches back. It is free and it is one dropdown in the project settings.

Built-in tooling

Two expression features worth using in 2026

Both are included at zero cost and make rigs faster to run and easier for someone else to operate.

2026 expression setup

  1. YesJavaScript engine in Project SettingsFaster evaluation and standard modern string and number methodsYes
  2. YesExpression Control effects on a nullSlider, angle, colour and checkbox controls give operators a clean UIYes
  3. NoHard-coded numbers buried inside codeForces teammates to edit scripts just to tweak timing or distanceNo
  4. NoLegacy engine for general workOnly kept around when pasting unmaintained forum snippetsNo

Moving numbers out of code into Expression Controls turns private scripts into shareable rigs.

Expression controls, which are effects that do nothing except hold a number, are the free half of rigging. A slider, an angle, a colour or a checkbox on a null layer becomes the interface to a whole composition, and it replaced editing the numbers inside expressions, which is where a rig stops being usable by anybody else. They are included and they cost nothing.

The mistake, made on the forty buoys

Bea wrote wiggle(3, 20) on all forty buoys, which drifts them all convincingly and independently, because the wiggle is seeded per layer. Then the institute asked for the drift to stop during the second half. There is no keyframe anywhere to stop, because the expression is the animation, so every one of the forty had to be rewritten to multiply the wiggle by a slider she should have built on the first afternoon. An expression with no control on it is an animation nobody can direct, and adding the control costs nothing at the start and forty layers later.

The forty-buoy rewrite

Multiplying wiggle by a slider before duplicating forty layers

An un-controlled expression cannot be paused halfway through a shot because there are no keyframes to stop.

How do you wire wiggle across forty layers?
  • Raw wiggle(3, 20) on each layer
    Rewrite all forty layers laterImpossible to calm the drift in the second half without editing every layer
    • Looks convincing on the first afternoon
    • Zero keyframes exist to fade motion out
    • Every buoy has to be rewritten by hand
  • Wiggle multiplied by a control slider
    Direct the whole fleet from one nullAnimate the slider down to zero whenever the chart must settle
    • Multiply wiggle output by a slider reference
    • Key the slider from one down to zero
    • Costs nothing at setup and saves forty edits

An expression without a control multiplier is an animation nobody can direct.

The keyframes an expression replaces, and the graphs that shape them, are animating a property, and the graph editor. The order in which an expression's result meets the rest of the layer is the standard tool for motion and compositing. A rig built out of controls and references, applied to a drawn figure, is bones and puppet tools for flat artwork. And an expression is code, which is a subject with its own pillar: the language the browser runs, and everywhere else it ended up.

Alongside this

Above this