Vibary.ai
← Vibe Coding

Product Image Zoom

The product magnifies inside its own frame with the transform origin chasing the pointer.

commercepremiumelegantinteraction · finite · advanced · ~0.4s
Interactive · click to play
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

291 lines · react + motion only
import { useState } from "react";
import type { PointerEvent as ReactPointerEvent } from "react";
import {
  motion,
  useMotionTemplate,
  useMotionValue,
  useSpring,
  useReducedMotion,

About this pattern

Magnification is only useful if it magnifies the right thing. The frame grows the product on a spring while the transform origin follows the pointer on a second, tighter spring, so the detail under the cursor is the detail that opens up and the frame never has to be re-aimed. Origin is expressed in percentages, which keeps it correct at any frame size, and the whole thing is one transform — no layout work per frame. Reduced motion keeps the magnification, because that is the information, and drops the chase.

Product detail imageryFabric and finish inspectionZoomable gallery framePrint or artwork preview

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • NewMenWomenSale
    Men's trail shoeRidgeline GT$132Bone
    88.599.510
    Add to bag
    Free delivery and returns
    Product details
    Product page

    Pointing at a garment photo magnifies it inside the same frame rather than opening a modal.

Related patterns