A simple wrapper for integrating lottie-web into VueJs
npm install lottie-vuejs
bash
npm install --save lottie-vuejs
`
Install lottie-vuejs globally
`bash
Install globally (recommended)
npm install -g lottie-vuejs
`
Add to global scope
`js
import Vue from 'vue'
import LottieAnimation from "lottie-vuejs/src/LottieAnimation.vue"; // import lottie-vuejs
Vue.use(LottieAnimation); // add lottie-animation to your global scope
new Vue({
render: h => h(App)
}).$mount('#app')
`
OR
`html
`
Usage
Basic
`html
path="path/to/your/lottie-animation.json"
/>
`
Advanced
`html
path="path/to/your/lottie-animation.json"
:loop="false"
:autoPlay="true"
:loopDelayMin="2.5"
:loopDelayMax="5"
:speed="1"
:width="256"
:height="256"
@AnimControl="setAnimController"
/>
`
Configuration
* path:
The relative path to the animation object (starts in your public folder) e.g. animations/my-cool-animation.json or an absolute path e.g. http://www.mysite.com/animations/my-cool-animation.json.
* speed:
type: Number
required: false
default: 1
* width:
type: Number
required: false
default: -1 //defaults to 100%, Number is in pixels
* height:
type: Number
required: false
default: -1 //defaults to 100%, Number is in pixels
* loop:
type:Boolean
required: false
default: true
* autoPlay:
type:Boolean
required: false
default: true
* loopDelayMin:
type: Number
required: false
default: 0
* loopDelayMax:
type: Number
required: false
default: 0
* @AnimControl:
type: Event
required: false
Returns the lottie-web animation controller for custom event hookup & direct access to the lottie instance. Read the lottie-web usage section for more info
build
Running the build script results in 3 compiled files in the dist directory, one for each of the main, module, and unpkg` properties listed in your package.json file. With these files generated, you're ready to go!