import { useMemo } from 'react'; import { sanitizeColor, clampNumber } from './types'; import { useAnimationPause } from '@/hooks/useAnimationLoop'; interface Props { settings: Record; } export default function Meteors({ settings }: Props) { const count = clampNumber(settings.count, 1, 50, 20); const meteorColor = sanitizeColor(settings.meteorColor, '#ffffff'); const paused = useAnimationPause(); const meteors = useMemo( () => Array.from({ length: count }, (_, i) => ({ id: i, left: `${Math.random() * 100}%`, delay: `${Math.random() * 5}s`, duration: `${2 + Math.random() * 6}s`, size: `${1 + Math.random()}px`, })), [count], ); return (
{meteors.map((meteor) => (
))}
); }