项目作者: lindelof

项目描述 :
A vue.js particles animation background component
高级语言: Vue
项目地址: git://github.com/lindelof/particles-bg-vue.git
创建时间: 2019-11-28T12:33:14Z
项目社区:https://github.com/lindelof/particles-bg-vue

开源协议:MIT License

下载




particles-bg-vue

NPM JavaScript Style Guide

A vue.js particles animation background component. Use it to make your website look cool.

Check it out if you want to use it in React https://github.com/lindelof/particles-bg

Specify

This project refers to the source code of the Proton official website, and proton’s online demo. I packaged it into a vue.js component. Thanks to the great author.

Online demo

Install

  1. npm install --save particles-bg-vue

Usage

Method 1: Import and use in the component

  1. <particles-bg type="lines" :bg="true" ></particles-bg>
  2. ...
  3. import { ParticlesBg } from "particles-bg-vue";
  4. export default {
  5. name: "App",
  6. components: {
  7. ParticlesBg
  8. }
  9. };

Method 2: Use it globally

  1. import VueParticlesBg from "particles-bg-vue";
  2. Vue.use(VueParticlesBg);
  3. ....
  4. <particles-bg type="random" :bg="true" ></particles-bg>

Parameter Description

  1. <particles-bg color="#ff0000" num=200 type="circle" :bg={true} ></particles-bg>

* type - Is the type of particle animation

Is the type of particle animation, random is a random selection. You are also free to customize use custom.

  1. "color"
  2. "ball"
  3. "lines"
  4. "thick"
  5. "circle"
  6. "cobweb"
  7. "polygon"
  8. "square"
  9. "tadpole"
  10. "fountain"
  11. "random"
  12. "custom"

* num - The number of particles emitted each time, generally not set

* color - The background color or particle color of the particle scene

Notice: which should be an array under type=color

* canvas - canvas dom style

  1. :canvas="canvasObject"
  2. ...

* bg - Set to html background

Is set the following properties

  1. position: "absolute",
  2. zIndex: -1,
  3. top: 0,
  4. left: 0

About Custom

You can use type=”custom” to achieve a higher degree of freedom for the particle background.

  1. <particles-bg type="custom" :config="config" :bg="true"></particles-bg>
  2. ...
  3. data: function() {
  4. return {
  5. config: {
  6. num: [4, 7],
  7. rps: 0.1,
  8. radius: [5, 40],
  9. life: [1.5, 3],
  10. v: [2, 3],
  11. tha: [-30, 30],
  12. body: icon,
  13. alpha: [0.6, 0],
  14. scale: [0.1, 0.4],
  15. position: "all",
  16. cross: "dead",
  17. random: 15
  18. }
  19. };
  20. }

Similar projects

Maybe you will like these two projects, they will also make your page flourish

License

https://opensource.org/licenses/MIT