New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lottiefiles/lottie-player

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lottiefiles/lottie-player

Lottie animation player web component.

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
105K
increased by5.64%
Maintainers
2
Weekly downloads
 
Created
Source

lottie-player Web Component

This is a Web Component for easily embedding Lottie animations in websites.

Published on npm Published on webcomponents.org

Installation

  • In HTML:

Import element from a CDN.

<script src="https://unpkg.com/@lottiefiles/lottie-player@0.0.4/dist/lottie-player.js"></script>
  • In Javascript or TypeScript:

Install package using npm or yarn.

npm install --save @lottiefiles/lottie-player

Import package in your code.

import '@lottiefiles/lottie-player/lottie-player.js';

Usage

<lottie-player
    autoplay
    controls
    loop
    mode="normal"
    src="https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json"
    style="width: 320px"
>
</lottie-player>

Examples

Properties

PropertyAttributeDescriptionTypeDefault
autoplayautoplayAutoplay animation on load.booleanfalse
backgroundbackgroundBackground color.stringundefined
controlscontrolsShow controls.booleanfalse
countcountNumber of times to loop animation.numberundefined
directiondirectionDirection of animation.number1
hoverhoverWhether to play on mouse hover.booleanfalse
looploopWhether to loop animation.booleanfalse
modemodePlay mode.PlayMode.Bounce | PlayMode.NormalPlayMode.Normal
rendererrendererRenderer to use."svg"'svg'
speedspeedAnimation speed.number1
src (required)srcBodymovin JSON data or URL to JSON.stringundefined

Methods

getLottie() => Promise<any>

Returns the instance of lottie player used in the component.

Returns

Type: Promise<any>

pause() => void

Pause animation play.

Returns

Type: void

play() => void

Start playing animation.

Returns

Type: void

setDirection(value: number) => void

Animation play direction.

Parameters
NameTypeDescription
valuenumberDirection values.
Returns

Type: void

setLooping(value: boolean) => void

Sets the looping of the animation.

Parameters
NameTypeDescription
valuebooleanWhether to enable looping. Boolean true enables looping.
Returns

Type: void

setSpeed(value?: number) => void

Sets animation play speed.

Parameters
NameTypeDescription
valuenumberPlayback speed.
Returns

Type: void

stop() => void

Stops animation play.

Returns

Type: void

toggleLooping() => void

Toggles animation looping.

Returns

Type: void

togglePlay() => void

Toggle playing state.

Returns

Type: void

Styling

Custom propertyDescriptionDefault
--lottie-player-toolbar-heightToolbar height35px
--lottie-player-toolbar-background-colorToolbar background colortransparent
--lottie-player-toolbar-icon-colorToolbar icon color#999
--lottie-player-toolbar-icon-hover-colorToolbar icon hover color#222
--lottie-player-toolbar-icon-active-colorToolbar icon active color#555
--lottie-player-seeker-track-colorSeeker track color#CCC
--lottie-player-seeker-thumb-colorSeeker thumb colorrgba(0, 107, 120, 0.8)

License

MIT License © LottieFiles.com

Keywords

FAQs

Package last updated on 08 May 2019

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