The dotLottie Format
The dotLottie Format
dotLottie (.lottie) is an enhanced container format for Lottie animations that addresses several limitations of the original JSON format. It’s essentially a ZIP archive that can contain:
- Multiple animations: Package several related animations in a single file
- Images and assets: Embed all required images directly in the file
- Manifest file: Metadata about the animations, including IDs, names, and themes
- Optimized storage: Compressed format reduces file sizes even further
Benefits of dotLottie
- Self-contained: All assets are bundled together, no external dependencies
- Better organization: Multiple animations and themes in one package
- Smaller file sizes: ZIP compression reduces overall file size
- Version control friendly: Binary format is more efficient than large JSON files
- Multi-animation support: Perfect for animation sets like icons or loading states
File Structure
A .lottie file is a ZIP archive with this typical structure:
animation.lottie
ββ manifest.json # Required: Metadata file describing the package
ββ a/ # Required: Directory containing Lottie JSON animations
β ββ animation_1.json # Example animation file
β ββ animation_2.json # Another animation file
ββ i/ # Optional: Directory for image assets
β ββ img_1.webp # Example image asset
β ββ img_2.png # Another image asset
ββ s/ # Optional: Directory for state machine files
β ββ state_machine_1.json # Example state machine file
β ββ state_machine_2.json # Another state machine file
ββ t/ # Optional: Directory for theme files
β ββ theme_1.json # Example theme file
β ββ theme_2.json # Another theme file
ββ f/ # Optional: Directory for font assets
ββ BrandFont-Bold.ttf # Example font file
ββ BrandFont-Regular.woff2 # Another font fileCheck dotlottie.io/spec/2.0 for more details about the format.
Example Manifest
{
"version": "1.0",
"author": "Designer Name",
"generator": "dotLottie",
"animations": [
{
"id": "animation1",
"speed": 1,
"themeColor": "#ffffff",
"loop": true
}
]
}Creating dotLottie Files
You can create dotLottie files using:
- LottieFiles Platform: Export animations as dotLottie
- dotLottie-js: JavaScript library for creating and manipulating dotLottie files
- After Effects Plugin: Export directly from After Effects
Using dotLottie with Lottie4J
Lottie4J supports loading dotLottie files directly. The library handles decompression and asset extraction automatically:
File file = new File("src/test/resources/dot/demo-3.lottie");
// Get the first animation in the .lottie package
Animation animation = LottieFileLoader.load(File);
// Load as a DotLottie object for more advanced features
DotLottie dot = LottieFileLoader.loadDotLottie(file);
System.out.println("Animations in package: " +
(dot.animations() == null ? 0 : dot.animations().size()));When to Use dotLottie
Use dotLottie when you need:
- Animations with external image assets
- Multiple related animations in one package
- Smaller file sizes for web delivery
- Better organization for complex animation projects
- Theme support (light/dark mode variations)
For simple vector-only animations, standard Lottie JSON files are sufficient.