GitHub - diffusionstudio/lottie: Generate production-ready Lottie animations with Claude Code or Codex
Key Points
- 1Text-to-Lottie is an open-source tool that allows AI coding agents, like Claude or Codex, to generate production-ready Lottie animations from descriptive text prompts.
- 2Users create animations by installing a skill and providing detailed prompts, often including SVG assets, motion design terminology, camera movements, and specific animation controls like FPS and duration.
- 3The resulting Lottie JSON files are directly usable across various platforms, with explicit examples provided for integration into web applications, React Native, iOS Swift, Android Kotlin, and Flutter.1. 🎨 Text-to-Lottie is an open-source tool that enables AI coding agents to generate production-ready Lottie animations from text prompts.
- 4Users interact by installing a skill and providing detailed prompts, often incorporating SVG assets, motion design terminology, camera instructions, and requests for specific animation controls or duration.
- 5The generated Lottie JSON files are versatile and can be directly used or integrated into various platforms, including web, React Native, iOS, Android, and Flutter.
Text-to-Lottie is an open-source harness designed for generating production-ready Lottie animations. Its core methodology revolves around integrating with large language models or coding agents, such as Claude or Codex, that support a "skills" paradigm. The system functions as a callable skill that, when invoked by a coding agent, translates natural language prompts into Lottie JSON animations.
To utilize this system, a user first installs the skill via npx skills add diffusionstudio/lottie. Subsequently, the user provides a detailed natural language prompt to their coding agent, requesting a specific Lottie animation. The agent, leveraging the installed "text-to-lottie" skill, processes this prompt. The underlying mechanism involves the agent interpreting the user's request and programmatically generating the Lottie JSON data structure, which defines the animation's properties, timeline, and visual elements. A key feature is the provision of a harness that allows for immediate inspection and editing of the generated Lottie animation via an included player.
Effective prompting is crucial for optimal results and is guided by several principles:
- Grounding the Model: Providing concrete assets such as SVG paths, real-world data, or screenshots significantly enhances the quality and relevance of the generated animation. This implies the agent can parse and integrate external visual data into the animation definition.
- Motion Design Terminology: Employing precise motion design language (e.g., "ease-in," "ease-out," "ease-in-out") enables the system to generate accurate animation timing curves and interpolation functions, as the agent is trained to map these terms to corresponding Lottie animation properties (e.g.,
ks.afor animation keyframes,ti,tofor bezier control points). - Camera Movement Simulation: Prompts can specify camera-like movements (pushes, pans, zooms, rig-like motions). The system translates these into group transforms within the Lottie composition, applying transformations (translation, scale, rotation) to layers or groups of layers, effectively simulating camera motion through
p(position),s(scale),r(rotation) properties on layert(transform) objects. - Explicit Control Exposure: Users can request that specific animation properties, beyond the default background color, be exposed as customizable controls within the generated Lottie structure, allowing for post-generation parameter adjustments.
- FPS and Duration Specification: Defining the desired frames per second (FPS) and total animation duration ensures the generated Lottie output adheres to specific timing requirements, influencing the number of frames and the overall speed of the animation's playback as defined by the
fr(frame rate) andop(out point) parameters in the Lottie JSON.
The generated Lottie animations, typically output as .json files, are production-ready and highly versatile. They can be directly imported into professional tools like After Effects for further refinement. For deployment, the animations are compatible across various platforms:
- Web/Vanilla HTML: Integrated using the
lottie-webJavaScript library, enabling dynamic loading and playback in a browser vialottie.loadAnimation({ container: HTMLElement, renderer: 'svg' | 'canvas', loop: boolean, autoplay: boolean, path: string }). - React Native: Rendered using
lottie-react-native'sLottieViewcomponent, configured with (for local or remote animation data),autoPlay,loop, andstyleprops. - React Native Skia: Offers more advanced control via Skia's
Skottiemodule, allowing runtime customization of animation properties, assets, and typographies. It leveragesSkia.Skottie.Make(JSON.stringify(animationData))to create an animation object, and enables frame-by-frame control usinguseClockanduseDerivedValueto precisely manage theframeprop of theSkottiecomponent. - iOS Swift: Integrated using the
Lottieframework, initializing anLottieAnimationView(name: String)and controlling its playback withplay()andloopModeproperties. - Android Kotlin: Utilizes the
LottieAnimationViewcomponent, setting the animation resource withsetAnimation(R.raw.animation)and managing playback withplayAnimation()andloop(true). - Flutter: Uses the
lottiepackage, loading animations viaLottie.asset('assets/animation.json').