Timelines
Timelines allow you to create a sequence of animations and have precise control over their timing.
How it works
You can sequence animations using af-timeline
attribute. It has a very simple syntax — first, you specify the name of the timeline, then the position of the current animation in the timeline. You can omit order, then all animations in that timelines will be put at the same position. To specify the position, you can use any of the position parameters that GSAP supports, like 0%
, 0.5
, <1
, etc — check out the GSAP docs | Position Parameter for more info.
Or, if you want to assign multiple animations to the same timeline:
In this case, first animations will be put at the very beginning of the timeline, and second animation will start 0.5 seconds after the first one ends.
Timeline options
You can also specify timeline options that will be applied to the timeline itself. Because af-options
is related to animation, you should specify it inside af-timeline
attribute itself: