'use client'; import { motion, useInView } from 'framer-motion'; import { useRef } from 'react'; /** * DrillOrbit * * A glowing point looping along a parabolic arc — * abstractly evoking a horizontal directional drill path. * * The SVG has a horizontal linear-gradient mask: the entire * element fades in from the edge and out toward the opposite side. * The travelling dot also animates its own opacity to fade in/out * at the path endpoints — no abrupt appearance or disappearance. */ type Side = 'left' | 'right'; interface DrillOrbitProps { side?: Side; invert?: boolean; className?: string; } const PATH = 'M -20 80 C 150 80 200 340 400 340 C 600 340 650 80 820 80'; export function DrillOrbit({ side = 'right', invert = false, className = '', }: DrillOrbitProps) { const ref = useRef(null); const isInView = useInView(ref, { once: true, margin: '0px 0px -10% 0px' }); const color = invert ? '#084c39' : '#0e7a5c'; const glowColor = invert ? 'rgba(8,76,57,0.35)' : 'rgba(14,122,92,0.45)'; // Fade from transparent → opaque → transparent over the animation cycle // so the dot smoothly appears from the edge and disappears at the far edge. const dotOpacityKeyframes = [0, 0, 1, 1, 1, 0, 0]; const dotOpacityTimes = [0, 0.08, 0.18, 0.5, 0.82, 0.92, 1]; const transition = { duration: 5.5, ease: 'easeInOut' as const, repeat: Infinity, repeatDelay: 1.5, }; return ( ); }