'Why do some images cause requestAnimationFrame() to lag/drop framerate?
Basically the title. I was creating a smoothly scrollable gallery with a bunch of images but I noticed a ton of lag.
I was getting massive framerate drops/lag with requestAnimationFrame(). I spent hours debugging my code thinking I was infinitely adding something etc.
But then I removed a specific image, and load and behold the image was the cause of the lag. None of the other images made requestAnimationFrame() lag. I replaced the laggy image with a different image and everything works properly with no lag.
This is where I got the laggy image -> https://unsplash.com/photos/sTPy-oeA3h0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|