What Is an Expression?
An expression is a small piece of JavaScript attached to a property. It calculates the property's value on every frame. It saves keyframes and makes animation that repeats or reacts.
Add an Expression
- Select a property, for example Position
- Press Alt + click on its stopwatch (on Mac, Option + click)
- Type the expression in the text field in the Timeline
- Click outside the field to apply it
Three Starter Expressions
| Expression | What it does |
|---|---|
wiggle(2, 30) | Random shake: 2 times per second, up to 30 units |
time * 90 | Value grows 90 each second. On Rotation it spins |
loopOut() | Repeats the keyframes after the last one |
wiggle(freq, amp)on Position makes a shaking cameratime * 360on Rotation spins once per secondloopOut("cycle")repeats a bounce forever,loopOut("pingpong")plays back and forth
Time-Based Values
frame 0 time 0.0 rotation 0.0 | frame 25 time 1.0 rotation 90.0 | frame 50 time 2.0 rotation 180.0 | frame 75 time 3.0 rotation 270.0 | frame 100 time 4.0 rotation 360.0 | [-21.9, 20.8, 15.8, -14.7, -0.3]
Rotation grows steadily with time. The shake values are random within the amplitude range, so the real wiggle differs, but the idea is the same.
Errors
A yellow warning or red bar shows that the expression has a problem. Click the warning to read the message. Typical causes are a missing bracket, a wrong property name or a missing quote.
Practice
- Add wiggle to Position of a layer
- Spin a layer with time * 180 on Rotation
- Animate a bounce with two keyframes and loopOut("pingpong")
- Break an expression on purpose and read the error
Conclusion
Expressions add automation. Start with wiggle, time and loopOut.

