Magnetic Dot Cursor

A small accent dot rides with the pointer, then snaps open into a pill that wraps whatever link you hover

The dot snaps onto links

Create a magnetic-dot cursor. A small 8px accent dot travels with the pointer (the native cursor can stay visible above it). The trick happens on hover: when the pointer enters a link or button, the dot leaps out of the cursor and morphs into a rounded pill that wraps the whole element, with a 14% accent tint fill and a 1.5px accent border. Leave the element and it collapses back into a dot at the cursor. Implementation: render one fixed-position div (pointer-events: none). It has two states driven by one piece of state: FREE, where left/top follow clientX/clientY minus 4px, width/height are 8px, border-radius 50%, solid accent background; and SNAPPED, where left/top/width/height match the hovered element's getBoundingClientRect expanded by 4px on each side, border-radius 999px, background rgba(accent, 0.14), border 1.5px solid accent. Detect targets on mousemove with event.target.closest('a, button, [data-magnet]'). Transition all geometry with 260ms cubic-bezier(0.34, 1.56, 0.64, 1): the overshoot in that spring curve is what sells the magnetic snap. While snapped, keep updating nothing (the pill stays glued to the element even as the mouse moves within it). Details: re-measure the element on scroll while snapped, or release the snap on scroll; the div is aria-hidden; gate behind (hover: hover) and (pointer: fine); under prefers-reduced-motion crossfade between states with opacity instead of morphing. Build the component, not this demo of it. - Ambient motion that IS the component may loop: a drifting background, a marquee, a spinner while something is genuinely loading. - Do not add any timer, interval, loop or script that performs a person's action by itself. No auto-hover, no auto-click, no cycling through states, no pretend submitting, no replaying the interaction on a schedule. - Every state that answers a person waits for a real event from that person. - Placeholder copy and sample content are welcome. Simulated behaviour is not.

Rate it
0
0

We'd like to measure how the site gets used, with Google Analytics. It sets cookies. Everything the site needs to work runs either way. How we handle data