What Language Is Used for After Effects Expressions?
Adobe After Effects uses JavaScript as the foundation for writing expressions. Expressions are concise snippets of code that evaluate to a single value for a specific layer property at any given frame in your timeline. By leveraging JavaScript, motion designers and animators can automate repetitive tasks, link complex animations across multiple layers, and create procedural motion graphics without having to set manual keyframes for every single movement.
The Core Language: JavaScript and ECMAScript
Expressions in After Effects are built on ECMAScript, the standardized specification of JavaScript. In older releases of the software, expressions ran exclusively on Adobe's legacy ExtendScript engine, which was based on the outdated ECMAScript 3 standard (circa 1999).
Starting with After Effects CC 2019 (version 16.0), Adobe introduced the modern JavaScript Engine. This updated engine defaults to modern ECMAScript standards (ES6+), bringing modern programming paradigms to the timeline. With the modern engine enabled, users can write modern JavaScript syntax, including:
- Block-scoped variables (
letandconst) - Arrow functions (
() => {}) - Template literals (backticks for string interpolation:
`Value: ${val}`) - Destructuring assignments
- Standard JavaScript methods like
Array.map()andMathfunctions
Users can still switch back to the "Legacy ExtendScript" engine via the Project Settings dialog if legacy compatibility with older third-party templates is required, but the modern JavaScript engine is the current industry default and offers significantly faster evaluation speeds.
How Expressions Work Inside After Effects
Unlike full application scripts that manipulate the After Effects interface or render queues, expressions are applied directly to transformable property fields—such as Position, Scale, Rotation, Opacity, or effect controls.
Every time a frame renders, After Effects executes the code assigned to that property and expects the final line to return a value matching the property's expected data type:
- Single numbers (scalars): Used for properties like
Opacity, Rotation, or Slider Controls (e.g.,
50). - Arrays: Used for multi-dimensional properties like
2D Position (
[960, 540]) or 3D Position ([960, 540, 0]). - Color vectors: Represented as four-element arrays
corresponding to Red, Green, Blue, and Alpha mapped between 0 and 1
(e.g.,
[1, 0, 0, 1]for opaque red).
Built-In Application Methods and Objects
While the underlying syntax is standard JavaScript, Adobe injects custom objects, methods, and variables into the global scope to bridge the code with the timeline. Some of the most common native After Effects hooks include:
time: Returns the current composition playback time in seconds.value: Represents the pre-expression value of the property at the current time.index: Returns the layer's numerical stack index in the timeline.wiggle(frequency, amplitude): A built-in function that creates organic, randomized motion based on Perlin noise.- Layer Referencing: Allows properties to read values
from other layers (e.g.,
thisComp.layer("Controller").transform.position).
Expressions vs. Scripting
It is important to differentiate between expressions and scripts in After Effects, even though both rely on JavaScript:
- Expressions are attached directly to individual layer properties, execute dynamically on every frame calculation, and only return a value to modify that specific property.
- Scripts (
.jsxor.jsxbinfiles) run once on demand. They are used to automate global workflows, build custom floating UI panels, import assets, batch-rename layers, or trigger renders.