In the Skill's Own Terms
An official GSAP skill for sequencing animations with gsap.timeline(). It covers creating a timeline and chaining tweens that append by default, then repositioning them with the position parameter — absolute seconds, relative "+=0.5"/"-=0.2" offsets, labels, and "<"/">" placement.
It documents timeline constructor options (paused, repeat, yoyo, onComplete/onStart/onUpdate, defaults), labelling with addLabel() and seeking with play()/tweenFromTo(), nesting child timelines in a master, and playback methods including restart, time, progress and kill. It ends with GSAP best practices and the traps to avoid, notably chaining with delay and putting ScrollTrigger on tweens inside a timeline.
What it produces
- A timeline object stored in a variable, the tl in every example, that chained tweens are added to and playback methods act on.
- A new Tween returned by tweenFromTo that animates the playhead between two labels while the timeline is paused, with no ease.
- A killed timeline: calling kill() removes the timeline and by default its children too.
How It Works
- 01Create a Timeline and Chain Tweens
Call gsap.timeline() and chain .to() calls. With no position supplied, each tween is appended after the previous one finishes, so order is the order you write it.
- 02Place Each Tween in Time
Placement is set by the third argument or a position property in vars: absolute seconds, relative offsets, label names, or < and > relative to the most recently added animation.
- 03Give the Timeline Shared Defaults
Defaults handed to the timeline constructor are merged into every child tween, so duration and ease are declared once for the whole sequence.
- 04Label Key Moments
addLabel() marks a named point in the timeline, and that label can then be used as a position target for later tweens instead of a raw number.
- 05Nest Timelines Inside a Master
A master timeline can take a child timeline as a unit and place it at a time, after which further tweens are added relative to it.
- 06Drive the Whole Sequence at Once
Once built, the timeline is played and paused as a single unit rather than tween by tween.