{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"css-animated-backgrounds-gradient-mesh-dot-grid-spotlight-aurora-and-grain","type":"registry:block","title":"CSS Animated Background Set: Gradient Mesh, Dot Grid Spotlight, Aurora and Grain","description":"Free animated background set in pure CSS: drifting gradient mesh, dot grid spotlight, aurora bands and film grain. React and Tailwind, no canvas.","dependencies":[],"files":[{"path":"components/we-inc/css-animated-backgrounds-gradient-mesh-dot-grid-spotlight-aurora-and-grain.tsx","type":"registry:component","content":"import { useState } from \"react\";\n\n// Four pure-CSS animated backgrounds. Every moving layer animates `transform`\n// only, so the browser composites them on the GPU without repainting.\n// Copy the <style> block and the one background you want.\n\nconst heroes = [\n  {\n    id: \"mesh\",\n    label: \"Gradient mesh\",\n    eyebrow: \"Studio scheduling\",\n    title: \"Book the studio without the email chain.\",\n    copy: \"Clients pick a slot, pay the deposit and get a reminder the day before.\",\n    cta: \"Start a booking page\",\n    theme: \"light\",\n  },\n  {\n    id: \"grid\",\n    label: \"Dot grid spotlight\",\n    eyebrow: \"Release notes\",\n    title: \"Ship on Friday without the dread.\",\n    copy: \"Every deploy gets a preview link, a checklist and a one-click rollback.\",\n    cta: \"Read the changelog\",\n    theme: \"dark\",\n  },\n  {\n    id: \"aurora\",\n    label: \"Aurora bands\",\n    eyebrow: \"Night field trips\",\n    title: \"Four nights north of the tree line.\",\n    copy: \"Small groups, heated cabins and a guide who checks the forecast hourly.\",\n    cta: \"See March dates\",\n    theme: \"dark\",\n  },\n  {\n    id: \"grain\",\n    label: \"Grain and light\",\n    eyebrow: \"Ceramics journal\",\n    title: \"Notes from a slow kiln.\",\n    copy: \"Glaze tests, firing logs and the occasional crack, written up every Sunday.\",\n    cta: \"Subscribe for free\",\n    theme: \"light\",\n  },\n] as const;\n\nconst NOISE =\n  \"url(\\\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>\\\")\";\n\nconst css = `\n.cab-root[data-paused=\"true\"] .cab-move { animation-play-state: paused; }\n@keyframes cab-drift-a { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(18%,12%,0) scale(1.15); } }\n@keyframes cab-drift-b { 0%,100% { transform: translate3d(0,0,0) scale(1.1); } 50% { transform: translate3d(-16%,-10%,0) scale(.95); } }\n@keyframes cab-drift-c { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(-10%,16%,0); } }\n@keyframes cab-spot { 0% { transform: translate3d(-20%,-15%,0); } 25% { transform: translate3d(55%,5%,0); } 50% { transform: translate3d(40%,45%,0); } 75% { transform: translate3d(-5%,35%,0); } 100% { transform: translate3d(-20%,-15%,0); } }\n@keyframes cab-band-a { 0%,100% { transform: translate3d(-8%,0,0) rotate(-12deg) scaleY(1); } 50% { transform: translate3d(10%,4%,0) rotate(-6deg) scaleY(1.25); } }\n@keyframes cab-band-b { 0%,100% { transform: translate3d(6%,0,0) rotate(-20deg) scaleY(1.1); } 50% { transform: translate3d(-10%,-5%,0) rotate(-26deg) scaleY(.85); } }\n@keyframes cab-band-c { 0%,100% { transform: translate3d(0,0,0) rotate(-8deg); } 50% { transform: translate3d(14%,6%,0) rotate(-14deg); } }\n@keyframes cab-light { 0%,100% { transform: translate3d(-25%,-10%,0); } 50% { transform: translate3d(35%,20%,0); } }\n@keyframes cab-grain { 0% { transform: translate3d(0,0,0); } 25% { transform: translate3d(-3%,2%,0); } 50% { transform: translate3d(2%,-3%,0); } 75% { transform: translate3d(-2%,-1%,0); } 100% { transform: translate3d(1%,3%,0); } }\n.cab-dots-holes {\n  background: #0b1120;\n  -webkit-mask-image: radial-gradient(circle, transparent 1.6px, #000 2.2px);\n          mask-image: radial-gradient(circle, transparent 1.6px, #000 2.2px);\n  -webkit-mask-size: 22px 22px; mask-size: 22px 22px;\n}\n@media (prefers-reduced-motion: reduce) { .cab-move { animation: none !important; } }\n`;\n\nfunction MeshBg() {\n  return (\n    <div aria-hidden=\"true\" className=\"absolute inset-0 overflow-hidden bg-[#fbf7f1]\">\n      <div className=\"cab-move absolute -left-[20%] -top-[30%] h-[90%] w-[80%] rounded-full animate-[cab-drift-a_18s_ease-in-out_infinite] [background:radial-gradient(closest-side,rgba(251,146,60,.55),transparent)]\" />\n      <div className=\"cab-move absolute -right-[15%] -top-[10%] h-[85%] w-[75%] rounded-full animate-[cab-drift-b_22s_ease-in-out_infinite] [background:radial-gradient(closest-side,rgba(244,114,182,.42),transparent)]\" />\n      <div className=\"cab-move absolute -bottom-[35%] left-[15%] h-[90%] w-[80%] rounded-full animate-[cab-drift-c_26s_ease-in-out_infinite] [background:radial-gradient(closest-side,rgba(56,189,248,.38),transparent)]\" />\n    </div>\n  );\n}\n\nfunction GridBg() {\n  return (\n    <div aria-hidden=\"true\" className=\"absolute inset-0 overflow-hidden bg-[#0b1120]\">\n      <div className=\"absolute inset-0 [background-image:radial-gradient(circle,#1e293b_1.5px,transparent_1.9px)] [background-size:22px_22px]\" />\n      <div className=\"cab-move absolute left-0 top-0 h-[80%] w-[60%] animate-[cab-spot_16s_ease-in-out_infinite] [background:radial-gradient(closest-side,rgba(94,234,212,1),rgba(45,212,191,.45)_50%,transparent)]\" />\n      <div className=\"cab-dots-holes absolute inset-0\" />\n      <div className=\"cab-move absolute left-0 top-0 h-[80%] w-[60%] opacity-20 animate-[cab-spot_16s_ease-in-out_infinite] [background:radial-gradient(closest-side,rgba(45,212,191,.6),transparent)]\" />\n      <div className=\"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-[#0b1120] to-transparent\" />\n    </div>\n  );\n}\n\nfunction AuroraBg() {\n  return (\n    <div aria-hidden=\"true\" className=\"absolute inset-0 overflow-hidden bg-[#06121a]\">\n      <div className=\"cab-move absolute -left-[20%] top-[5%] h-[38%] w-[140%] animate-[cab-band-a_20s_ease-in-out_infinite] [background:radial-gradient(50%_50%_at_50%_50%,rgba(52,211,153,.8),rgba(52,211,153,.2)_55%,transparent)]\" />\n      <div className=\"cab-move absolute -left-[10%] top-[18%] h-[30%] w-[130%] animate-[cab-band-b_26s_ease-in-out_infinite] [background:radial-gradient(50%_50%_at_50%_50%,rgba(45,212,191,.6),transparent_70%)]\" />\n      <div className=\"cab-move absolute -left-[30%] top-[-6%] h-[30%] w-[120%] animate-[cab-band-c_30s_ease-in-out_infinite] [background:radial-gradient(50%_50%_at_50%_50%,rgba(244,114,182,.45),transparent_70%)]\" />\n      <div className=\"absolute inset-x-0 bottom-0 h-2/5 bg-gradient-to-t from-[#06121a] via-[#06121a]/60 to-transparent\" />\n    </div>\n  );\n}\n\nfunction GrainBg() {\n  return (\n    <div aria-hidden=\"true\" className=\"absolute inset-0 overflow-hidden bg-[#d6ccbc]\">\n      <div className=\"absolute inset-0 [background:radial-gradient(120%_90%_at_50%_120%,rgba(120,98,72,.35),transparent_60%)]\" />\n      <div className=\"cab-move absolute -left-[10%] -top-[20%] h-[120%] w-[80%] animate-[cab-light_14s_ease-in-out_infinite] [background:radial-gradient(closest-side,rgba(255,252,245,1),rgba(255,244,224,.55)_45%,transparent)]\" />\n      <div\n        className=\"cab-move absolute -inset-[10%] opacity-[.35] mix-blend-multiply animate-[cab-grain_.8s_steps(4)_infinite]\"\n        style={{ backgroundImage: NOISE }}\n      />\n    </div>\n  );\n}\n\nconst backgrounds = { mesh: MeshBg, grid: GridBg, aurora: AuroraBg, grain: GrainBg };\n\nexport default function CssAnimatedBackgrounds() {\n  const [paused, setPaused] = useState(false);\n\n  return (\n    <section\n      className=\"cab-root bg-white px-4 py-12 font-['Inter_Tight',Inter,ui-sans-serif,system-ui] text-slate-900 sm:px-8\"\n      data-paused={paused}\n    >\n      <style>{css}</style>\n      <div className=\"mx-auto max-w-6xl\">\n        <div className=\"mb-6 flex flex-wrap items-end justify-between gap-4\">\n          <div>\n            <p className=\"text-sm font-medium text-slate-600\">CSS only, transform animations</p>\n            <h2 className=\"mt-1 text-2xl font-semibold tracking-tight sm:text-3xl\">Four animated backgrounds</h2>\n          </div>\n          <button\n            type=\"button\"\n            aria-pressed={paused}\n            onClick={() => setPaused((p) => !p)}\n            className=\"inline-flex h-10 items-center gap-2 rounded-full border border-slate-300 bg-white px-4 text-sm font-medium text-slate-800 transition-colors hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-900 focus-visible:ring-offset-2\"\n          >\n            <svg aria-hidden=\"true\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n              {paused ? <path d=\"M4 2.5v11l9-5.5z\" /> : <path d=\"M4 2h3v12H4zM9 2h3v12H9z\" />}\n            </svg>\n            {paused ? \"Play motion\" : \"Pause motion\"}\n          </button>\n        </div>\n\n        <div className=\"grid gap-4 md:grid-cols-2\">\n          {heroes.map((h) => {\n            const Bg = backgrounds[h.id];\n            const dark = h.theme === \"dark\";\n            return (\n              <article\n                key={h.id}\n                aria-labelledby={`cab-${h.id}`}\n                className={`relative isolate flex min-h-[300px] flex-col justify-end overflow-hidden rounded-2xl p-6 sm:p-8 ${dark ? \"text-white ring-1 ring-white/10\" : \"text-slate-900 ring-1 ring-slate-900/10\"}`}\n              >\n                <Bg />\n                <span className={`absolute right-4 top-4 rounded-full px-2.5 py-1 text-xs font-medium ${dark ? \"bg-white/10 text-white\" : \"bg-white/70 text-slate-800\"}`}>\n                  {h.label}\n                </span>\n                <div className=\"relative max-w-md\">\n                  <p className={`text-xs font-semibold uppercase tracking-[.14em] ${dark ? \"text-teal-200\" : \"text-slate-700\"}`}>{h.eyebrow}</p>\n                  <h3 id={`cab-${h.id}`} className=\"mt-2 text-2xl font-semibold leading-tight tracking-tight sm:text-[28px]\">\n                    {h.title}\n                  </h3>\n                  <p className={`mt-2 text-sm leading-relaxed ${dark ? \"text-slate-300\" : \"text-slate-700\"}`}>{h.copy}</p>\n                  <a\n                    href=\"#\"\n                    className={`mt-5 inline-flex h-10 items-center rounded-full px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 ${dark ? \"bg-white text-slate-900 hover:bg-slate-200 focus-visible:ring-white focus-visible:ring-offset-slate-900\" : \"bg-slate-900 text-white hover:bg-slate-700 focus-visible:ring-slate-900\"}`}\n                  >\n                    {h.cta}\n                  </a>\n                </div>\n              </article>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
