"use client"; import { motion, useReducedMotion } from "motion/react"; type QuantumRingProps = { className?: string; color?: string; /** Colour of the inner ring. */ accent?: 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; }; /* One arc of a circle that turns and stretches/shrinks as it goes. */ function Arc({ r, color, width, duration, reverse, still }: { r: number; color: string; width: number; duration: number; reverse?: boolean; still: boolean; }) { return ( ); } /* QuantumRing: two arcs spin opposite ways while a particle jumps between four spots between them. */ export function QuantumRing({ className = "", color = "#a78bfa", accent = "#22d3ee", size = 72, speed = 1, label = "Loading", }: QuantumRingProps) { const reduce = !!useReducedMotion(); const spin = 1.6 / speed; const jump = 1.2 / speed; const dot = size * 0.07; return (
{label} {/* Four spots on the middle circle; the particle shows at one at a time */} {[0, 1, 2, 3].map((i) => ( ))}
); }