Animated Grid Pattern
- Source
- Magic UI ↗
- Author
- Magic UI
- Licence
- MIT
Loading…
Cells of a skewed grid fade in and out at random positions.
Code
"use client";
import { cn } from "@/lib/utils";
import { AnimatedGridPattern } from "@/lab/magicui/ui/animated-grid-pattern";
export default function AnimatedGridPatternDemo() {
return (
<div className="relative flex h-full w-full items-center justify-center overflow-hidden p-20">
<AnimatedGridPattern
numSquares={30}
maxOpacity={0.1}
duration={3}
repeatDelay={1}
className={cn(
"mask-[radial-gradient(500px_circle_at_center,white,transparent)]",
"inset-x-0 inset-y-[-30%] h-[200%] skew-y-12",
)}
/>
</div>
);
}
Prompt
Build "Animated Grid Pattern", a background animation. What it does: Cells of a skewed grid fade in and out at random positions. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using motion. Technique: the Motion library, inline SVG. It sits on a light background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://magicui.design/docs/components/animated-grid-pattern (Magic UI, MIT).