React Framer Motion how to stop and play animation

Please help me making out how can I stop and play framer motion animation. Or any other lib like GSAP or Lottie which can be used with ReactJS. The thing is that I need to add animated elements over a video. And the video can be stopped/played like any other video. And the animations also need to be stopped/played. I can’t use FFmpeg as I only need to mock these, not produce an actual animated video. Thanks!

Answer

In Framer Motion you can use Animation Controls to stop and start animations.

From the docs:

The useAnimation hook can be used to create a set of imperative
AnimationControls with a start and stop method. These controls can be
passed to one or more motion components via the animate prop.