lottie-js (Legacy)
Migration guide from lottie-js to dotlottie-js
lottie-js (Legacy)
Overview
lottie-js was a JavaScript library for working with Lottie animations and creating .lottie files. This library is now deprecated and no longer maintained. Users should migrate to @lottiefiles/dotlottie-js, which offers improved performance, better type safety, and active development.
Warning
Deprecated: lottie-js is no longer maintained. Please migrate to dotlottie-js for continued support and new features.
What was lottie-js?
lottie-js was an early library designed to:
Load and manipulate Lottie JSON animations
Create
.lottiefiles programmaticallyBundle multiple animations with assets
Provide a simple API for animation management
While it served its purpose, the library had limitations in architecture, performance, and TypeScript support that led to the development of a modern replacement.
Why Migrate to dotlottie-js?
The new @lottiefiles/dotlottie-js library provides:
Modern Architecture: Built from the ground up with modern JavaScript standards
Better Performance: Optimized file handling and memory management
TypeScript Support: Full type definitions for better developer experience
Active Maintenance: Regular updates, bug fixes, and new features
Improved API: More intuitive and consistent method naming
Enhanced Features: Support for themes, state machines, and advanced animations
Better Error Handling: Clearer error messages and validation
Key Differences
| Feature | lottie-js (Legacy) | dotlottie-js (Modern) |
| Package Name | lottie-js | @lottiefiles/dotlottie-js |
| API Style | Callback-based | Promise-based (async/await) |
| TypeScript | Limited | Full support |
| Module System | CommonJS | ESM + CommonJS |
| Bundle Size | ~45KB | ~35KB (optimized) |
| Documentation | Minimal | Comprehensive |
| Maintenance | Deprecated | Active |
Migration Timeline
March 2024: lottie-js marked as deprecated
June 2024: Final security updates only
December 2024: End of life - no further updates
Info
We recommend migrating as soon as possible to benefit from ongoing improvements and security updates.
Quick Migration Checklist
Before you start migrating, review this checklist:
Review your current usage of lottie-js
Check the Migration Guide for API changes
Update package dependencies
Convert callback patterns to async/await
Update import/require statements
Test thoroughly in your environment
Remove lottie-js from dependencies
Migration Resources
Getting Help
If you encounter issues during migration:
Check the Migration Guide for common patterns
Review the Legacy API Reference
Consult the dotlottie-js documentation
Ask questions in our community Discord
Report issues on GitHub
Simple Example
Here's a quick preview of the migration:
const lottie = require("lottie-js");
lottie.loadAnimation({
path: "animation.json",
callback: (animation) => {
console.log("Animation loaded:", animation);
},
error: (err) => {
console.error("Error:", err);
},
});The new API is cleaner, uses modern async/await patterns, and provides better error handling.
Next Steps
Ready to migrate? Start with the Migration Guide for detailed instructions and code examples.