Update README.md
Demo / Generator
Configure, export, and share your particles.js configuration on CodePen: http://vincentgarreau.com/particles.js/
CodePen demo: http://codepen.io/VincentGarreau/pen/pnlso
Usage
Load particles.js and configure the particles:
index.html
<div id="particles-js"></div> <script src="particles.js"></script>
app.js
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ particlesJS.load('particles-js', 'assets/particles.json', function() { console.log('callback - particles.js config loaded'); });
particles.json
{ "particles": { "number": { "value": 80, "density": { "enable": true, "value_area": 800 } }, "color": { "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, "color": "#000000" }, "polygon": { "nb_sides": 5 }, "image": { "src": "img/github.svg", "width": 100, "height": 100 } }, "opacity": { "value": 0.5, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 10, "random": true, "anim": { "enable": false, "speed": 80, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 300, "color": "#ffffff", "opacity": 0.4, "width": 2 }, "move": { "enable": true, "speed": 12, "direction": "none", "random": false, "straight": false, "out_mode": "out", "bounce": false, "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": false, "mode": "repulse" }, "onclick": { "enable": true, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 800, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 800, "size": 80, "duration": 2, "opacity": 0.8, "speed": 3 }, "repulse": { "distance": 400, "duration": 0.4 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true }
Options
particles.number.value
40
particles.number.density.enable
true
false
particles.number.density.value_area
800
particles.color.value
"#b61924"
{r:182, g:25, b:36}
{h:356, s:76, l:41}
["#b61924", "#333333", "999999"]
"random"
particles.shape.type
"circle"
"edge"
"triangle"
"polygon"
"star"
"image"
["circle", "triangle", "image"]
particles.shape.stroke.width
2
particles.shape.stroke.color
"#222222"
particles.shape.polygon.nb_slides
5
particles.shape.image.src
"assets/img/yop.svg"
"http://mywebsite.com/assets/img/yop.png"
particles.shape.image.width
100
particles.shape.image.height
particles.opacity.value
0.75
particles.opacity.random
particles.opacity.anim.enable
particles.opacity.anim.speed
3
particles.opacity.anim.opacity_min
0.25
particles.opacity.anim.sync
particles.size.value
20
particles.size.random
particles.size.anim.enable
particles.size.anim.speed
particles.size.anim.size_min
particles.size.anim.sync
particles.line_linked.enable
particles.line_linked.distance
150
particles.line_linked.color
#ffffff
particles.line_linked.opacity
0.5
particles.line_linked.width
1.5
particles.move.enable
particles.move.speed
4
particles.move.direction
"none"
"top"
"top-right"
"right"
"bottom-right"
"bottom"
"bottom-left"
"left"
"top-left"
particles.move.random
particles.move.straight
particles.move.out_mode
"out"
"bounce"
particles.move.bounce
particles.move.attract.enable
particles.move.attract.rotateX
3000
particles.move.attract.rotateY
1500
interactivity.detect_on
"canvas", "window"
interactivity.events.onhover.enable
interactivity.events.onhover.mode
"grab"
"bubble"
"repulse"
["grab", "bubble"]
interactivity.events.onclick.enable
interactivity.events.onclick.mode
"push"
"remove"
["push", "repulse"]
interactivity.events.resize
interactivity.events.modes.grab.distance
interactivity.events.modes.grab.line_linked.opacity
interactivity.events.modes.bubble.distance
interactivity.events.modes.bubble.size
interactivity.events.modes.bubble.duration
0.4
interactivity.events.modes.repulse.distance
200
interactivity.events.modes.repulse.duration
1.2
interactivity.events.modes.push.particles_nb
retina_detect
Packages install
https://www.npmjs.com/package/particles.js
npm install particles.js
bower install particles.js --save
gem 'rails-assets-particles.js'
https://atmospherejs.com/newswim/particles
meteor add newswim:particles
Hosting / CDN
Please use this host or your own to load particles.js on your projects
http://www.jsdelivr.com/#!particles.js
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
particles.js
A lightweight JavaScript library for creating particles.
Demo / GeneratorConfigure, export, and share your particles.js configuration on CodePen:
http://vincentgarreau.com/particles.js/
CodePen demo:
http://codepen.io/VincentGarreau/pen/pnlso
UsageLoad particles.js and configure the particles:
index.html
app.js
particles.json
Optionsparticles.number.value40particles.number.density.enabletrue/falseparticles.number.density.value_area800particles.color.valueRGB (object)
HSL (object)
array selection (HEX)
random (string)
"#b61924"{r:182, g:25, b:36}{h:356, s:76, l:41}["#b61924", "#333333", "999999"]"random"particles.shape.typearray selection
"circle""edge""triangle""polygon""star""image"["circle", "triangle", "image"]particles.shape.stroke.width2particles.shape.stroke.color"#222222"particles.shape.polygon.nb_slides5particles.shape.image.srcsvg / png / gif / jpg
"assets/img/yop.svg""http://mywebsite.com/assets/img/yop.png"particles.shape.image.width(for aspect ratio)
100particles.shape.image.height(for aspect ratio)
100particles.opacity.value0.75particles.opacity.randomtrue/falseparticles.opacity.anim.enabletrue/falseparticles.opacity.anim.speed3particles.opacity.anim.opacity_min0.25particles.opacity.anim.synctrue/falseparticles.size.value20particles.size.randomtrue/falseparticles.size.anim.enabletrue/falseparticles.size.anim.speed3particles.size.anim.size_min0.25particles.size.anim.synctrue/falseparticles.line_linked.enabletrue/falseparticles.line_linked.distance150particles.line_linked.color#ffffffparticles.line_linked.opacity0.5particles.line_linked.width1.5particles.move.enabletrue/falseparticles.move.speed4particles.move.direction"none""top""top-right""right""bottom-right""bottom""bottom-left""left""top-left"particles.move.randomtrue/falseparticles.move.straighttrue/falseparticles.move.out_mode(out of canvas)
"out""bounce"particles.move.bounce(between particles)
true/falseparticles.move.attract.enabletrue/falseparticles.move.attract.rotateX3000particles.move.attract.rotateY1500interactivity.detect_on"canvas", "window"interactivity.events.onhover.enabletrue/falseinteractivity.events.onhover.modearray selection
"grab""bubble""repulse"["grab", "bubble"]interactivity.events.onclick.enabletrue/falseinteractivity.events.onclick.modearray selection
"push""remove""bubble""repulse"["push", "repulse"]interactivity.events.resizetrue/falseinteractivity.events.modes.grab.distance100interactivity.events.modes.grab.line_linked.opacity0.75interactivity.events.modes.bubble.distance100interactivity.events.modes.bubble.size40interactivity.events.modes.bubble.duration(second)
0.4interactivity.events.modes.repulse.distance200interactivity.events.modes.repulse.duration(second)
1.2interactivity.events.modes.push.particles_nb4interactivity.events.modes.push.particles_nb4retina_detecttrue/falsePackages installnpm
https://www.npmjs.com/package/particles.js
Bower
Rails Assets
Meteor
https://atmospherejs.com/newswim/particles
Hosting / CDNPlease use this host or your own to load particles.js on your projects
http://www.jsdelivr.com/#!particles.js