
The elastic button
Buttons, Hover, Text
One button, one sign, in the simple style of product interface pieces: the white «Mark as done» pill with an empty ring. On tap the ring fills from its centre in the accent colour and a check draws inside it, while «Mark as» folds away letter by letter, the gap closes and the d becomes a capital: «Done» is what is left. On a second tap the check slides off and the words open back up one letter at a time.
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>
<!--
"Mark as done 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 Mark as done button with the words folding away</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 button, one sign: the ring fills with a check and «Mark as» folds away, leaving «Done» -->
<button class="done" type="button" data-done aria-pressed="false" aria-label="Mark as done">
<span class="done__body" data-body>
<svg class="done__icon" viewBox="0 0 24 24" aria-hidden="true">
<circle class="done__ripple" data-ripple cx="12" cy="12" r="9"/>
<circle class="done__ring" data-ring cx="12" cy="12" r="8.4"/>
<path class="done__ghost" data-ghost d="M8.1 12.3l2.7 2.7 5.2-5.6"/>
<circle class="done__disc" data-disc cx="12" cy="12" r="9.2"/>
<path class="done__check" data-check d="M8.1 12.3l2.7 2.7 5.2-5.6"/>
</svg>
<span class="done__label" aria-hidden="true">
<span class="done__lead" data-lead><span class="done__lead-in" data-lead-in></span></span><span class="done__d"><span data-d="low">d</span><span data-d="up">D</span></span><span data-tail>one</span>
</span>
</span>
</button>
</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.
16 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 “Mark as done button” from Animorio and fit it into my site«Mark as» and the space after it are separate letters inside a box with overflow hidden. The letters squeeze (scaleX 0.4), shift a little and vanish with a stagger from the end, while the box width goes to zero with power3.inOut: the pill itself, a flex box, follows the label with no measuring.
The width to open back up is measured on the inner line of letters, which keeps its natural size even inside a zero-width box (white-space pre), divided by the pill’s scale: the letters’ transforms do not change it.
The small d and the capital D share one grid cell: the first leaves upwards, the second comes in from below with the wdth axis at 75 and weight 420 and lands at 100 and 600 with back.out; the rest of the word takes the same weight, so «Done» reads more decided.
The disc grows from 0.2 to 1 around the centre (svgOrigin 12 12) with back.out, so it goes a hair past; the check draws with strokeDashoffset to minus 0.7 and back to zero. To remove it, it goes to minus its length and slides off the far end. A thin circle in the accent colour widens to 1.75 and fades once.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #14a05a | The colour the ring fills with. |
LEAD | script.js | Mark as | The words that fold away. |
WORD | script.js | done | The word that stays (its first letter becomes a capital). |
SPRING | script.js | 1 | How springy the press, the ring and the letters are: 0.4 calm, 2 very bouncy. |
SPEED | script.js | 1 | The speed of everything: 2 twice as fast, 0.5 half. |
HOLD | script.js | 2.2 | How many seconds each state stays when the button plays by itself. |
AUTO | script.js | true | The button plays the gesture by itself until someone touches it. |
For closing a task in a to-do list, an assignment in a project management app, a step of a guide or a support ticket: the label getting shorter says by itself that it is done.
On the phone the pill, the ring and the label take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.
The disc, the check, the letters and the D swap with a fade, with no springs or movement; the pill takes its new width at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 4.7 KB; the libraries: GSAP 28 KB.
Tested on 31 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.