
The elastic button
Buttons, Hover, Text
The switch between real and test data in a payments dashboard: turning it on, the striped yellow band “Test mode. No real money moves.” comes in at the top of the card, the API key rewrites itself character by character from pk_live to pk_test, the volume and the payment count run down to the test figures and the card’s green turns yellow.
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>
<!--
"Test mode switch" 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>Test mode switch</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">
<!-- the Test / Live switch of a payments dashboard: the striped test band comes in,
the API key rewrites itself character by character and the figures turn to test data -->
<i class="frame" data-frame aria-hidden="true"></i>
<section class="tm" data-tm data-mode="live" aria-label="Payments">
<div class="tm__band" data-band aria-hidden="true"><span class="tm__stripes" data-stripes></span><span class="tm__note">Test mode. No real money moves.</span></div>
<div class="tm__in">
<header class="tm__head">
<span class="tm__brand"><strong>Corvid Pay</strong><span class="tm__env"><span data-outenv>Live data</span></span></span>
<button class="tm__switch" type="button" role="switch" aria-checked="false" data-switch><span class="tm__label">Test mode</span><span class="tm__track"><i class="tm__knob" data-knob></i></span></button>
</header>
<p class="tm__stat"><span class="tm__cap">Gross volume, today</span><strong>$<span data-outvolume>48,210.50</span></strong><span class="tm__sub"><b data-outcount>312</b> payments</span></p>
<div class="tm__key"><span class="tm__cap">Publishable key</span><code data-outkey>pk_live_9fK2aW7cQx41</code></div>
</div>
</section>
<span class="live" aria-live="polite" data-live></span>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.
23 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Test mode switch” from Animorio and fit it into my siteThe knob widens by a few pixels as it leaves, reaches the other side without overshooting and there squashes and settles on a spring. The band is a block zero tall at the top of the card: GSAP takes its height to thirty pixels, and the stripes inside slide while it opens.
A number goes from zero to one: it says how many characters of the new key are already in place. Those after it are written at random on every other frame, with the underscores always still.
Live and test data are two objects with the same fields. On the change, volume and payments count from one to the other, and a single attribute on the card changes the colour of everything.
| Name | File | Default | What it changes |
|---|---|---|---|
TEST | script.js | #ffb020 | The colour of test mode. |
LIVE | script.js | #36d399 | The colour of live data. |
LIVE_VOLUME | script.js | 48210.5 | Today’s volume with live data, in dollars. |
TEST_VOLUME | script.js | 1234 | Today’s volume with test data. |
SCRAMBLE | script.js | 0.9 | How many seconds the key takes to rewrite itself. |
SPRING | script.js | 1 | How much the knob and the band bounce. |
In the dashboard of a payments, email, SMS or shipping service, where developers move between the test environment and the real one; in any app with a demo mode or a preview that must be told apart from real data.
The card is at most 318 pixels wide and about 245 tall with the band open; the big figure and the gaps are sized on height too. The switch is 36 pixels tall with its label, which is part of the button: it is thumb-sized and nothing depends on hover.
The knob changes side at once, the band is open or closed immediately, figures and key take their new value with no counting and no scramble. The demo’s pointer does not start.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.4 KB; the libraries: GSAP 28 KB.
Tested on 28 November 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.
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.