
The elastic button
Buttons, Hover, Text
Under a subscription card, on very light grey, a quiet Cancel plan button: one gesture, press. The button grows in place into a small confirmation, with what you lose, Keep plan and Cancel anyway to hold while a red ring fills; once confirmed, it shrinks into the date the plan ends, with Resume to go back.
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>
<!--
"Cancel plan 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 cancel plan button that asks first</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">
<!-- one gesture: press. The plan card of a billing page with a quiet Cancel plan button: pressed, the button
grows into a small confirmation in the same place (what you lose, Keep plan, and Cancel anyway that has to be
held for a moment while a ring fills); confirmed, it shrinks into the date the plan ends, with Resume -->
<section class="pezzo" data-pezzo aria-label="Your subscription">
<article class="piano" data-piano>
<span class="piano__icona" aria-hidden="true">
<svg viewBox="0 0 24 24"><path d="M4 16.5c3.2-1 5.6-3.3 7.3-7.1.6-1.4 1.2-2.6 2.3-3.4"></path><path d="M13.6 6c1.9-.4 3.9.2 5.4 1.6"></path><path d="M4 19.5h16"></path></svg>
</span>
<span class="piano__testo">
<span class="piano__nome">Skerry Pro</span>
<span class="piano__dati">$24 / month · 3 seats</span>
</span>
<span class="stato" data-stato>
<span class="stato__voce" data-voce="attivo">Renews Nov 28</span>
<span class="stato__voce stato__voce--fine" data-voce="fine">Ends Nov 28</span>
</span>
</article>
<div class="posto" data-posto>
<div class="morph" data-morph>
<!-- rest: the quiet button -->
<button class="strato strato--tasto" type="button" data-strato="tasto" data-apri>
<span>Cancel plan</span>
</button>
<!-- open: the confirmation in place -->
<div class="strato strato--conferma" data-strato="conferma" role="group" aria-label="Confirm cancelling">
<p class="conferma__titolo">Cancel Skerry Pro?</p>
<ul class="perdi">
<li class="perdi__riga" data-riga>
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="9" r="3.2"></circle><path d="M3.8 18.5c.7-2.8 2.7-4.4 5.2-4.4s4.5 1.6 5.2 4.4"></path><path d="M15.6 6.4a3 3 0 0 1 0 5.2M17.4 14.6c1.4.6 2.4 1.9 2.8 3.9"></path></svg>
<span>2 teammates lose access</span>
</li>
<li class="perdi__riga" data-riga>
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3.8 7.2a1.6 1.6 0 0 1 1.6-1.6h3.9l1.9 2.1h7.4a1.6 1.6 0 0 1 1.6 1.6v7.9a1.6 1.6 0 0 1-1.6 1.6H5.4a1.6 1.6 0 0 1-1.6-1.6V7.2Z"></path><rect x="10" y="12.2" width="4.4" height="3.6" rx=".8"></rect><path d="M10.9 12.2v-.9a1.3 1.3 0 0 1 2.6 0v.9"></path></svg>
<span>14 projects become read-only</span>
</li>
</ul>
<div class="scelte">
<button class="scelta scelta--tieni" type="button" data-tieni>Keep plan</button>
<button class="scelta scelta--via" type="button" data-via aria-label="Hold to cancel anyway">
<span class="anello" aria-hidden="true">
<svg viewBox="0 0 20 20"><circle class="anello__fondo" cx="10" cy="10" r="7.5"></circle><circle class="anello__pieno" data-anello cx="10" cy="10" r="7.5" pathLength="100"></circle><path class="anello__segno" data-segno d="M6.6 10.2l2.3 2.3 4.6-4.8" pathLength="100"></path></svg>
</span>
<span class="via__scritte"><span data-via-scritta="riposo">Cancel anyway</span><span data-via-scritta="tieni">Keep holding</span><span data-via-scritta="fatto">Cancelled</span></span>
</button>
</div>
<p class="conferma__nota" data-nota>Hold to confirm</p>
</div>
<!-- done: the date it ends, and the way back -->
<div class="strato strato--fine" data-strato="fine">
<span class="fine__data">
<svg data-cal viewBox="0 0 24 24" aria-hidden="true"><rect x="4" y="5.5" width="16" height="14.5" rx="2.5"></rect><path d="M4 10h16M8.5 3.5v3.5M15.5 3.5v3.5"></path></svg>
<span>Plan ends on Nov 28</span>
</span>
<button class="riprendi" type="button" data-riprendi>Resume</button>
</div>
</div>
</div>
</section>
<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.
34 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 “Cancel plan button” from Animorio and fit it into my siteThe button, the confirmation and the final pill are three layers inside the same white surface. On every change the incoming layer is measured and GSAP takes the surface’s width, height and radius to its size with back.out: it is always the same piece changing shape, not a dialog opening.
The container under the card keeps the height of the open confirmation, measured at start and on every resize: when the button grows, the plan card above does not move by a pixel.
Holding takes a number from 0 to 1 over HOLD seconds, with no curve, and the ring is an SVG circle with pathLength 100 whose stroke-dashoffset goes from 100 to 0. Let go early and another tween takes it back to 0 with power3.out from wherever it had got to.
Each step changes the rest too: Cancel anyway becomes Keep holding, the note underneath changes, the card’s badge goes from Renews to Ends and the icon fades. Resume brings everything back with the same timings.
Cancel anyway uses pointerdown and pointerup with pointer capture and touch-action none, so a sliding finger does not leave the press half done; holding Space or Enter works the same. Inactive layers are inert, and at the first touch the autopilot stops.
| Name | File | Default | What it changes |
|---|---|---|---|
HOLD | script.js | 1.1 | The seconds to hold Cancel anyway to cancel. |
SPRING | script.js | 1.25 | How much the button bounces as it grows and shrinks (1 = none). |
MORPH_TIME | script.js | 0.5 | The seconds of the button turning into the confirmation and back. |
RED | script.js | #e5484d | The red of the filling ring. |
PLAN | script.js | Skerry Pro | The plan’s name. |
END_DATE | script.js | Nov 28 | The day the plan ends. |
On the billing or settings page of an app or a SaaS: cancelling a subscription, a plan, an add-on, leaving a team, without opening a dialog over the page and saying first what you lose.
The same card and the same button, at the box’s width: the confirmation narrows to 32 pixels less than the screen, a finger holds like the mouse and the page does not scroll while holding.
No bounces or movement: the surface changes size at once, layers and labels change with a fade and the ring still fills, because it is the information.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.0 KB; the libraries: GSAP 28 KB.
Tested on 28 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.