1.0.1 • Published 5 years ago

vue-particle-effect-block v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Vue-particle-effect-block

Bursting particle effect blocks for Vue.

vue-particle-effect-button - Original source this library is based on.

Install

NPM

npm install --save vue-particle-effect-block

Mount

mount with global

import Vue from 'vue'
import ParticleEffectBlock from 'vue-particle-effect-block'

Vue.use(ParticleEffectBlock)

mount with component

import ParticleEffectBlock from 'vue-particle-effect-block'

export default {
  components: {
    ParticleEffectBlock
  }
}

Usage

<ParticleEffectBlock :hidden="isHidden">
  BLOCK CONTENT GOES HERE
</ParticleEffectBlock>

export default {
  data() {
    return {
      isHidden: false
    }
  }
}

You change the hidden boolean prop to kick-off an animation, typically as a result of a click on the block's contents. If hidden changes to true, the block will perform a disintegrating animation. If hidden changes to false, it will reverse and reintegrate the original content.

Props

PropertyTypeDefaultDescription
hiddenbooleanfalseWhether block should be hidden or visible. Changing this prop starts an animation.
animationOffstring'''show' or 'hide' or 'both'
colorstring'#000'Particle color. Should match the block content's background color
durationnumber1000Animation duration in milliseconds.
easingstring, array'easeInOutCubic'Animation easing.
typestringcircle'circle' or 'rectangle' or 'triangle'
drawStylestringfill'fill' or 'stroke'
directionstring'left''left' or 'right' or 'top' or 'bottom'
canvasPaddingnumber150Amount of extra padding to add to the canvas since the animation will overflow the content's bounds
sizenumberfuncrandom(4)Particle size. May be a static number or a function which returns numbers.
speednumberfuncrandom(4)Particle speed. May be a static number or a function which returns numbers.
particlesAmountCoefficientnumber3Increases or decreases the relative number of particles
oscillationCoefficientnumber20Increases or decreases the relative curvature of particles

Event

NameDescriptionParameters
begintriggers when the animation starts-
completetriggers when the animation complete-

Slot

NameDescription
-Default Slot