Expressions
An expression replaces a property’s sampled value with a computed one, evaluated every frame. Use it when a relationship is easier to state than to keyframe: “always half the parent’s rotation”, “wobble around this value”, “follow that layer with a delay”.
The editor
Graph panel → ExpressionEditor.
- Monospaced, with quick-insert autocomplete for the API.
- Inline plain-language errors rather than a stack trace.
- A live value that updates as you scrub the playhead — so you can see what the expression is producing before you commit to it.
- AI assist produces an editable expression, never a locked black box. You can read it, change it, and delete the parts you do not want.
Expression controls
Controls are named inputs that live on a layer and can be referenced from any expression. They turn an expression into something with a UI.
| Control | Type |
|---|---|
| Slider | Number |
| Angle | Degrees |
| Point | 2D vector |
| Colour | RGBA |
| Checkbox | Boolean |
| Dropdown | Enumerated choice |
| Layer | A reference to another layer |
Add Slider Control is in the top-bar Animate menu. It creates a named control you then reference:
ctrl('Wobble Amount')Because the control is itself a property, it can be keyframed — which is how you animate the parameters of an expression rather than the value directly.
The language
A real expression language with vector support, evaluated per frame by the engine’s own interpreter. Expressions can read other properties, other layers, the current time and the composition’s parameters.
Coordinate spaces
Four functions convert a point between a layer’s own space, the composition and the world — which is what you need whenever one layer must follow a point on another layer that is itself parented, rotated or scaled:
toComp(point) fromComp(point)
toWorld(point) fromWorld(point)Measuring a layer
sourceRectAtTime() gives a layer’s own bounding box at a time. It is how you
write motion that adapts to content instead of to numbers you typed — a
background plate that fits its text layer, a underline that matches a heading
whose words change.
Reading keyframes and markers
Expressions can read the keyframes on a property, not just the sampled value
— their times and their values — and reach both composition and layer markers
through marker.*. Driving motion from markers you place on the ruler is
usually more legible than hard-coded times, because the timing stays visible in
the timeline.
Randomness and vector maths
Seeded randomness and the usual vector helpers. Seeded matters: an expression whose randomness changed per render would make two exports of one project differ, which the render model does not allow.
Expressions are evaluated by the engine’s interpreter, not by the JavaScript
runtime. In development builds the content security policy blocks new Function outright — which is a deliberate constraint, and the reason the
interpreter exists rather than an eval shortcut.
Expressions and keyframes together
An expression and a track are not mutually exclusive. The common pattern is:
- Keyframe the base motion.
- Add an expression that reads the sampled value and modifies it — adding a wobble, clamping it, offsetting it by another layer’s value.
That keeps the timing editable in the timeline while the expression handles the relationship.
Turning one off, and baking one down
Two things you can do to an expression short of deleting it:
| Action | What happens |
|---|---|
| Disable the expression | It stops driving the property but stays on it. The property falls back to its keyframes or its static value |
| Convert Expression to Keyframes | Samples the expression across the range and writes ordinary keyframes, then the expression’s job is done |
Disabling is the one to reach for while debugging: it answers “is the expression causing this?” without you losing the expression to find out.
Converting is how you hand a project to someone else, or how you take an expression as a starting point — generate the motion, bake it, then edit the keys by hand. It is also the escape hatch when an expression is doing something almost right.
When not to use one
- If a preset does it. Wiggle, pulse, shake and sway all exist as presets that write ordinary keyframes, which are easier to retime later.
- If you will need to hand the project to someone else. Keyframes are legible to anyone; an expression is legible to whoever wrote it.
- If the relationship is one-off. Two keyframes beat a line of code for a single move.
Related
- Keyframes
- Animation presets
- The AI assistant —
set_expressionis one of its tools