Live values

Motion · Next.js

A closer look at the glaze

Hover over the vase and a lens follows your pointer, gliding after it and settling where you stop.

With Wardic: Solid 1 · Solid 2

Live demo
The Lagoon Vase, up close

Hover over the vase to look closer, or press and drag on a phone.

Reduced motion: The lens doesn't glide: it's where the pointer is. A live value is yours, so Wardic's reduced motion leaves it alone; the demo jumps its springs to the pointer instead.

Beside Wardic

Motion's useSpring and useTransform are createSpring and createTransform, made in the component's body. Motion joins the two values into one background-position with useMotionTemplate; Wardic has no template helper, so each maps to a custom property, and the stylesheet joins them. Motion's version hears the pointer through the photo's onPointerMove and onPointerDown, a finger's too, where Solid 2 hears it through the photo's ward: when("hover"), and when("pressStart") and when("pan") for a finger.

The code

Highlighting…