Vertical Line Rain
Subtle vertical falling lines with emerald glow on dark zinc. Modern matrix-inspired motion without green code rain cliché. Lightweight React background for tech and AI landing heroes.
Dependencies
react
npm install react react-domconst LINES = Array.from({ length: 20 }, (_, i) => ({
id: i,
left: `${(i * 5 + 2) % 98}%`,
delay: `${(i % 10) * 0.5}s`,
height: 40 + (i % 5) * 20,
}));
export function VerticalRainBackground({ children }: { children?: React.ReactNode }) {
return (
<div className="relative min-h-screen overflow-hidden bg-zinc-950">
{LINES.map((l) => (
<span
key={l.id}
className="pointer-events-none absolute top-0 w-px bg-gradient-to-b from-transparent via-emerald-400/50 to-transparent"
style={{
left: l.left, height: l.height,
animation: `rain 2.5s linear ${l.delay} infinite`,
}}
aria-hidden
/>
))}
<div className="pointer-events-none absolute inset-0 bg-gradient-to-b from-zinc-950/50 via-transparent to-zinc-950" aria-hidden />
<style>{`@keyframes rain{0%{transform:translateY(-100%);opacity:0}10%{opacity:1}90%{opacity:.5}100%{transform:translateY(100vh);opacity:0}}`}</style>
{children && <div className="relative z-10">{children}</div>}
</div>
);
}
Please implement this code in the current project and add it to (Your Desired Section, e.g. homepage hero, pricing page, dashboard). Change the primary accent color to (YOUR HEX CODE COLOR, e.g. #6366F1).
Requirements:
- Use React + Tailwind CSS (match the project's existing setup)
- Install dependencies if needed: npm install react react-dom
- Keep the layout responsive on mobile and desktop
- Replace placeholder copy with content that fits the project
The UI code:
const LINES = Array.from({ length: 20 }, (_, i) => ({
id: i,
left: `${(i * 5 + 2) % 98}%`,
delay: `${(i % 10) * 0.5}s`,
height: 40 + (i % 5) * 20,
}));
export function VerticalRainBackground({ children }: { children?: React.ReactNode }) {
return (
<div className="relative min-h-screen overflow-hidden bg-zinc-950">
{LINES.map((l) => (
<span
key={l.id}
className="pointer-events-none absolute top-0 w-px bg-gradient-to-b from-transparent via-emerald-400/50 to-transparent"
style={{
left: l.left, height: l.height,
animation: `rain 2.5s linear ${l.delay} infinite`,
}}
aria-hidden
/>
))}
<div className="pointer-events-none absolute inset-0 bg-gradient-to-b from-zinc-950/50 via-transparent to-zinc-950" aria-hidden />
<style>{`@keyframes rain{0%{transform:translateY(-100%);opacity:0}10%{opacity:1}90%{opacity:.5}100%{transform:translateY(100vh);opacity:0}}`}</style>
{children && <div className="relative z-10">{children}</div>}
</div>
);
}
Replace (Your Desired Section) and (YOUR HEX CODE COLOR) before pasting into Cursor, Copilot, or ChatGPT.