转:
![](https://upload-images.jianshu.io/upload_images/7784541-b96350c5ca69a97e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp)
image.png
图上那些类似于星座图的点和线,是由vue-particles生成的,不仅自己动,而且能与用户鼠标事件产生互动。
一直中意这种动态插件,今天有时间,迫不及待试了一波~
大写的NICE~
使用教程:
npm install vue-particles --save-dev
main.js里加入以下代码:
import VueParticles from 'vue-particles' Vue.use(VueParticles)
App.vue 文件——一个完整的例子:
/*如果想做背景图片 可以给标签一个class 直接添加背景图*/
属性:
color: String类型。
默认'#dedede'。粒子颜色。particleOpacity: Number类型。
默认0.7。粒子透明度。particlesNumber: Number类型。
默认80。粒子数量。shapeType: String类型。
默认'circle'。可用的粒子外观类型有:"circle","edge","triangle", "polygon","star"。particleSize: Number类型。
默认80。单个粒子大小。linesColor: String类型。
默认'#dedede'。线条颜色。linesWidth: Number类型。
默认1。线条宽度。lineLinked: 布尔类型。
默认true。连接线是否可用。lineOpacity: Number类型。
默认0.4。线条透明度。linesDistance: Number类型。
默认150。线条距离。moveSpeed: Number类型。
默认3。粒子运动速度。hoverEffect: 布尔类型。
默认true。是否有hover特效。hoverMode: String类型。
默认true。可用的hover模式有: "grab", "repulse", "bubble"。clickEffect: 布尔类型。
默认true。是否有click特效。clickMode: String类型。
默认true。可用的click模式有: "push", "remove", "repulse", "bubble"。
![](https://upload-images.jianshu.io/upload_images/7784541-890304cfbf275ad5.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1000/format/webp)
f31672037f1ab97c608393d5575e1.jpg
github下载:
文章参考: