wufe / react-particles-js

Particles.js for React
https://rpj.bembi.dev/
MIT License
1.15k stars 106 forks source link

Possible to change parameters without a full re-render? #58

Open ClayBenson94 opened 6 years ago

ClayBenson94 commented 6 years ago

I am using this library to create a dynamic background, and am trying to get it so the color of the particles shifts every few seconds. Currently it seems changing the parameters on the <Particles /> component causes a full re-render and causes the particles to appear to "jump".

I've created a sandbox demo that shows that here

Would it be reasonable to have certain parameters (like color) not cause a full re-render?

I've poked through the code a bit, but was curious if you had an opinion @Wufe.

wufe commented 6 years ago

Unfortunately it is not possible to change parameters without a full re-render.

A while ago I was thinking about implementing a more complex way of defining particles to be able to add, remove and change particles at runtime without causing a full reload.
This idea did require a lot of work, and I made an experimental branch and a little website showing this ( https://www.timeon.space/ ).
However this experimental branch is not usable: it was a draft.

If taken seriously, this idea would require tackling more challenges, like defining the entity "particle system" which should be capable of orchestrating single particles.

Trying to change the behavior of the library for certain parameters only, seems to me like exception-driven development.

Let me know what you think about it.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rainstormza commented 5 years ago

@Wufe Do you have particle config for this effect (https://www.timeon.space/)?

wufe commented 5 years ago

@rainstormza the website timeon.space is not powered by the current version of react-particles-js. It is an experimental branch you can find it here but it is not usable, it was just a prototype.