particles.js 介绍
particles.js ?是 一个 用于创建粒子 效果 的 JavaScript 库。?
用法
加载 particles.js 并配置粒子:
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 con fig loaded');
});
particles.json
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "circle",
" stroke ": {
"width": 0,
"color": "#000000"
},
" poly gon": {
"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,
"speed": 80,
"size_min": 0.1,
"line_linked": {
"enable": true,
" dis tance": 300,
"color": "#ffffff",
"opacity": 0.4,
"width": 2
},
"move": {
"enable": true,
"speed": 12,
"direction": "none",
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"in tera ctivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": false,
"mode": "re pulse "
},
"onclick": {
"enable": true,
"mode": "push"
},
"resize": true
},
"modes": {
"grab": {
" dis tance": 800,
"line_linked": {
"opacity": 1
}
},
"bubble": {
" dis tance": 800,
"size": 80,
"duration": 2,
"opacity": 0.8,
"speed": 3
},
"re pulse ": {
" dis tance": 400,
"duration": 0.4
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
}
网站地址 : https://vincentgarreau.com/particles.js/
GitHub: https://github.com/VincentGarreau/particles.js
网站描述: 用于创建粒子 效果 的JavaScript库
particles.js官方网站
官方网站: https://vincentgarreau.com/particles.js/
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。