
The elastic button
Buttons, Hover, Text
The last step of two-factor sign in for an invented account app, Halden, like a Dribbble shot: a graphite card on black with a grain, one pixel edges that catch the light and a single mint accent. The ten recovery codes wait under frosted glass; a tap on Reveal lifts it like a blind and the letters roll and land like a split-flap board. Copy sends the codes flying into the button, Download drops the .txt file, a used code gets crossed out, and the box at the bottom unlocks Continue 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>
<!--
"Recovery codes card" 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 two-factor recovery codes card that flips into view</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the recovery codes card of Halden, an invented account app, at the end of turning on two-factor sign in.
The ten codes wait under a frosted cover; one touch lifts it like a curtain and every letter flips into place
like a split-flap board. Copy sends the codes flying into the button, Download drops the .txt file into its
tray, one code is already used and crossed out, and the box at the bottom unlocks Continue on a spring -->
<div class="wrap" data-wrap>
<section class="card" data-card aria-labelledby="rc-title">
<header class="head">
<span class="badge" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M12 2.8 19 5.6v5.6c0 4.6-3 8.2-7 9.9-4-1.7-7-5.3-7-9.9V5.6l7-2.8Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
<circle cx="12" cy="10.4" r="1.9" stroke="currentColor" stroke-width="1.5"/>
<path d="M12 12.3v3.2" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</span>
<div class="head__txt">
<h1 id="rc-title">Save your recovery codes</h1>
<p>Lost your phone? Each code signs you in once.</p>
</div>
<span class="chip">
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3.5 8.4 6.4 11.2 12.5 5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
2FA on
</span>
</header>
<div class="vault" data-vault>
<ul class="codes" data-codes aria-label="Recovery codes"></ul>
<div class="cover" data-cover>
<button class="reveal" type="button" data-reveal>
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M2.6 12C4.6 7.9 8 5.8 12 5.8s7.4 2.1 9.4 6.2c-2 4.1-5.4 6.2-9.4 6.2s-7.4-2.1-9.4-6.2Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
<circle class="reveal__pupil" cx="12" cy="12" r="2.8" stroke="currentColor" stroke-width="1.5"/>
</svg>
<span>Reveal codes</span>
</button>
<span class="cover__hint">Make sure no one is looking</span>
</div>
<i class="vault__sheen" data-sheen aria-hidden="true"></i>
</div>
<div class="actions">
<button class="act" type="button" data-copy aria-label="Copy codes">
<span class="act__face" data-face><span class="act__icon" aria-hidden="true">
<svg class="i-copy" viewBox="0 0 20 20" fill="none">
<rect x="6.5" y="6.5" width="9.5" height="9.5" rx="2.2" stroke="currentColor" stroke-width="1.4"/>
<path d="M13.2 4.4V4.2A2.2 2.2 0 0 0 11 2H5.2A2.2 2.2 0 0 0 3 4.2V10c0 1.2 1 2.2 2.2 2.2h.2" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
</svg>
<svg class="i-ok" viewBox="0 0 20 20" fill="none">
<path d="M4.5 10.4 8.2 14l7.3-7.6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/>
</svg>
</span>
<span class="act__words"><span class="act__rest">Copy</span><span class="act__done">Copied</span></span></span>
</button>
<button class="act" type="button" data-download aria-label="Download codes as a text file">
<span class="act__face" data-face><span class="act__icon" aria-hidden="true">
<svg class="i-down" viewBox="0 0 20 20" fill="none">
<path class="i-down__arrow" d="M10 3v8.6M6.4 8.2 10 11.8l3.6-3.6" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
<path class="i-down__tray" d="M3.4 12.6v1.6c0 1.2 1 2.2 2.2 2.2h8.8c1.2 0 2.2-1 2.2-2.2v-1.6" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
</svg>
<svg class="i-ok" viewBox="0 0 20 20" fill="none">
<path d="M4.5 10.4 8.2 14l7.3-7.6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/>
</svg>
</span>
<span class="act__words"><span class="act__rest">Download</span><span class="act__done">Saved .txt</span></span></span>
<span class="file" data-file aria-hidden="true">
<svg viewBox="0 0 16 20" fill="none"><path d="M2.5 2.5h7l4 4v11h-11v-15Z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><path d="M9.5 2.5v4h4M5 10.5h6M5 13h6M5 15.5h3.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>
<span>halden-codes.txt</span>
</span>
</button>
</div>
<div class="meta">
<span><b data-left>9</b> of 10 left</span>
<span class="meta__sep" aria-hidden="true">·</span>
<span>Generated 6 Nov 2026</span>
</div>
<footer class="foot">
<label class="tick" data-tick>
<input type="checkbox" data-saved>
<span class="tick__box" aria-hidden="true">
<svg viewBox="0 0 16 16" fill="none"><path d="M3.6 8.3 6.6 11.2 12.4 5.1" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/></svg>
</span>
<span class="tick__words">I've saved these codes</span>
</label>
<button class="go" type="button" data-go disabled>
<span class="go__glow" aria-hidden="true"></span>
<span class="go__words">Continue</span>
<svg class="go__arrow" viewBox="0 0 20 20" fill="none" aria-hidden="true"><path d="M4 10h11M11 5.8 15.2 10 11 14.2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
</footer>
<div class="flyers" data-flyers aria-hidden="true"></div>
</section>
</div>
<p class="sr" aria-live="polite" data-live></p>
</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.
31 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 “Recovery codes card” from Animorio and fit it into my siteThe codes are built by the script, letter by letter: each letter is a span one line tall with hidden overflow, and the real letter sits inside. The dash stays still. While the glass is down, each window shows a random letter from the codes' alphabet (without 0, O, 1 and I, which get mixed up).
The frosted glass is a veil with backdrop-filter over the well; to lift it GSAP takes its clip-path from inset(0 0 0 0) to inset(0 0 100% 0), so its lower edge rises. The moment each row starts is worked out from the blind's duration and the row's position, from the last row to the first, so the letters start rolling right when the edge uncovers them.
Each letter has its own timeline: FLIPS short steps, in each a random letter comes in from above with yPercent and a little transparency, while a one pixel line across the middle of the window (a CSS variable animated by GSAP) shows the split of the flaps. The last step sets the right letter on a spring and the line goes away. Letters in the same row start 18 thousandths apart and take one, two or three more turns depending on their place.
Every settle uses the same function: a damped oscillator, 1 minus e to the minus d times t times the cosine of 2.5 pi times t. At t equal to 1 the cosine is zero, so the spring lands exactly in place at the end of the tween after passing the mark only once: the one pixel overshoot. SPRING changes the damping.
For Copy the script measures where each code sits and where the button's icon sits inside the card; a copy of each code leaves its place and heads to the icon with two separate tweens, x with power2.in and y with back.in, which together draw an arc. The Download file lives inside the button, which hides its overflow: it comes in from the top, settles and drops out of the bottom, so it never covers the words around.
| Name | File | Default | What it changes |
|---|---|---|---|
CODES | script.js | K7QD-M4XP 9HTR-2WVB PL3N-8KEF Z6YC-QJ5R 4MBW-T9HS RX8E-VN2K C5JP-7LDA W2FU-K6QM 8TGH-3ZYN E9VS-P4CJ | The ten codes, split by spaces. |
USED | script.js | 4 | Which code is already used and crossed out, from 1 to 10; 0 for none. |
FLIPS | script.js | 7 | How many random glyphs each letter rolls through before it lands. |
FLAP | script.js | 0.045 | How many seconds one roll of a letter lasts. |
CURTAIN | script.js | 0.95 | How many seconds the frosted glass takes to lift. |
SPRING | script.js | 1 | How springy every settle is: 0.5 calm, 2 very bouncy. |
AUTO | script.js | true | Reveals, copies, downloads and continues by itself until someone touches the card. |
In the last step of turning on two-factor sign in for an app, an online bank, a password manager, a crypto wallet or any account: when the user has to save the recovery codes before moving on. The glass keeps the codes away from prying eyes, Copy and Download put them somewhere safe and the box makes people pause before Continue.
On the phone the card takes almost the whole width and every size follows the screen's height too, so it fits whole even in the short preview box; the 2FA on tag hides to leave room for the title. A tap instead of a click on every button. The rest is the same.
Nothing moves: the glass fades away and the codes appear already in place, the line over the used code is already drawn, the buttons change word and icon with a fade, with no flying codes and no falling file, and the box and Continue light up with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 11 KB; the libraries: GSAP 28 KB.
Tested on 6 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.
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.