"use client"; import { motion, useReducedMotion } from "motion/react"; type OrbitLoaderProps = { className?: string; color?: string; /** Loader width in pixels. */ size?: number; /** 1 is the default pace; 2 is twice as fast. */ speed?: number; /** Read out by screen readers. */ label?: string; }; /* OrbitLoader: three moons circle a glowing core on tilted rings, each at its own pace. */ export function OrbitLoader({ className = "", color = "#a78bfa", size = 72, speed = 1, label = "Loading", }: OrbitLoaderProps) { const reduce = useReducedMotion(); const rings = [ { tilt: 0, scale: 1, duration: 1.6 }, { tilt: 60, scale: 0.8, duration: 2.2 }, { tilt: -60, scale: 0.6, duration: 1.2 }, ]; const moon = Math.max(4, size / 12); return (
{label} {rings.map((r) => { const rx = (size / 2) * r.scale; const ry = rx * 0.4; const steps = Array.from({ length: 25 }, (_, i) => (i / 24) * Math.PI * 2); return ( Math.cos(a) * rx), y: steps.map((a) => Math.sin(a) * ry) }} transition={{ duration: (reduce ? r.duration * 4 : r.duration) / speed, repeat: Infinity, ease: "linear" }} /> ); })}
); }