Installation
npx kinetic-ui-cli@latest add magnetic-orbit-menuMechanics
This component merges continuous trigonometric animation with reactive physics:
- Orbit Paths: A global
requestAnimationFrameloop increments atimevariable. Each planetary node calculates its Cartesian(x, y)position relative to the center usingMath.cos()andMath.sin(). - Hover Pause: When any node (or the center avatar) is hovered, the global time loop halts, pausing the orbit so the user can comfortably click the target.
- Magnetic Core: The center avatar maps its translation to
cursorXandcursorYviauseSpring, creating a subtle parallax pull effect as you move your mouse across the container.
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { MagneticOrbitMenu } from "@/components/creative/magnetic-orbit-menu";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { MagneticOrbitMenu } from "@/components/creative/magnetic-orbit-menu";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<MagneticOrbitMenu
/>
</div>
);
}