Crt Effect
thegridcn/crt-effectFreeComponent
CRT monitor effect with scanlines, vignette, flicker, and scan sweep animation. * Wrap any content to give it a retro CRT monitor appearance.
See it running
Open the demo on thegridcn
thegridcn.com/r/crt-effectInstall it
npx shadcn@latest add https://thegridcn.com/r/crt-effect.jsonSource
1"use client";23import type * as React from "react";4import { cn } from "@/lib/utils";56interface CRTEffectProps extends React.HTMLAttributes<HTMLDivElement> {7 /** Enable animated scan sweep line */8 animated?: boolean;9 /** Use theme primary color for lines (gives cyan/colored tint) */10 colored?: boolean;11 /** Intensity of the scanlines effect */12 intensity?: "light" | "medium" | "heavy";13 /** Line spacing in pixels */14 spacing?: number;15}1617/**18 * CRT monitor effect with scanlines, vignette, flicker, and scan sweep animation.19 * Wrap any content to give it a retro CRT monitor appearance.20 */21export function CRTEffect({22 children,23 className,24 intensity = "medium",25 animated = true,26 spacing = 3,27 colored = false,28 ...props29}: CRTEffectProps) {30 const opacityMap = {31 heavy: 0.25,32 light: 0.08,33 medium: 0.15,34 };3536 return (37 <div className={cn("relative overflow-hidden", className)} {...props}>38 {children}3940 {/* Scanlines overlay */}41 <div42 className="pointer-events-none absolute inset-0 z-10"43 style={{44 background: `repeating-linear-gradient(45 0deg,46 transparent,47 transparent ${spacing}px,48 ${colored ? `hsl(var(--primary) / ${opacityMap[intensity]})` : `rgba(0, 0, 0, ${opacityMap[intensity]})`} ${spacing}px,49 ${colored ? `hsl(var(--primary) / ${opacityMap[intensity]})` : `rgba(0, 0, 0, ${opacityMap[intensity]})`} ${spacing * 2}px50 )`,51 }}52 />5354 {/* Flicker overlay for CRT effect */}55 <div56 className="pointer-events-none absolute inset-0 z-10 animate-flicker opacity-[0.02]"57 style={{58 background:59 "linear-gradient(transparent 50%, rgba(0, 0, 0, 0.1) 50%)",60 backgroundSize: "100% 4px",61 }}62 />6364 {/* Animated scan sweep line */}65 {animated ? (66 <div67 className="pointer-events-none absolute right-0 left-0 z-20 h-[2px] animate-scan-sweep"68 style={{69 background:70 "linear-gradient(90deg, transparent, hsl(var(--primary) / 0.5), transparent)",71 boxShadow:72 "0 0 10px hsl(var(--primary) / 0.3), 0 0 20px hsl(var(--primary) / 0.2)",73 }}74 />75 ) : null}7677 {/* Vignette effect */}78 <div79 className="pointer-events-none absolute inset-0 z-10"80 style={{81 background:82// … truncated
Files it writes
More from thegridcn
All 139 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | thegridcn | Components | Free | 2 deps | |
| Agent Avataragent-avatar | thegridcn | Components | Free | no deps | |
| Alertalert | thegridcn | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | thegridcn | Components | Free | 1 dep | |
| Announcement Barannouncement-bar | thegridcn | Components | Free | no deps | |
| Anomaly Banneranomaly-banner | thegridcn | Components | Free | no deps | |
| Arrival Panelarrival-panel | thegridcn | Components | Free | no deps | |
| Aspect Ratioaspect-ratio | thegridcn | Components | Free | 1 dep |
