How do I use Lottie's onSegmentStart event handler?

Viewed 51

In Lottie, what does the onSegmentStart event handler do? I can't find any documentation on it or how to use it. I would like to find a way to change setSpeed once a certain segment has been reached in the animation.

1 Answers

You should be able to do something like this

const animation = lottie.loadAnimation({
  container: '#container',
  renderer: 'svg',
  loop: true,
  autoplay: true,
  ...
})

animation.onSegmentStart = function() {
  //change your setSpeed here
}

Related