agentleFS
LittlpinguinLittlpinguin/marketing-cockpit-template/.claude/skills/animation-lottie/SKILL.md

animation-lottie

Skill9 starsChanged 14 days agoMITView on GitHub

Lottie rendering of After Effects animations for web and React. Use when implementing Lottie, lottie-web, lottie-react, dotLottie or bodymovin JSON exports, animated icons, micro-interactions or loading animations. Complements GSAP ScrollTrigger and Framer Motion.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 14 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use "Glyphs" instead of fonts when possible

    line 132
  2. Distinctive:

    Avoid effects that create large data (particles, noise)

    line 134
  3. Distinctive:

    Use shape layers instead of vector layers

    line 135
  4. Distinctive:

    Use dotLottie format (.lottie) for automatic compression

    line 138
  5. Distinctive:

    Run JSON through Lottie optimizer tools

    line 139
  6. Distinctive:

    Problem: Not destroying Lottie instances when components unmount.

    line 219
  7. Distinctive:

    Use dotLottie format for compression

    line 262
  8. Distinctive:

    Check Bodymovin export settings (disable "Include expressions" if not needed)

    line 263
  9. Distinctive:

    Remove unused assets before export

    line 264
  10. Distinctive:

    Use Lottie optimizer tools: https://lottiefiles.com/tools/lottie-editor

    line 265
  11. Very specific:

    Use DotLottieWorker for web worker rendering

    line 273
  12. Distinctive:

    Avoid animating too many properties simultaneously

    line 276
  13. Distinctive:

    Test export early and often

    line 307
  14. Distinctive:

    Use LottieFiles preview before exporting

    line 308
  15. Distinctive:

    Check Bodymovin compatibility: https://airbnb.io/lottie/#/supported-features

    line 309

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Lottie Animations

Overview

Lottie is a library for rendering After Effects animations in real-time on web, iOS, Android, and React Native. Created by Airbnb, it allows designers to ship animations as easily as shipping static assets. Animations are exported from After Effects as JSON files using the Bodymovin plugin, then rendered natively with minimal performance overhead.

When to use Lottie:

  • Designer-created animations that need pixel-perfect fidelity
  • Complex animated icons and micro-interactions
  • Loading animations and progress indicators
  • Onboarding sequences and tutorial animations
  • Marketing animations and promotional content
  • Alternative to GIF/video with smaller file sizes and scalability

Key advantages:

  • Vector-based (scalable without quality loss)
  • Significantly smaller file sizes than GIF or video
  • Editable at runtime (colors, speed, segments)
  • Full designer control via After Effects
  • Cross-platform rendering consistency
  • Interactive controls (play, pause, seek, loop)

Fichiers de référence

  • references/common_patterns.md : sept recettes (page HTML avec dotLottie-web, composant React avec contrôles, écouteurs d'événements, animation pilotée par le scroll avec lottie-react, segment joué au survol, plusieurs animations et thèmes, rendu dans un web worker). À ouvrir pour poser une animation dans une page.
  • references/integration_patterns.md : couplage avec GSAP ScrollTrigger et Framer Motion, intégrations Vue 3 et Svelte. À ouvrir seulement dans l'un de ces environnements.
  • references/api_reference.md : API de dotlottie-web, DotLottieWorker, dotlottie-react, lottie-web et lottie-react, hooks useLottie et useLottieInteractivity. À ouvrir pour une option, une méthode ou un événement précis.
  • references/after_effects_export.md : export depuis After Effects avec Bodymovin (installation, réglages, fonctions prises en charge, optimisation, problèmes d'export, test, dépannage). À ouvrir pour préparer ou corriger un fichier exporté.
  • references/performance_guide.md : objectifs chiffrés, poids des fichiers, rendu, mémoire, réseau, mobile, suivi des performances, problèmes courants. À ouvrir quand une animation saccade, pèse trop ou ralentit la page.

Core Concepts

Lottie Format Types

1. JSON Lottie (.json)

  • Original Lottie format
  • Exported from After Effects via Bodymovin plugin
  • Human-readable JSON structure
  • Larger file sizes (not compressed)
  • Widely supported across all platforms

2. dotLottie (.lottie)

  • Modern compressed format
  • ZIP archive containing JSON + assets
  • Supports multiple animations and themes in one file
  • Smaller file sizes (up to 90% reduction)
  • Recommended for production use

Library Options

lottie-web (original library):

import lottie from 'lottie-web';

lottie.loadAnimation({
  container: document.getElementById('lottie-container'),
  renderer: 'svg', // or 'canvas', 'html'
  loop: true,
  autoplay: true,
  path: 'animation.json' // or animationData: jsonData
});

@lottiefiles/dotlottie-web (modern, recommended):

import { DotLottie } from '@lottiefiles/dotlottie-web';

new DotLottie({
  canvas: document.getElementById('canvas'),
  src: 'animation.lottie',
  autoplay: true,
  loop: true
});

@lottiefiles/dotlottie-react (React integration):

import { DotLottieReact } from '@lottiefiles/dotlottie-react';

<DotLottieReact
  src="animation.lottie"
  loop
  autoplay
  style={{ height: 300 }}
/>

lottie-react (alternative React wrapper):

import Lottie from 'lottie-react';
import animationData from './animation.json';

<Lottie animationData={animationData} loop={true} />

Animation Data Sources

1. LottieFiles (lottie.host)

  • 100,000+ free animations
  • Direct URL embedding
  • CDN hosting

2. Local JSON/dotLottie files

  • Bundled with application
  • Better performance (no network request)
  • Version control friendly

3. After Effects export

  • Custom designer animations
  • Bodymovin plugin required
  • Export settings critical for file size

Common Patterns

Sept recettes, de la page HTML avec dotLottie-web au rendu dans un web worker : references/common_patterns.md. À ouvrir pour poser une animation dans une page.

Integration Patterns

GSAP ScrollTrigger, Framer Motion, Vue 3 et Svelte : references/integration_patterns.md. À ouvrir seulement dans l'un de ces environnements.

Performance Optimization

File Size Optimization

1. Export Settings in After Effects:

  • Enable "Skip images that aren't used"
  • Use "Glyphs" instead of fonts when possible
  • Simplify paths (reduce points in illustrator)
  • Avoid effects that create large data (particles, noise)
  • Use shape layers instead of vector layers

2. Compression:

  • Use dotLottie format (.lottie) for automatic compression
  • Run JSON through Lottie optimizer tools
  • Remove unnecessary metadata

3. Lazy Loading:

const LazyLottie = () => {
  const [shouldLoad, setShouldLoad] = React.useState(false);

  React.useEffect(() => {
    const observer = new IntersectionObserver((entries) => {
      if (entries[0].isIntersecting) {
        setShouldLoad(true);
      }
    });

    observer.observe(document.getElementById('lottie-trigger'));
    return () => observer.disconnect();
  }, []);

  return (
    <div id="lottie-trigger">
      {shouldLoad && <DotLottieReact src="animation.lottie" loop autoplay />}
    </div>
  );
};

Runtime Performance

1. Renderer Selection:

// SVG: Best quality, slower for complex animations
// Canvas: Better performance, rasterized
// HTML: Limited support, use only for simple animations

// For complex animations, prefer canvas
new DotLottie({
  canvas: document.getElementById('canvas'),
  src: 'animation.lottie',
  autoplay: true,
  loop: true,
  renderConfig: {
    devicePixelRatio: window.devicePixelRatio || 1
  }
});

2. Web Workers:

// Offload to worker for heavy animations
import { DotLottieWorker } from '@lottiefiles/dotlottie-web';

new DotLottieWorker({
  canvas: document.getElementById('canvas'),
  src: 'heavy-animation.lottie',
  autoplay: true,
  loop: true
});

3. Mobile Optimization:

// Reduce quality on mobile
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);

new DotLottie({
  canvas: document.getElementById('canvas'),
  src: isMobile ? 'animation-low.lottie' : 'animation-high.lottie',
  autoplay: true,
  loop: true,
  renderConfig: {
    devicePixelRatio: isMobile ? 1 : window.devicePixelRatio
  }
});

Common Pitfalls

1. Memory Leaks from Improper Cleanup

Problem: Not destroying Lottie instances when components unmount.

Solution:

const SafeAnimation = () => {
  const [dotLottie, setDotLottie] = React.useState(null);

  React.useEffect(() => {
    return () => {
      // Always destroy instance on unmount
      dotLottie?.destroy();
    };
  }, [dotLottie]);

  return <DotLottieReact src="animation.lottie" dotLottieRefCallback={setDotLottie} />;
};

2. Event Listener Cleanup

Problem: Event listeners not removed, causing multiple handlers.

Solution:

useEffect(() => {
  if (!dotLottie) return;

  const handleComplete = () => console.log('Complete');
  dotLottie.addEventListener('complete', handleComplete);

  // MUST return cleanup function
  return () => {
    dotLottie.removeEventListener('complete', handleComplete);
  };
}, [dotLottie]);

3. Large File Sizes

Problem: Exported JSON files are 500KB+ for simple animations.

Solutions:

  • Simplify After Effects composition (reduce layers, keyframes)
  • Use dotLottie format for compression
  • Check Bodymovin export settings (disable "Include expressions" if not needed)
  • Remove unused assets before export
  • Use Lottie optimizer tools: https://lottiefiles.com/tools/lottie-editor

4. Animation Performance Issues

Problem: Animation stutters or drops frames.

Solutions:

  • Switch from SVG to Canvas renderer
  • Use DotLottieWorker for web worker rendering
  • Reduce complexity in After Effects (fewer layers, simpler shapes)
  • Lower devicePixelRatio on mobile
  • Avoid animating too many properties simultaneously

5. Incorrect Path/URL References

Problem: Animation doesn't load due to CORS or incorrect paths.

Solution:

// Use animationData for local imports (best for bundled apps)
import animationData from './animation.json';
<Lottie animationData={animationData} />

// OR use path for external URLs (requires CORS headers)
<DotLottieReact src="https://example.com/animation.lottie" />

// For Next.js, place in public/ folder
<DotLottieReact src="/animations/animation.lottie" />

6. After Effects Export Compatibility

Problem: Some After Effects features don't export to Lottie.

Unsupported features:

  • Layer effects (drop shadows, glows) - use shape layers instead
  • Blending modes (limited support)
  • 3D layers
  • Expressions (partial support)
  • Track mattes (partial support)

Solution:

Resources

This skill includes:

references/

  • api_reference.md - Complete API documentation for lottie-web, lottie-react, and dotlottie-web
  • after_effects_export.md - Guide for exporting animations from After Effects
  • performance_guide.md - Detailed performance optimization strategies

Les scripts et assets de la skill d'origine ne sont pas copiés dans ce template : voir docs/vendored-animation.md, section « Périmètre retenu ».

Related Skills

  • gsap-scrolltrigger - For scroll-driven Lottie animations synchronized with page scroll
  • motion-framer - Combine with Framer Motion for layout animations wrapping Lottie
  • animated-component-libraries - Pre-built components that may include Lottie animations
  • threejs-webgl - For 3D animations beyond Lottie's 2D capabilities
  • react-three-fiber - Alternative for complex 3D animated scenes

Vendorisée depuis claudedesignskills de freshtechbro (plugin animation-components, skill lottie-animations v1.0.0, licence MIT, © 2025 Claude Skills Project). Copie SKILL.md + references/ uniquement (pas de scripts ni d'assets, conformément à la politique de vendoring du template). Attribution, périmètre retenu et procédure de re-synchronisation : docs/vendored-animation.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.