framer / motion

Open source, production-ready animation and gesture library for React
https://framer.com/motion
MIT License
22.56k stars 748 forks source link

[FEATURE] Add `skipAnimations` to `transition` #2671

Open ccapndave opened 1 month ago

ccapndave commented 1 month ago

Is your feature request related to a problem? Please describe. Hey! Our application has some very intricate animations; some are handled by the router and implement transitions between pages, and others are motion.div within various components. Unfortunately these sometimes fight against each other and a solution would be to disable animations for certain parts of the React tree during transitions. We can't use MotionGlobalConfig.skipAnimations because we need some animations to run.

Describe the solution you'd like I'd like to add skipAnimations as an option to transition. That means that I could put <MotionConfig transition={{ skipAnimations: isTransitionRunning }}> around the bits of the tree that shouldn't animate during a transition.

Describe alternatives you've considered

Additional context I've had a look at the code and although I haven't tried yet, from a first view I think this wouldn't be too hard to implement. I am going to have a fiddle and see if there are any hidden complications.