wufe / react-particles-js

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

Added maximum numbers of pushable particles #86

Closed ankri closed 5 years ago

ankri commented 5 years ago

Hi,

we have a react-particles-js component onto which the user can add particles by clicking. We wanted to have a maximum number of particles the user is able to add. Mostly so that the user cannot crash their browser 😁

This PR adds a new parameter max to particles.number.

For example:

particles: {
  number: {
    value: 40,
    max: 50
  }
}

will limit the number of pushable particles to 50.

You can add the max value to a value <= 0 to have unlimited particles. The default is -1 (unlimited)

You can test it out here: Demo Sandbox: https://codesandbox.io/s/v05zx2r8r7

Feedback appreciated 👍

Take care and keep on rocking!

wufe commented 5 years ago

Thanks for your PR. It has been merged and it's available in v2.6.0