Media
INTERACTION_109CSS + JS
Image Trail
Thumbnails trail the cursor and fade out behind it.
Images / MediumView
A frame sequence spins the product as the pointer drags. Frame 0 displayed before the trigger; mapping drag distance to frame index across the sequence once horizontal drag or scroll progress.
/* Product Image Rotation — A frame sequence spins the product as the pointer drags. */
.product-image-rotation {
--dur: frame-linked;
--ease: linear;
--stagger: 60ms;
will-change: transform, opacity;
}
.product-image-rotation > * {
opacity: 0;
transform: translateY(14px);
animation: product-image-rotation-in var(--dur) var(--ease) forwards;
animation-delay: calc(var(--i, 0) * var(--stagger));
}
/* frame 0 displayed -> mapping drag distance to frame index across the sequence */
@keyframes product-image-rotation-in {
to {
opacity: 1;
transform: none;
filter: none;
}
}
@media (prefers-reduced-motion: reduce) {
.product-image-rotation > * {
opacity: 1;
transform: none;
animation: none;
}
}import { useEffect, useRef } from "react";
/** Product Image Rotation — trigger: horizontal drag or scroll progress */
export function ProductImageRotation({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
const el = ref.current;
if (!el) return;
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
el.dataset["state"] = "in";
return;
}
const io = new IntersectionObserver(
([entry]) => {
if (entry?.isIntersecting) {
el.dataset["state"] = "in";
io.unobserve(el);
}
},
{ threshold: 0.2 },
);
io.observe(el);
return () => io.disconnect();
}, []);
return (
<div ref={ref} className="product-image-rotation" data-state="out">
{children}
</div>
);
}Thumbnails trail the cursor and fade out behind it.
A subtle ripple runs through the image on hover.
A thumbnail expands to fill the viewport from its own position.
The image uncovers behind a mask while it settles from a slow zoom.