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