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

@lottiefiles/dotlottie-wc

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lottiefiles/dotlottie-wc

Web component wrapper around the dotlottie-web library

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
decreased by-20.64%
Maintainers
1
Weekly downloads
 
Created
Source

@lottiefiles/dotlottie-wc

npm npm bundle size npm NPM

Contents

  • Introduction
  • Installation
  • Usage
  • APIs
  • RenderConfig
  • Development

Introduction

A web component for rendering and playing Lottie and DotLottie animations in web applications.

What is dotLottie?

dotLottie is an open-source file format that aggregates one or more Lottie files and their associated resources into a single file. They are ZIP archives compressed with the Deflate compression method and carry the file extension of ".lottie".

Learn more about dotLottie.

Installation

npm install @lottiefiles/dotlottie-wc

Usage

Via npm

After installation, you can use dotlottie-wc in your HTML file:

<dotlottie-wc src="https://lottie.host/4db68bbd-31f6-4cd8-84eb-189de081159a/IGmMCqhzpt.lottie" autoplay="true" loop="true"></dotlottie-wc>

And import it in your JavaScript or TypeScript module:

import '@lottiefiles/dotlottie-wc';

Via CDN

You can also use the component directly via a npm CDN:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>@lottiefiles/dotlottie-wc | Basic Example</title>
</head>
<body>
    <dotlottie-wc src="https://lottie.host/4db68bbd-31f6-4cd8-84eb-189de081159a/IGmMCqhzpt.lottie" autoplay loop></dotlottie-wc>
    <script type="module" src="https://unpkg.com/@lottiefiles/dotlottie-wc@latest/dist/dotlottie-wc.js"></script>
</body>
</html>

APIs

Attributes

The dotlottie-wc component accepts all configuration attributes of DotLottie from @lottiefiles/dotlottie-web, allowing you to customize your animation as required.

AttributeTypeDescription
srcstringURL of the Lottie or DotLottie animation.
autoplaybooleanAutomatically start the animation.
loopbooleanLoop the animation.
speednumberPlayback speed.
datastringAnimation data as a string or ArrayBuffer for .lottie animations.
segmentArrayAnimation segment as an array of two numbers (start frame and end frame).
modestringAnimation play mode (e.g., "forward", "bounce").
backgroundColorstringBackground color of the canvas. Accepts 6-digit or 8-digit hex color string (e.g., "#000000FF").
renderConfigObject (RenderConfig)Configuration for rendering the animation.

RenderConfig

The renderConfig object accepts the following properties:

Property nameTypeRequiredDefaultDescription
devicePixelRationumberwindow.devicePixelRatio | 1The device pixel ratio.

Properties

The dotlottie-wc exposes the following properties:

Property nameTypeDescription
dotLottieDotLottieThe dotLottie instance from DotLottie , allowing you to call methods and listen to events for more control over the animation.

Development

Setup

npm install

Dev

npm run dev

Build

npm run build

Keywords

FAQs

Package last updated on 20 Nov 2024

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