0.3.3 • Published 5 years ago

vue-hopsa v0.3.3

Weekly downloads
57
License
-
Repository
github
Last release
5 years ago

Hopsa

SVG Clipping transitions for vue components

npm (scoped with tag) npm Dependencies js-standard-style

Usage

npm.io

<template>
    <div>
        <!-- Wrap your component with Hopsa -->
        <hopsa :animation="'circle'" :options="options">
            <template v-slot:content>
            
            <!-- CONTENT HERE -->
            <my-awesome-component></my-awesome-component>

            </template>
        </hopsa>
    </div>
</template>
import Hopsa from 'vue-hopsa' 
import MyAwesomeComponent from 'my/aweseome/path'

// Install plugin 
Vue.use(Hopsa)

export default {
  data: () => ({
      options: {
        duration: 1000,
        radius: 2000,
        delay: 1000,
        onComplete: () => {},
        
      }
  }),
  components: {
    MyAwesomeComponent
  }
  ...
}

Animations

  • Circle
  • Box
  • Batman
  • Bars

Options

NameDefaultText
duration1000Time of animation in ms
delay0Delay of animation in ms
easingbackOutEasing function for animation
autostarttrueStart enter transition on mount
removeSVGOnCompletefalseRemove svg overlay, for making content active
minWidth200Min width for overlay
minHeight200Min height for overlay

Custom animations

Animation can easily be created by extending BaseAnimation class for use with hopsa component.

Hopsa uses svg.js

You can add svg elements to this.hopsa.clip

class MyAwesomeAnimation extends BaseAnimation {
  init() {
    
    this.circle = this.hopsaInstance.draw.circle(0).move(this.hopsaInstance.contentWidth / 2.5, this.hopsaInstance.contentHeight / 2).fill("#fff");
    this.hopsa.clip.add(this.circle);

  }

}



}
0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.2.1

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago