
The elastic button
Buttons, Hover, Text
A comment in a document review, on white, in the style of clean product interface pieces: the compact card with a drawn avatar, one line of text and two replies, and below it the Resolve button, 60 pixels tall. On hover the check draws itself in grey and the comment gets a green outline; pressed, the comment crumples in height into a pill and slides into the button, which swallows it, fills green from the icon and becomes «Resolved» with a stroke-drawn check. The button rises to the centre and a small Undo pops out beside it which, pressed, brings the comment back out on a spring.
A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.
<!doctype html>
<!--
"Resolve comment button" from Animorio · https://animorio.com
License: free on your own sites and your clients’ sites, paid work included.
Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Resolve button that closes the comment</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage" data-stage>
<!-- one gesture: resolve the thread. The comment crumples in height and slides into the button,
which widens into Resolved with a drawn check; a small Undo pops out beside it and brings the comment back -->
<div class="frame" data-inquadra>
<div class="col" data-col>
<div class="slot" data-slot>
<article class="card" data-card aria-label="Comment by Maya Lindqvist">
<header class="card__head" data-part>
<span class="av" aria-hidden="true">
<svg viewBox="0 0 32 32">
<defs><clipPath id="av-clip"><circle cx="16" cy="16" r="16"></circle></clipPath></defs>
<g clip-path="url(#av-clip)">
<rect width="32" height="32" fill="#e7e4fb"></rect>
<path d="M4.5 33c1.2-6.6 5.6-10.2 11.5-10.2S26.3 26.4 27.5 33Z" fill="#5a57c9"></path>
<path d="M13.3 20.4h5.4v3.6a2.7 2.7 0 0 1-5.4 0Z" fill="#e3b192"></path>
<circle cx="16" cy="14.2" r="6.1" fill="#f0c4a5"></circle>
<path d="M9.6 15.2C9 9.6 11.9 6.6 16.3 6.6c4.2 0 6.8 2.8 6.3 8.3-1-2.6-3.4-4.6-6.6-4.8-1.7 2.2-4.2 3.6-6.4 5.1Z" fill="#2c2420"></path>
<path d="M22.6 14.9c.7 2.6.3 5-1 6.6.4-2 .6-4.2 1-6.6Z" fill="#2c2420"></path>
</g>
</svg>
</span>
<span class="card__who"><b>Maya Lindqvist</b><time>2h</time></span>
<span class="card__tag">Pricing page</span>
</header>
<p class="card__text" data-part>Tighten the gap above pricing?</p>
<footer class="card__replies" data-part data-replies>
<span class="mini" data-mini>
<span class="mini__av mini__av--a" title="Jonah Okafor"><svg viewBox="0 0 20 20"><path d="M3 21c.8-4 3.6-6.2 7-6.2s6.2 2.2 7 6.2Z" fill="#e07a52"></path><circle cx="10" cy="8.8" r="3.9" fill="#b97a55"></circle><path d="M6 8.6c-.2-2.8 1.5-4.4 4-4.4s4.3 1.6 4 4.4c-.6-1.2-1.8-1.9-4-1.9S6.6 7.4 6 8.6Z" fill="#231a16"></path></svg></span>
<span class="mini__av mini__av--b" title="Rosa Vidal"><svg viewBox="0 0 20 20"><path d="M3 21c.8-4 3.6-6.2 7-6.2s6.2 2.2 7 6.2Z" fill="#3d72d6"></path><circle cx="10" cy="8.9" r="3.9" fill="#f3cfb3"></circle><path d="M5.7 10.6C5.3 6.6 7.2 4.5 10 4.5s4.7 2.1 4.3 6.1c-.5-1.6-1-2.6-1.6-3.2-1.6.4-3.6.4-5.4-.4-.8.8-1.3 2-1.6 3.6Z" fill="#c9974e"></path></svg></span>
</span>
<span class="card__count">2 replies</span>
<span class="card__last">· last 12m ago</span>
</footer>
</article>
</div>
<div class="row" data-row>
<button class="resolve" type="button" data-resolve aria-pressed="false">
<span class="resolve__bg" aria-hidden="true"></span>
<span class="resolve__fill" data-fill aria-hidden="true"></span>
<span class="resolve__ico" data-ico aria-hidden="true">
<svg viewBox="0 0 24 24">
<circle class="ring" data-ring cx="12" cy="12" r="8.6"></circle>
<path class="tick" data-tick d="M8.3 12.4l2.6 2.6 5-5.4"></path>
</svg>
</span>
<span class="labels" data-labels>
<span class="label" data-l="resolve">Resolve</span>
<span class="label" data-l="resolved">Resolved</span>
</span>
</button>
<span class="undo-slot" data-undo-slot>
<button class="undo" type="button" data-undo tabindex="-1" aria-hidden="true">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.6 4.2 3 6.8l2.6 2.6"></path><path d="M3.4 6.8h6a3.4 3.4 0 0 1 0 6.8H7.6"></path></svg>
<span>Undo</span>
</button>
</span>
</div>
</div>
<p class="sr" aria-live="polite" data-live></p>
</div>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
</main>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
<script src="script.js"></script>
</body>
</html>Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.
21 values to change
With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:
Take “Resolve comment button” from Animorio and fit it into my siteBefore moving, the card switches to absolute position at its own size and the container keeps the height: real top, left, width, height and radius can then be animated, with no scale distorting the corners.
The lines fold with scaleY 0.8 from the top and fade staggered; the card drops to 34 pixels high keeping its bottom still, then moves to the button’s rectangle, inset by 8 pixels a side, with power3.in, and disappears behind it because the button row has a higher z-index.
On arrival the button goes to scaleX 1.06 and scaleY 0.9 and springs back with elastic.out; the green is a layer under the label with a clip-path circle growing from the icon’s centre, and the check is a stroke with stroke-dasharray 12 that draws itself.
When the comment leaves, the row would jump to the centre: its top is measured, the comment hidden, the top measured again, and the row starts from the difference and goes to zero with back.out. The same, in reverse, when the comment comes back.
The Undo sits in a zero-width slot next to the button: the slot widens to the Undo’s width plus the gap, so the group recentres by itself, while the Undo comes out from behind the button from x −44 and scale 0.55 on a spring.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #17a05d | The colour of the resolved button, the check and the warning outline. |
AUTHOR | script.js | Maya Lindqvist | The name of the person who wrote the comment. |
COMMENT | script.js | Tighten the gap above pricing? | The comment, on a single line (a long one ends with an ellipsis). |
CRUMPLE | script.js | 0.52 | The seconds the comment takes to crumple and slide into the button. |
BOUNCE | script.js | 1.6 | How much the button, the Undo and the returning comment bounce. |
HOLD | script.js | 2.1 | The seconds the autopilot shows «Resolved» before pressing Undo. |
For the comments of a document editor, a design tool, a code review, a project tracker or a client portal: anywhere a discussion is closed with a click and you want to be able to take it back.
The block is 92 per cent of the screen wide up to 340 pixels and 204 tall; under 360 pixels the «Pricing page» tag disappears so the name has room, and a long comment ends with an ellipsis. A tap does what a click does; the hover preview stays for the mouse.
No crumple, springs or slides: the comment fades out and back in, the green fills the button almost at once, the label changes without rolling, the Undo fades in and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.9 KB; the libraries: GSAP 28 KB.
Tested on 27 October 2026
Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.