2b. Product 360° Spin
An interactive drag‑to‑spin 360° viewer on product pages — the same exterior‑spin pattern online car retailers (e.g. carla.se) use: an ordered image sequence of one full rotation that the shopper scrubs by dragging. Frames are authored in the CMS and served from the CDN.
How it works
- Authoring: a Product 360° set in Payload (
product360scollection) holds an ordered array of frame uploads, keyed by the Medusa product handle. - Data flow: PDP →
getProduct360Frames(handle)(apps/storefront/lib/product360.ts) fetches the Payload set →ProductGalleryshows a 360° toggle + thumbnail →Product360renders the drag‑to‑spin viewer. - Fallback: if no Payload set exists, an ordered URL array in Medusa
product.metadata.frames360is used. The toggle appears only when there are more than one frame. - Viewer features: progressive frame loading (frame 0 first, then a bounded background prefetch) with a loading bar, a one‑time auto‑spin (respects
prefers-reduced-motion), fullscreen, and hover‑zoom. Mouse and touch.
Capturing frames (solar products)
- Use a turntable + tripod: rotate the product, keep the camera fixed.
- 24–36 frames per rotation (every ~10–15°). More = smoother but heavier.
- Manual, fixed exposure / white‑balance / focus (no auto) so frames don't flicker.
- Even, diffuse lighting; white / neutral seamless background; product centred and the same size in every frame.
Naming & optimizing
- Name frames in rotation order, zero‑padded:
frame_001.jpg … frame_036.jpg(lexical order = rotation order). - Resize to ~1600 px on the long edge and compress (JPEG/WebP) before upload — the viewer loads the whole set.
Authoring in Payload
- CMS admin → Catalog → Product 360° sets → Create.
- Product handle = the exact Medusa handle (e.g.
utl-alfa-plus-pro-pcu). - Upload the frames into the frames array in order (drag rows to reorder) — they land in the (S3/CDN‑backed) media library.
- Leave Enabled checked → Save. The PDP shows the 360° view on the next load.
Verify
Open the product PDP → a Photos / 360° toggle and a dark 360° thumbnail appear → switch to 360° → drag to rotate (touch works on mobile); try fullscreen + zoom.
Troubleshooting
- No 360° toggle: the handle must match the Medusa product handle exactly, and the set needs ≥ 2 frames and must be Enabled.
- Slow first spin: reduce frame size/count; frames load progressively (the top bar shows progress).