All checks were successful
CI / lint-and-test (push) Successful in 9m52s
Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
/**
|
|
* Lightweight CSS background — avoids WebGL ReadPixels GPU stall warnings from Three.js.
|
|
*/
|
|
export function ParticleBackground() {
|
|
const [enabled, setEnabled] = useState(true);
|
|
|
|
useEffect(() => {
|
|
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
const sync = () => setEnabled(!reducedMotion.matches);
|
|
sync();
|
|
reducedMotion.addEventListener("change", sync);
|
|
return () => reducedMotion.removeEventListener("change", sync);
|
|
}, []);
|
|
|
|
return (
|
|
<div
|
|
className="fixed inset-0 -z-10 pointer-events-none overflow-hidden"
|
|
aria-hidden
|
|
>
|
|
<div className="absolute inset-0 bg-gradient-to-b from-blue-950/40 via-gray-950 to-gray-950 opacity-30" />
|
|
{enabled && (
|
|
<div className="absolute inset-0 opacity-20 animate-[particle-drift_120s_linear_infinite] bg-[radial-gradient(circle_at_20%_30%,rgba(59,130,246,0.35)_0%,transparent_45%),radial-gradient(circle_at_80%_70%,rgba(99,102,241,0.25)_0%,transparent_40%),radial-gradient(circle_at_50%_50%,rgba(59,130,246,0.15)_0%,transparent_55%)]" />
|
|
)}
|
|
</div>
|
|
);
|
|
}
|