Animated Grid Pattern

An animated grid pattern component that creates a dynamic background with moving squares.

motion-sv

Installation

pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/animated-grid-pattern.json

Usage

<script lang="ts">	import { AnimatedGridPattern } from "#lib/components/magic/animated-grid-pattern/index.js";</script>
<div class="relative h-64 overflow-hidden">	<AnimatedGridPattern class="absolute inset-0" /></div>

Props

Animated Grid Pattern Props

Props for the AnimatedGridPattern component

NameTypeDefaultDescription
widthnumber40Width of each grid square
heightnumber40Height of each grid square
xnumber-1X offset for the pattern
ynumber-1Y offset for the pattern
strokeDasharraynumber0Dash array for the grid lines
numSquaresnumber50Number of animated squares
maxOpacitynumber0.5Maximum opacity for animated squares
durationnumber4Animation duration in seconds
repeatDelaynumber0.5Delay between animation repeats
classClassValue""Additional CSS classes to apply