Introduction
What is AstroAnimate?
AstroAnimate is an Astro animation library designed for adding animations to Astro components without requiring runtime JavaScript by default.
It focuses on:
- Component-level animations (entry, reveal, transitions, and rotating text state changes)
- Performance-first implementation using CSS
- Compatibility with Astro’s rendering model (SSR + islands)
Unlike traditional animation libraries that rely heavily on JavaScript, AstroAnimate uses CSS-driven animations as the default, with optional JavaScript enhancements when needed.
What You'll Achieve
By the end of this page, you will:
- Understand what AstroAnimate is and how it works
- Know when it fits your project
- See how it differs from traditional animation libraries
- Decide whether to install it in your Astro project
Why AstroAnimate Exists
Animating UI in Astro often involves trade-offs:
- Adding JavaScript for simple animations
- Mixing multiple libraries (CSS + JS + frameworks)
- Losing performance benefits of Astro
AstroAnimate is designed to reduce that friction by providing:
- A consistent animation API for Astro components
- A CSS-first approach with optional JavaScript enhancements
- Pre-built, reusable animation primitives
What Problem Does It Solve?
Without AstroAnimate
-
You write custom CSS animations repeatedly -
You integrate external libraries (GSAP, Motion)
for simple effects -
You manage performance manually
With AstroAnimate
-
You use ready-to-use animation components -
You keep JavaScript minimal or optional -
You follow a consistent pattern across your
project
When to Use AstroAnimate
AstroAnimate works best for:
- Component animations (fade, slide, scale)
- Page transitions in Astro projects
- UI micro-interactions (hover, reveal, entry effects)
- Performance-sensitive websites (Landing pages, Blogs, SaaS)
When NOT to Use AstroAnimate
AstroAnimate is not designed for:
- Complex animation timelines
- Physics-based motion systems
- Advanced sequencing or choreography
For those use cases, consider:
- GSAP
- Motion Libraries
AstroAnimate works side-by-side with GSAP and Three.js if you need high-end complex animations.
How AstroAnimate Works
AstroAnimate is not designed for:
1. CSS-First Animations
-
Uses
@keyframesand CSS properties - No runtime JavaScript required for baseline animations
- Works with Astro SSR out of the box
2. Optional JavaScript Enhancements
- For advanced use cases (scroll triggers, interactions)
- Loaded only when needed (progressive enhancement)
3. Native Astro Integration
-
Works directly inside
.astrocomponents - Designed to work directly inside Astro components and SSR rendering patterns.
- Supports island architecture
Example (What It Looks Like)
---
import FadeIn from "@astroanimate/core/FadeIn";
---
<FadeIn>
<h1>Hello AstroAnimate</h1>
</FadeIn> This applies a fade-in animation without adding runtime JavaScript.
What Makes AstroAnimate Different
| Feature | AstroAnimate | Traditional Libraries |
|---|---|---|
| Default behavior | CSS-based | JavaScript-heavy |
| Performance | High (no runtime JS) | Depends on usage |
| Astro integration | Native | Requires setup |
| Use case | UI animations | Full animation systems |
This applies a fade-in animation without adding runtime JavaScript.
Notes / Caveats
- AstroAnimate prioritizes simplicity and performance over complexity
- Advanced animation scenarios may require external libraries
- Some features depend on browser support for CSS animations