Cursor Proximity Effects: Design Engineering with Opus 4.8
Learn how to create responsive UI interactions using cursor proximity — not just hover. Scale elements smoothly based on distance like macOS Dock.
With the release of Opus 4.8, more and more designers are getting into Design Engineering, so I decided to share one of the interaction patterns that experienced designers use very often:
Use not only hover, but also reaction to cursor proximity. When the pointer is near an element, neighboring elements can smoothly scale up and become darker depending on the distance to the cursor.
This makes the interface feel more responsive, less binary, and significantly more alive.
onpointermove = e =>
document.querySelectorAll(".dock>*").forEach(el => {
const r = el.getBoundingClientRect();
const t = Math.max(
0,
1 - Math.abs(e.clientX - r.x - r.width / 2) / 120
);
el.style.scale = 1 + t * .5;
});
Here the coefficient t is calculated based on the distance between the cursor and the element's center. The closer the cursor, the stronger the scaling. This approach resembles the macOS dock panel effect, where elements react even before direct hover.
Per the channel author's message.
Read also
Comments
Weekly digest
The best of vibe coding, AI agents and open source — once a week, no spam.