Write motion as code
Keep a label 120 px above a moving card, make a shape pulse with the bass, or build forty layers with one script.

Link a property to a formula
- Select a layer and pick the property to drive.
- Open its expression editor and write a formula. It is evaluated every frame.
- Read another layer by name:
layer("Card").y - 120keeps a label 120 px above a card that animates. - Remove the expression to restore the property's own keys underneath.
#value is the property's own keys or base value. #value + wiggle(2, 5) shakes your animation instead of replacing it. #time is the playhead, so sin(#time * 2) * 20 loops and #time * 90 spins at a constant rate.
Other functions include random, noise, wiggle, clamp, mix, map, smoothstep, blink, rgb, hsl and if.
Read bones, sound and trackers
Expressions reach into other systems by name.
- Move a rig control and read it:
bone("Face", "Mouth", "y")returns that bone's pose. Wire it to a switch withmap(...). - Blink on top of keyed eyes:
if(blink(4) > 0, "Closed", #value). One expression shared by both eyes blinks them together. - Pulse with music:
1 + 0.25 * sound("Music", "bass"). - Follow footage:
track("Face").position + vec(0, -120)puts a caption above a head. - Jaw from a voice:
loudness("Voice")returns 0 to 1. - Read a component's input with
input("Mood"), and a state machine's current state withstate("Mood").
Run a script
- Open the Scripts panel.
- Choose New script, and write JavaScript. The file is the body of an async function.
acis the API,hereis the comp you are on, andreturnshows a value in Output. - Press the run button. A run is one undo step.
Every tool an agent uses is also an ac call. layer_create becomes await ac.layer.create({...}). Await every call, or the next line reads stale state.
const WORDS = ["Design", "in", "motion"];
const GAP = 140;
for (const [i, word] of WORDS.entries()) {
await ac.layer.create({
kind: "text",
text: word,
y: (i - (WORDS.length - 1) / 2) * GAP,
});
}Position from here.width and here.height so the script works in any comp.
A saved script re-runs in Replace mode by default. Each run removes what the last run created, then rebuilds. Choose Append to add on every run. Set values rather than increment them, because a re-run applies the code again.
Turn a layer into code
- Right-click a layer and choose Copy as code, or choose New script from selection.
- The result is the script that rebuilds those layers. Edit a colour, a timing, or loop the creation over data.
- Run it in Replace mode. The first run swaps the originals for the code's rebuild, in the same stack position.
Ask an agent
Agents write formulas with expression_set and list every function with expression_reference. They run code with script_run, save it with script_save, and read it back with script_read and script_list. script_reify prints layers, a comp or a state machine as code. Long runs go in the background and are watched with script_runs, script_logs and script_stop.
Reify the hero title as a script, then change its timing so each word enters 80 ms after the last.