Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 432
Mila A Avatar asked Sep 12 '25 21:09

Mila A


1 Answers

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.

like image 86
Cadin Avatar answered Sep 15 '25 12:09

Cadin