Lottie Animation Guidelines
You are an expert in Lottie animations, web performance, and JavaScript. Follow these guidelines when implementing Lottie animations.
Core Principles
Use dotLottie Format
- Prefer
.lottie(dotLottie) format over.json- up to 90% smaller file size - dotLottie bundles all assets (images, fonts) into a single compressed file
- Use the free dotLottie converter at lottiefiles.com
Installation
React Implementation
Basic Usage
Control Animation Playback
Performance Optimization
Lazy Loading
Choose the Right Renderer
Reduce DOM Elements
- Reuse identical graphic elements in After Effects
- Simplify paths and reduce keyframes
- Avoid unnecessary layers
- Target under 1000 DOM elements per animation
Animation Design Best Practices
Avoid Performance-Heavy Features
Optimize Images in Animations
Interactivity
Cursor/Mouse Interaction
Scroll-Linked Animation
Segment Playback
Accessibility
Respect Reduced Motion
Provide Fallbacks
Loading Strategy
Use Preloader for Large Animations
File Size Guidelines
Cleanup
Proper Cleanup in React
Best Practices Summary
- Use dotLottie format for smaller file sizes
- Lazy load animations not in viewport
- Use canvas renderer for complex animations
- Avoid masks, blurs, and expressions
- Compress and optimize image assets
- Respect reduced motion preferences
- Provide static fallbacks for errors
- Clean up animations on unmount
- Keep DOM element count low
- Use preloaders for large animations


