canvas动画合集Vue组件
<p align="center">javascript
[? online demo](https://chenxuan0000.github.io/vue-canvas-effect/index.html)
</p>css
ie9+git
npm install vue-canvas-effect --save
推荐
首先安装babel-plugin-import依赖
npm install babel-plugin-import --save-dev
而后修改 .babelrc文件
// .babelrc { "plugins": [["import", { "libraryName": "vue-canvas-effect", "libraryDirectory": "src/components" }]] }
而后,若是你须要neon组件,编辑main.js
import Vue from 'vue' import {neon} from 'vue-canvas-effect'; Vue.component(neon.name, neon); `or` Vue.component('customName', neon); new Vue({ el: '#app', render: h => h(App) })
不推荐
import Vue from 'vue' import vueCanvas from 'vue-canvas-effect'; Vue.use(vueCanvas) new Vue({ el: '#app', render: h => h(App) })
script 标签
<html> <head> ... </head> <body> <div id="app"> <neon-effect></neon-effect> </div> <script src="https://cdn.bootcss.com/vue/2.5.9/vue.js"></script> <script src="../dist/neon.min.js"></script> <script> new Vue({ el: '#app' }) </script> </body> </html>
name: neonEffect
// 默认标签名 <neon-effect :options="options"></neon-effect>
//default options { len: 20, //五边形的单边长度 count: 50, //多少线重叠 rate: 20, //速度 越小越快 dieChance: 0.05, //单次绘画失败进行重绘的概率 sparkChance: 0.1, //[0,1] 越大画出的五边形越多重 sparkDist: 10, //闪烁点的距离 sparkSize: 2,//闪烁点的大小 contentLight: 60, // [0,100] 色块的亮度 shadowToTimePropMult: 6, //五边形的内环阴影大小 bgColorArr: [0, 0, 0] //背景色数组 }
name: bubblesEffect
// 默认标签名 <bubbles-effect :options="options"></bubbles-effect>
//default options { color: 'rgba(225,225,225,0.5)', //气泡颜色 radius: 15, //气泡半径 densety: 0.3, // 气泡密度 越大越密集(建议不要大于1) clearOffset: 0.2 // 气泡消失距离[0-1] 越大越晚消失 }
See the GitHub 查看历史版本.github
欢迎给出一些意见和优化,期待你的 Pull Request
。npm
circleMagiccanvas