GithubHelp home page GithubHelp logo

lindelof / particles-bg-vue Goto Github PK

View Code? Open in Web Editor NEW
228.0 6.0 16.0 613 KB

A vue.js particles animation background component

Home Page: https://codesandbox.io/s/particles-bg-vue-bg145

License: MIT License

JavaScript 26.72% HTML 0.40% Vue 72.88%
vue-particles vue-particle vue-background vue-particle-background vuejs-particles particles particles-bg particle-bg vue-resume

particles-bg-vue's Introduction

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

npm install --save particles-bg-vue

Usage

Method 1: Import and use in the component

<particles-bg type="lines" :bg="true" />
...

import { ParticlesBg } from "particles-bg-vue";
export default {
  name: "App",
  components: {
    ParticlesBg
  }
};

Method 2: Use it globally

import VueParticlesBg from "particles-bg-vue";

Vue.use(VueParticlesBg);

....
<particles-bg type="random" :bg="true" />

Parameter Description

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

* 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.

"color"
"ball"
"lines"
"thick"
"circle"
"cobweb"
"polygon"
"square"
"tadpole"
"fountain"
"random"
"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

:canvas="canvasObject"
...

* bg - Set to html background

Is set the following properties

position: "absolute",
zIndex: -1,
top: 0,
left: 0

About Custom

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

  <particles-bg type="custom" :config="config" :bg="true"/>
  ...

  data: function() {
    return {
      config: {
        num: [4, 7],
        rps: 0.1,
        radius: [5, 40],
        life: [1.5, 3],
        v: [2, 3],
        tha: [-30, 30],
        body: icon,
        alpha: [0.6, 0],
        scale: [0.1, 0.4],
        position: "all",
        cross: "dead",
        random: 15
      }
    };
  }

Similar projects

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

License

https://opensource.org/licenses/MIT

particles-bg-vue's People

Contributors

lindelof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

particles-bg-vue's Issues

Add LICENSE file

It would be a good idea to add a LICENSE file with the appropriate license text. Package.json indicates MIT.

IE11 error

Hi there,

I've tried to implement this in my project and it works fine in Chrome but I just get "Syntax error" when I try to load the page in IE. Is this a known issue? Perhaps I need polyfills?

help or bug Nuxt

Hi

i have read you post on nuxt dev.to
so i have 2 thinks:

1 - when i put mode: "universal" i got an error:

cannot use import statement outside a module vue

but when i change it to spa it's work , i see also that appear in your post , but maybe you have omit to mention this change.

2 . when i tried to implement with vuetify that don't work:

<template>
  <v-app class="app">
    <particles-bg type="circle" :bg="true" /> 
    <nuxt/>
  </v-app>
</template>

here my print screen
Screenshot from 2020-05-06 14-35-49

but with div instead of v-app work


step to reproduce

yarn create nuxt-app NuxtParticles
cd NuxtParticles
yarn add particles-bg-vue

add file plugins/particles.ts
with this content

import Vue from "vue";
import VueParticlesBg from "particles-bg-vue";

Vue.use(VueParticlesBg);

edit the file nuxt.config.js

mode: 'spa'
plugins: ["@/plugins/particles"],

edit file layouts/default.vue as:

<template>
  <v-app class="app">
    <particles-bg type="circle" :bg="true" /> 
    <nuxt/>
  </v-app>
</template>

can you advise

Thank you

Destroy method

Hi there, how do you destroy the instance of the particle generator when you navigate out? Maybe by implementing something in beforeDestroy()?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.