Live values

Motion · Next.js

Cards that catch the light

Move over a piece and its card tilts toward your pointer, with a soft light under it that follows.

With Wardic: Solid 1 · Solid 2

Live demo

Reduced motion: The cards don't tilt, and the light is where the pointer is, without the spring. It still comes on and goes off.

Beside Wardic

Motion's version hears the pointer through the card's onPointerMove, skipping a finger by its pointerType, and eases it back with onHoverEnd. Solid 2 hears it through the card's ward, when("hover") with the point and the card, and when("hoverEnd"); Solid 1 through onHoverStart and onHoverEnd and the element's pointermove. The springs and transforms are the same, and the light's place is a custom property in both, though Motion's style type doesn't name custom properties: its version casts.

The code

Highlighting…