{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"crt-scanline-overlay","type":"registry:component","title":"CRT Scanline Overlay","description":"Scanlines, aperture grille, rolling refresh and vignette over any content.","dependencies":[],"registryDependencies":[],"files":[{"path":"components/viberdy/crt-scanline-overlay.tsx","content":"\"use client\";\n\nimport type { ReactNode } from \"react\";\n\nexport function CrtScanlineOverlay({\n  children,\n  lineGap = 3,\n  intensity = 30,\n  roll = true,\n  rollSeconds = 12,\n  grille = true,\n}: {\n  children: ReactNode;\n  lineGap?: number;\n  intensity?: number;\n  roll?: boolean;\n  /** Seconds for one pass of the refresh bar. Lower is faster and more agitated. */\n  rollSeconds?: number;\n  /** Vertical RGB triads. This is what reads as a tube rather than stripes. */\n  grille?: boolean;\n}) {\n  const opacity = intensity / 100;\n\n  return (\n    <div className=\"relative isolate overflow-hidden\">\n      {/* Static keyframes — nothing interpolated in here. */}\n      <style>{\"@keyframes crt-roll { 0% { transform: translateY(-100%); } 100% { transform: translateY(240%); } } @media (prefers-reduced-motion: reduce) { [data-crt-roll] { animation: none !important; } }\"}</style>\n\n      {children}\n\n      {/* Horizontal scanlines. A repeating gradient, not an image: a few\n          hundred bytes, resolution-independent, crisp on retina. */}\n      <div\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0\"\n        style={{\n          backgroundImage:\n            \"repeating-linear-gradient(to bottom, rgba(0,0,0,\" +\n            opacity +\n            \") 0px, rgba(0,0,0,\" +\n            opacity +\n            \") 1px, transparent 1px, transparent \" +\n            lineGap +\n            \"px)\",\n        }}\n      />\n\n      {/* Aperture grille: vertical RGB triads. This is the layer that makes it\n          read as a real tube rather than as generic stripes. */}\n      {grille && (\n        <div\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0 mix-blend-overlay\"\n          style={{\n            backgroundImage:\n              \"repeating-linear-gradient(to right, rgba(255,0,0,0.10) 0px, rgba(0,255,0,0.10) 1px, rgba(0,0,255,0.10) 2px, transparent 3px)\",\n          }}\n        />\n      )}\n\n      {roll && (\n        <div\n          aria-hidden\n          data-crt-roll=\"\"\n          className=\"pointer-events-none absolute inset-x-0 h-16\"\n          style={{\n            background:\n              \"linear-gradient(to bottom, transparent, rgba(255,255,255,0.05), transparent)\",\n            animation: \"crt-roll \" + Math.max(1, rollSeconds) + \"s linear infinite\",\n          }}\n        />\n      )}\n\n      {/* Tubes are darker at the corners. */}\n      <div\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0\"\n        style={{\n          background:\n            \"radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 100%)\",\n        }}\n      />\n    </div>\n  );\n}\n","type":"registry:component","target":"components/viberdy/crt-scanline-overlay.tsx"}],"meta":{"tier":"free","tags":["overlay","crt","retro","scanlines"],"href":"https://viberdy.dev/library/crt-scanline-overlay","aiPrompt":"Create a React + Tailwind component named CrtScanlineOverlay — a CRT monitor overlay laid over arbitrary children.\n\nCompose FOUR stacked pointer-events-none, aria-hidden layers over the content:\n1. Horizontal scanlines: repeating-linear-gradient(to bottom, rgba(0,0,0,opacity) 0px, rgba(0,0,0,opacity) 1px, transparent 1px, transparent {lineGap}px).\n2. Aperture grille: repeating-linear-gradient(to right, ...) cycling faint red/green/blue at 1px each over a 3px period, with mix-blend-overlay. This layer is what makes it read as a real tube instead of generic stripes — do not skip it.\n3. A rolling refresh bar: a ~64px tall soft white gradient band animating translateY from -100% to 240%, linear and infinite, over a duration the caller sets. Default it slow — around twelve seconds. A fast roll reads as a fault rather than as a refresh, and it is the single most fatiguing part of a CRT treatment when it sits behind text.\n4. A corner vignette: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 100%).\n\nRequirements:\n- Use repeating CSS gradients, NOT images — a few hundred bytes, resolution-independent, and crisp at any DPR.\n- Put \"isolate\" on the wrapper so the stacking context is contained.\n- Define @keyframes in a STATIC <style> block with no interpolated values; per-instance numbers go in inline style.\n\nProps: children (ReactNode), lineGap (px between scanlines), intensity (0-100 scanline darkness), roll (boolean), rollSeconds (number).\n\nOutput a single self-contained \"use client\" component.","license":"https://viberdy.dev/license"}}