Animations
ForgeUI uses Framer Motion for all animations, providing smooth, GPU-accelerated transitions.
Installation
Framer Motion is a core dependency:
bash
npm install framer-motionBasic Usage
Import motion components and apply animations:
tsx
import { motion } from "framer-motion";
export function FadeIn({ children }: { children: React.ReactNode }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, ease: "easeOut" }}
>
{children}
</motion.div>
);
}ForgeUI Animation Presets
Use the pre-built animation primitives from the Animation Library:
| Animation | Use Case |
|---|---|
| Fade Up | Section reveals on scroll |
| Scale Bounce | Button & card interactions |
| Magnetic Button | Premium hover effects |
| Glow Pulse | Ambient background effects |
| Text Stagger | Hero headline reveals |
| 3D Flip | Card hover interactions |
Custom CSS Animations
ForgeUI also provides CSS keyframe animations in globals.css:
css
@keyframes marquee {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
@keyframes float {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
}Performance Tips
- 1Use `will-change` sparingly — Only on actively animating elements
- 2Prefer `transform` and `opacity` — These are GPU-accelerated
- 3Use `layout` prop carefully — It can cause reflows on complex layouts
- 4Lazy load animations — Use intersection observers for scroll animations