Setup
Include GSAP and create a paused timeline:index.html
The key you use in
window.__timelines must match the data-composition-id attribute on your composition’s root element. See Compositions for how the root element is structured.Key Rules
- Always create timelines with
{ paused: true }— the framework controls playback via deterministic seeking - Register timelines on
window.__timelineswith thedata-composition-idas key - Use the position parameter (3rd argument) for absolute timing:
tl.to(el, vars, 1.5) - Only animate visual properties — never control media playback in scripts
Supported Methods
| Method | Description |
|---|---|
tl.to(target, vars, position) | Animate to values |
tl.from(target, vars, position) | Animate from values |
tl.fromTo(target, fromVars, toVars, position) | Animate from/to values |
tl.set(target, vars, position) | Set values instantly |
Supported Properties
opacity, x, y, scale, scaleX, scaleY, rotation, width, height, visibility, color, backgroundColor, and any CSS-animatable property.
Timeline Duration and Composition Duration
A composition’s duration equals its GSAP timeline duration. The two are directly linked:compositions/intro-anim.html
index.html
What NOT to Do
These patterns will break your composition or cause sync issues:index.html
Sub-Composition Timelines
Each nested composition registers its own timeline. The framework automatically nests sub-composition timelines into the parent based ondata-start:
compositions/intro-anim.html
Next Steps
Compositions
Understand the building blocks that timelines animate
Frame Adapters
Learn how GSAP plugs into the render pipeline
Common Mistakes
Avoid pitfalls that break animations
HTML Schema Reference
Full reference for composition attributes