When using v-gsap.timeline, you can control the execution order and timing of steps using specific modifiers:
Custom Ordering with .order-
By default, steps follow the HTML document order. To define a custom sequence, use .order-{index} on the child elements.
Parallel Animations with .withPrevious
To run an animation step at the same time as the preceding step, use the .withPrevious modifier.
Note: For a single element with multiple steps, .withPrevious refers to the previous animation step, not the previous element.
Multiple Steps on One Element
You can attach multiple animation steps to a single element by using unique modifier combinations (e.g., .add.step1.from and .add.step2.to).
Example: Custom Order and Parallelism
<section v-gsap.timeline>
<h1 v-gsap.add.order-0.from="{ x: -32 }">First</h1>
<h2 v-gsap.add.withPrevious.from="{ x: -32 }">Second (Parallel)</h2>
<h2 v-gsap.add.order-1.from="{ x: -32 }">Third (Delayed)</h2>
</section>
<section v-gsap.timeline>
<h1 v-gsap.add.order-0.from="{ x: -32 }">Hello World</h1> <!-- Order: 0 -->
<div>
<span v-gsap.add.order-3.from="{ scale: 0 }">They see me animating</span> <!-- Order: 3 -->
<span v-gsap.add.order-2.from="{ scale: 0 }">They see me animating</span> <!-- Order: 2 -->
</div>
<h2 v-gsap.add.order-1.from="{ x: -32 }">Still here</h2> <!-- Order: 1 -->
</section>