Particles.js: Redirecting to new page gradually decreases the fps

Created on 16 May 2020  路  2Comments  路  Source: VincentGarreau/particles.js

So basically when I go to another page, for example from "/help" -> "/messages" the frames drop.
https://gyazo.com/96eb10a3a75e878354659314ef7bfbcd

But as soon as I either refresh the page or even resizes the browser window the frames go up again.
https://gyazo.com/6da0a3223f0d8e7c895cbb5d2157d788

So the code. I tried different types of code implementations, using the files itself. Using the Ruby On Rails gem. But the only thing that works for me is to upload the files to a server, and then using the script element to src the files down again. Here is the code:

CSS
#particles-js { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }

HTML
<div id="particles-js"></div>

JS
https://gyazo.com/dc92ca9966e169542038584ec14d267c

If you need more info, just tell me

I just noticed that the problem does not appear on mobile devices

Most helpful comment

Yooo, thanks for the answer. That solved my issue!

All 2 comments

That's because particlesJS creates a new instance every load and never dispose the old one. I suggest you to have a look here since this project is abandoned, this library shouldn't be affected by this issue, you can keep the same config.

Yooo, thanks for the answer. That solved my issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cosmokrust picture cosmokrust  路  5Comments

XRyu picture XRyu  路  6Comments

errogaht picture errogaht  路  7Comments

hugo-pcq picture hugo-pcq  路  4Comments

tbryan2 picture tbryan2  路  5Comments