Socket
Socket
Sign inDemoInstall

vue3-lottie

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-lottie

[![npm](https://img.shields.io/npm/v/vue3-lottie)](https://www.npmjs.com/package/vue3-lottie) [![Downloads](https://img.shields.io/npm/dt/vue3-lottie)](https://www.npmjs.com/package/vue3-lottie) [![Stars](https://img.shields.io/github/stars/megasanjay/vue


Version published
Weekly downloads
54K
increased by7.33%
Maintainers
1
Weekly downloads
 
Created
Source

Vue 3 Lottie

npm Downloads Stars License GitHub issues

After finding a suprising lack of Vue 3 components for Lottie animations, I decided to create my own.

Demos

View the live demos here: https://vue3-lottie.vercel.app

Installation

If you are using npm:

npm install vue3-lottie

If you are using yarn:

yarn add vue3-lottie

Usage

The most common use case is to register the component globally.

// main.js
import { createApp } from 'vue'
import Vue3Lottie from 'vue3-lottie'

createApp(App).use(Vue3Lottie).mount('#app')

Alternatively you can also import the component locally.

import Vue3Lottie from 'vue3-lottie'

export default {
  components: {
    Vue3Lottie,
  },
}

You can then use the component in your template

<template>
  <Vue3Lottie :animationData="DogJSON" :height="200" :width="200" />
</template>

<script>
import Vue3Lottie from 'vue3-lottie'
import DogJSON from './lotties/dog.json'

export default {
  components: {
    Vue3Lottie,
  },
  data() {
    return {
      DogJSON,
    }
  },
}
</script>

Props and options

PropTypeDefault ValueDescription
animationDataObject (Required)noneThe lottie animation data
autoPlayBooleantrueStart animation on component load
rendererSettingsObject{}Options for if you want to use an existing canvas to draw (can be ignored on most cases)
loopNumber or BooleantrueThe number of instances that the lottie animation should run (true is infinite)
widthNumber or String"100%"Width of the lottie animation container (Numbers correspond to pixel values)
heightNumber or String"100%"Height of the lottie animation container (Numbers correspond to pixel values)
backgroundColorStringtransparentBackground color of the container
pauseOnHoverBooleanfalseWhether to pause the animation on hover
pauseOnClickBooleanfalseWhether to play the animation when you hover
pauseAnimationBooleanfalseProp to pass reactive variables so that you can control animation pause and play

Events

  • onComplete
    • If your animation has a finite amount of loops you can use this event to know when the animation has completed.
  • onLoopComplete
    • If your animation has a finite amount of loops you can use this event to know when the animation has completed a loop.
  • onEnterFrame
    • This event is fired every frame of the animation. There will be 60 events fired per second if your lottie animation runs at 60fps.
  • onSegmentStart
    • This event is fired when the animation enters a segment.

forthebadge forthebadge

Keywords

FAQs

Package last updated on 18 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc