Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lottiefiles/vue-lottie-player

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lottiefiles/vue-lottie-player

Lottie player wrapper for Vue.js by LottieFiles

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
increased by32.84%
Maintainers
3
Weekly downloads
 
Created
Source

LottiePlayer Vue Component

This is a Vue component for the Lottie Web Player. This library is a vue wrapper around the LottieFiles Lottie Web Player

screencast

In Javascript or TypeScript:
  1. Install package using npm or yarn.
npm install --save @lottiefiles/vue-lottie-player
  1. Import package in your code.
import LottieVuePlayer from "@lottiefiles/vue-lottie-player";
  1. Add the player as a plugin to Vue
Vue.use(LottieVuePlayer);

Example/Development

  1. Clone repo

  2. run yarn install

Usage

Player component

Add the element lottie-vue-player and set the src prop to a URL pointing to a valid Lottie JSON. Full example of an App.vue file is shown below.

<template>
    <div id="app">
        <lottie-vue-player :src="`https://assets10.lottiefiles.com/packages/lf20_tzjfwgud.json`"
                           :theme="options.theme"
                           :player-size="options.playerSize"
                           :player-controls="true"
                           style="width: 100%; height:400px">
        </lottie-vue-player>
    </div>
</template>

<script>

    export default {
        name: 'App',
        data() {
            return {
                options: {
                    minimizable: false,
                    playerSize: "standard",
                    backgroundColor: '#fff',
                    backgroundStyle: 'color',
                    theme: {
                        controlsView: "standard",
                        active: "light",
                        light: {
                            color: '#3D4852',
                            backgroundColor: '#fff',
                            opacity: '0.7',
                        },
                        dark: {
                            color: '#fff',
                            backgroundColor: '#202020',
                            opacity: '0.7',
                        }
                    }
                }
            }
        }
    }
</script>

Props

PropDescriptionTypeDefault
autoplayAutoplay animation on load.booleanfalse
backgroundColorBackground color.stringundefined
playerControlsShow controls.booleanfalse
showColorPickerShow color pickerbooleanfalse
playerSizePlayer set size (hide, minimal, standard)stringstandard
loopWhether to loop animation.booleanfalse
speedAnimation speed.number1
styleThe style for the container.objectundefined
src (required)Bodymovin JSON data or URL to JSON.objectstring

Methods

togglePlayPause() => void

Toggle animation play pause.

Returns

Type: void

toggleFullscreen() => void

Toggle full screen player.

Returns

Type: void

toggleLoop() => void

Toggle animation loop.

Returns

Type: void

setPlayerSpeed(speed?: number) => void

Sets animation play speed.

Parameters
NameTypeDescription
valuenumberPlayback speed.
Returns

Type: void

stop() => void

Stops animation play.

Returns

Type: void

setBackgroundColor(color: string) => void

set background color.

Returns

Type: void

License

MIT License © LottieFiles.com

Keywords

FAQs

Package last updated on 28 May 2021

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