All effects
Parameter playground

Drag a slider: the demo replays itself so the difference is visible, and the matching number inside the prompt is rewritten. Copy it and you take a prompt tuned to your taste.

Expand time 0.55s The card auto-expands and holds: 0.3 feels like a teleport, 0.9 shows the full zoom path
Transitions

Shared Element Expand

A card seamlessly grows into a full detail view with continuous scaling - no cut, no jump.

AI Prompt
Implement a shared element transition from a card to a detail page: on click, the card position and size continuously and smoothly expand to full screen (expands over 0.55s) using the FLIP technique (measure the start rect, then animate to the target rect), with the image and text inside scaling in sync while a backdrop fades in. Closing reverses the exact path back into the card. Vanilla JS, no dropped frames, no jumps.

How it works

FLIP stands for First, Last, Invert, Play. First, you record the card's bounding rectangle. Last, you apply the final state (full-screen detail) and record its rectangle. Invert, you apply a transform that visually moves the element back to where it started - a translate plus scale built from the two rectangles. Play, you remove the transform with a transition, and the browser interpolates smoothly from start to finish. Because the only thing animating is a transform, the entire transition runs on the GPU compositor without triggering layout or paint, which is what keeps it at 60 frames per second on modest hardware.

The subtle part is content distortion: scaling a card up two or three times would stretch its text into a blur. The fix is counter-scaling - the inner content wrapper gets an inverse scale so its rendered size stays constant while the card shell grows. Border radius interpolates to zero as the card reaches full bleed, and the backdrop fades in on the compositor in parallel. Closing simply replays the transform back to the measured origin, which is why the reverse path feels identical.

How to use this prompt

This pattern fits any collection-to-detail flow: media galleries, product listings, article cards, or settings rows. Paste the prompt into your AI assistant alongside your markup and it will adapt the measurement logic to your layout. If your detail view is taller than the viewport, ask the AI to fade in scrollable content after the transform completes - mixing scroll with mid-flight transforms is the one place this technique gets janky.

Tips for better results

Keep transition duration between 400 and 600 milliseconds; shorter feels abrupt, longer feels sluggish. Use an ease-out curve on open and ease-in on close for natural acceleration. And always animate a single element rather than cross-fading two - the whole point is that the user's eye tracks one continuous object.

Keep exploring