There are several ways to install particles.js:
- Download the latest version
- Install with npm:
npm install particlesjs --save
- Use the CDN:
Include the minified JS in your HTML (right before the closing body tag).
Add a canvas element to your markup (it should be the last element)
Add a few styles to your css.
Initialize the plugin on the
||string||-||Required: The CSS selector of your canvas element|
||Optional: Maximum amount of particles|
||Optional: Amount of size variations|
||Optional: Movement speed of the particles|
||string or string||
||Optional: Color(s) of the particles and connecting lines|
||Optional: Distance in
||Optional: Array of objects containing breakpoints and options|
Example how to use the responsive option.
||Pauses/stops the particle animation|
||Continues the particle animation|
||Destroys the plugin|
Example how to use the public methods.
IE9+ and all modern browsers.
See various examples how you can use particles.js.
To compile the distribution files by yourself, make sure that you have node.js and gulp installed, then:
- Clone the repository:
- Change in the project directory:
- Install the dependencies:
- Run the gulp build task
gulp buildto regenerate the
You can also run
gulp build --watchto watch for file changes and automatically rebuild the files.
If you’re using particles.js in some interesting way or on a cool site, I’d be very grateful if you shoot me a link to it.
For any problems or questions don't hesitate to open an issue.
The source code for particles.js 1.x has been moved to the v1 branch.