import { useRef, useEffect, useState } from 'react'; import { motion } from 'framer-motion'; interface Props { settings: Record; } interface Beam { id: number; x: number; duration: number; delay: number; rotate: number; } export default function BackgroundBeamsCollision({ settings: _settings }: Props) { const [beams, setBeams] = useState([]); const containerRef = useRef(null); useEffect(() => { const w = containerRef.current?.offsetWidth ?? window.innerWidth; const count = Math.floor(w / 100); setBeams( Array.from({ length: count }, (_, i) => ({ id: i, x: (i / count) * 100 + Math.random() * 10, duration: 4 + Math.random() * 8, delay: Math.random() * 4, rotate: -5 + Math.random() * 10, })), ); }, []); return (
{beams.map((beam) => (
))} {/* Bottom collision line */}
); }