Vibary.ai
← Vibe Coding

Gallery Lightbox Open

The pressed thumbnail flies out of the grid into the large view while the backdrop dims behind it.

navigationpremiumelegantinteraction · 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.

405 lines · react + motion only
import { useEffect, useId, useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Gallery Lightbox Open
 *
 * The thumbnail you pressed is the thing that flies: one frame leaves
 * the grid, crosses the panel and becomes the large view, while the

About this pattern

A photo viewer where the picture never gets replaced, only moved. The frame the reader pressed leaves its cell, crosses the panel and becomes the large view, so there is never a question of which of six items is now on screen — and closing sends the same frame back to the cell it came from. Two details carry it. The cell keeps an outline while its frame is away, because exactly one element may hold a given shared id at a time and doubling it is what makes these transitions jump. And the caption stays outside the flight entirely: anything travelling inside a layout animation is rescaled by it, so the text waits for the frame to land and then fades in at its own fixed size. The backdrop dims during the crossing rather than before it, which is what makes the grid feel put away rather than covered up.

Photo galleryAsset library pickerProduct image viewerAttachment preview