Web Player API - Groups

A Spirit group is a collection of GSAP timelines that together form a new "main" timeline instance. Because elements can be part of multiple groups you'll need to construct the timeline once before using it.

A single web page can have multiple animation groups, each with its own controllable timeline.

See Registry for usage.

Example

Play all animations on the web page at once:

import spirit from 'spiritjs'

(async => {

  // load GSAP
  await spirit.setup()

  // load animations
  const groups = await spirit.load('groups.json')

  // construct all groups at once
  groups.construct()

  // play all animations just once
  groups.each(
    group => group.play()
  )

})()

results matching ""

    No results matching ""