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.7s The pill auto-expands into a panel: 0.3 is snappy, 1.2 shows the whole morph
Overshoot 0.56 Auto-expands: 0 lands flush, 0.56 overshoots then settles
Buttons

Fluid Morph Button

A pill button that fluidly morphs into a modal panel with high-damping spring curves, and flows back on close.

AI Prompt
Implement a fluid morph transformation: a pill-shaped button on the page expands into a modal panel using a highly damped spring easing curve (expand animation runs 0.7s, overshoot 0.56) - size, border radius, and content opacity transition seamlessly. The panel shows a title and body content; tapping close flows it back into the pill with the same fluid animation. Build with pure CSS transitions and vanilla JavaScript.

How it works

The morph works by animating a single element between two visual states instead of swapping components. In the collapsed state it is a pill roughly 150 by 44 pixels with full rounding; expanded it becomes a 220 by 170 panel with a 18px radius. Every property that changes - width, height, border-radius, and the opacity of the two content layers (button label versus panel content) - is on a CSS transition driven by one spring-like easing curve. Because the browser interpolates all properties with the same curve, the shape appears to flow rather than step.

The damping quality comes from the curve shape: a high-damping spring reaches its target without multiple bounces but still overshoots once, like a soft hydraulic hinge. Pair it with a crossfade - button text fades out while panel content fades in slightly delayed - and the eye reads it as one continuous object. Everything runs on transform and opacity where possible; animating width and height here is acceptable because the element is small and the transition is short, but on very large panels you would switch to scale transforms with counter-scaled content.

How to use this prompt

Use this pattern for quick actions that need a little more context: a share button expanding into share options, a filter pill opening into filter controls, or a fab growing into a mini form. Paste the prompt into Cursor, Windsurf, or Claude and specify your framework so the assistant wires state management idiomatically. Ask for reduced-motion support if you ship to production - the AI will add a media query that swaps the fluid curve for a simple fade.

Tips for better results

Keep the panel compact; the morph reads best when the size ratio stays under about four times. If content inside the panel needs to be interactive immediately, fade it in after 100ms rather than at animation start. And match your border-radius interpolation to the visual size change - interpolating radius in pixels keeps corners looking consistent as the shape grows.

Keep exploring