2

I am building an animated grid with react-spring. Elements are animated from previous to next position. Positions are calculated to fit elements depending on width and their margins.

The problem

There is a glitch when the animation enters that halts the animation for a fraction of a second when the page first loads. This can be seen clearly on the browser page (latest Chrome and Firefox). The glitch is bearly visible in the codesandbox, but also happens there.

The gif example animation provided makes the glitch more obvious. The behavior on browser can be reproduced by downloading the code sandbox and npm start.

Thoughts

I believe this has to do with the browser loading and some frames being dropped during that.

Questions

  • How to avoid frames being dropped due to browser load if that is the case?
  • Above all: how to avoid the glitch, and what possible workarounds can you see? (e.g: Loading animated elements after page completely loads)

Additional question: I also observe that the end part of the animation is kinda funky with a very low step, is this expected behavior? What would the ideal config look like to avoid that...?

GIF example animation

Yossi
  • 5,577
  • 7
  • 41
  • 76
MikeMajara
  • 922
  • 9
  • 23
  • Did you find a solution to your problem? I'm facing the same issue, as well as laggy/choppy animations on mobile devices (mobile browsing). – thexpand Mar 11 '22 at 16:48
  • @thexpand I did, I kept on experimenting back then, but I can't recall just now. Feel free to go through the sandbox that's linked and check out the repo I used https://github.com/mikemajara/react-spring-animated-grid – MikeMajara Apr 06 '22 at 17:16
  • I just ended up rewriting everything in `framer-motion`. Sadly, ditching `react-spring` was the best thing to do... – thexpand Apr 07 '22 at 19:05

0 Answers0