html5轻量级炫酷js粒子动画库插件怎么使用

JavaScript016

html5轻量级炫酷js粒子动画库插件怎么使用,第1张

方法调用该粒子插件:

particlesJS('particles-js', {

particles: {

color: '#fff',

shape: 'circle',

opacity: 1,

size: 4,

size_random: true,

nb: 150,

line_linked: {

enable_auto: true,

distance: 100,

color: '#fff',

opacity: 1,

width: 1,

condensed_mode: {

enable: false,

rotateX: 600,

最近做了一个PC站首页demo,为了让页面不至于太死板,在背景上给一些模块加入了这种粒子效果,

移动端demo: https://lavendergirl.github.io/particles/mobile-index.html

PC端demo: https://lavendergirl.github.io/particles/index.html

线上test: https://codepen.io/VincentGarreau/pen/pnlso

如果需要看源码实现可以在github上看看: https://github.com/lavenderGirl/particles

具体实现:

配置可参考: https://www.cnblogs.com/wangyihong/p/8618305.html

当然也可直接看 https://github.com/VincentGarreau/particles.js

通过不同的配置可以实现很多不一样的效果哦。动手去试试吧。

没做这个之前,都不知道这叫什么,只知道有时候会在一些网站上看到,也没太注意,真正想要用的时候,不知道去搜什么,所在在找的过程中也花了一点时间,如果你也需要这种效果,那么这篇文章适合你看看哦。

不是每一次努力都有收获,但是,每一次收获都必须努力。加油。