motion icon indicating copy to clipboard operation
motion copied to clipboard

[BUG] Lag wehen using transitions in the mobile browser

Open rezadev8 opened this issue 1 year ago • 9 comments

When I use transitions, there is no issue in my desktop browser.

However, it lags in the mobile browser.

But, adding the transition to the project's CSS file resolves the problem

What should i do?

Laggy code

<motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.3 }} </motion.div>

Solve the problem

<motion.div initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0 }} className="my-div" </motion.div>

CSS .my-div{ transition: all 0.3s; }

Using nextjs 13

rezadev8 avatar Jul 16 '23 15:07 rezadev8

I am running into the same issue. Thank you for sharing your solution as a temporary fix.

agordondesign avatar Aug 03 '23 20:08 agordondesign

Any update on this? I have the same problem and I would like to avoid workarounds

francestu96 avatar Jan 25 '24 16:01 francestu96

Any update on this? I have the same problem and I would like to avoid workarounds

In my project, I reduced the size of the images and minimized the use of transitions with Framer, resolving the issue with CSS.

rezadev8 avatar Apr 11 '24 13:04 rezadev8

MAN U ARE GOD

Barbagidon avatar Apr 23 '24 11:04 Barbagidon

generally this happens because of the power saving mode on iphone, if you turn it off the animations will work fine

Barbagidon avatar Apr 23 '24 11:04 Barbagidon

generally this happens because of the power saving mode on iphone, if you turn it off the animations will work fine

I use an android phone, and I've seen this lag on several phones. Although this solution might work well on iphones.

rezadev8 avatar Apr 27 '24 15:04 rezadev8

The workarround is not working for me while using in combination with the times parameter or animation with useAnimation() hook. Please fix!

phamquocduy avatar Jul 11 '24 18:07 phamquocduy

generally this happens because of the power saving mode on iphone, if you turn it off the animations will work fine

This is just crazy. But it's true. 🤯🤯🤯

damyvegaleiva avatar Sep 17 '24 08:09 damyvegaleiva

Yeah there's a 30fps throttling on rAF when using power saving mode. The CSS "fix" is obviously discouraged as there's no real reason to use Motion. But what you can do instead to preserve springs etc is use transform: "translateY(10px)" to translateY(0px) which will run the animation via WAAPI.

mattgperry avatar Sep 19 '24 08:09 mattgperry