dotlottie-web

Featured

Implement Lottie animations using dotLottie runtimes (@lottiefiles/dotlottie-web and @lottiefiles/dotlottie-react). Use when building, debugging, or optimizing dotLottie or Lottie animations in web projects, including vanilla JS, React, and Next.js. Covers package selection, Web Workers, state machines, theming, dynamic slot overriding, performance best practices, and common patterns.

Web & Frontend 744 stars 47 forks Updated today MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
96
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# dotLottie Implementation Guidelines You are an expert at implementing Lottie animations using dotLottie runtimes. Follow these guidelines when working with dotLottie in web projects. ## Package Selection ### Use `@lottiefiles/dotlottie-web` when: * You need direct canvas control * Building framework-agnostic code * Maximum performance is critical * You want the smallest bundle ### Use `@lottiefiles/dotlottie-react` when: * Building React applications * You want declarative component API * You need React lifecycle integration ## Installation ```bash # Web (vanilla JS, Vue, Svelte, etc.) npm install @lottiefiles/dotlottie-web # React npm install @lottiefiles/dotlottie-react ``` ## Basic Implementation ### Vanilla JavaScript ```typescript import { DotLottie } from '@lottiefiles/dotlottie-web'; const dotLottie = new DotLottie({ canvas: document.getElementById('canvas') as HTMLCanvasElement, src: 'https://example.com/animation.lottie', autoplay: true, loop: true, }); ``` ### React ```tsx import { DotLottieReact } from '@lottiefiles/dotlottie-react'; function Animation() { return ( <DotLottieReact src="https://example.com/animation.lottie" autoplay loop /> ); } ``` ### React with Instance Control ```tsx import { useRef } from 'react'; import { DotLottieReact } from '@lottiefiles/dotlottie-react'; import type { DotLottie } from '@lottiefiles/dotlottie-web'; function Animation() { const dotLottieRef = useRef<DotLottie | nul...

Details

Author
LottieFiles
Repository
LottieFiles/dotlottie-web
Created
2 years ago
Last Updated
today
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category