
The elastic button
Buttons, Hover, Text
The lock screen of a bank app, on very light grey, in the style of real product interface pieces: ten round keys that really press down with a light ripple, four dashes that fill from the bottom instead of the usual dots. A wrong passcode shakes the dashes in red and drains them from the last; the right one slides them together into the body of a padlock, the shackle draws itself on top, clicks, springs open and turns green: «Welcome 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>
<!--
"Passcode keypad" 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 passcode keypad that unlocks the app</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>
<!-- the lock screen of an invented bank app: ten round keys that really press down with a light ripple, four dashes
that fill from the bottom, a wrong passcode that shakes and drains them, and the right one that pulls the four
dashes together into the body of a padlock whose shackle draws itself and springs open -->
<section class="pad" data-pad aria-labelledby="titolo">
<header class="pad__head">
<svg class="pad__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 18.5h16M5.5 18.5V10M18.5 18.5V10M9.5 18.5V10M14.5 18.5V10M3.5 9.2 12 4.5l8.5 4.7Z"></path></svg>
<p class="pad__brand">Marlbank</p>
</header>
<div class="pad__titles">
<h1 class="pad__title" id="titolo"><span class="roll" data-title>Enter your passcode</span></h1>
<p class="pad__sub" aria-live="polite"><span class="roll" data-sub>Personal account · Elin</span></p>
</div>
<svg class="code" data-code viewBox="0 -8 136 54" role="img" aria-label="Passcode, 0 of 4 digits">
<g data-dashes>
<g class="dash" data-dash="0"><rect class="dash__track" x="2" y="26" width="26" height="12" rx="6"></rect><rect class="dash__fill" data-fill x="2" y="26" width="26" height="12" rx="6"></rect></g>
<g class="dash" data-dash="1"><rect class="dash__track" x="38" y="26" width="26" height="12" rx="6"></rect><rect class="dash__fill" data-fill x="38" y="26" width="26" height="12" rx="6"></rect></g>
<g class="dash" data-dash="2"><rect class="dash__track" x="74" y="26" width="26" height="12" rx="6"></rect><rect class="dash__fill" data-fill x="74" y="26" width="26" height="12" rx="6"></rect></g>
<g class="dash" data-dash="3"><rect class="dash__track" x="110" y="26" width="26" height="12" rx="6"></rect><rect class="dash__fill" data-fill x="110" y="26" width="26" height="12" rx="6"></rect></g>
</g>
<g class="lock" data-lock>
<path class="lock__shackle" data-shackle d="M57 24V15.5a11 11 0 0 1 22 0V24"></path>
<rect class="lock__body" data-body x="48" y="23" width="40" height="21" rx="6.5"></rect>
<path class="lock__hole" data-hole d="M68 31.5v4.5"></path>
</g>
</svg>
<p class="pad__msg" data-msg aria-live="assertive"></p>
<div class="keys" data-keys>
<button class="key" type="button" data-key="1"><span class="key__face"><b>1</b><i> </i></span></button>
<button class="key" type="button" data-key="2"><span class="key__face"><b>2</b><i>ABC</i></span></button>
<button class="key" type="button" data-key="3"><span class="key__face"><b>3</b><i>DEF</i></span></button>
<button class="key" type="button" data-key="4"><span class="key__face"><b>4</b><i>GHI</i></span></button>
<button class="key" type="button" data-key="5"><span class="key__face"><b>5</b><i>JKL</i></span></button>
<button class="key" type="button" data-key="6"><span class="key__face"><b>6</b><i>MNO</i></span></button>
<button class="key" type="button" data-key="7"><span class="key__face"><b>7</b><i>PQRS</i></span></button>
<button class="key" type="button" data-key="8"><span class="key__face"><b>8</b><i>TUV</i></span></button>
<button class="key" type="button" data-key="9"><span class="key__face"><b>9</b><i>WXYZ</i></span></button>
<button class="key key--text" type="button" data-forgot>Forgot?</button>
<button class="key" type="button" data-key="0"><span class="key__face"><b>0</b><i> </i></span></button>
<button class="key key--text" type="button" data-del aria-label="Delete">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 5.5h10a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H9L3 12Z"></path><path d="m11.5 9.5 5 5M16.5 9.5l-5 5"></path></svg>
</button>
</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.
41 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 “Passcode keypad” from Animorio and fit it into my siteEvery key has a face separate from the button: on pointerdown GSAP takes it to a slightly smaller scale and one pixel down in 0.08 s, and on release it comes back with back.out. Two ripples, a dark one and a light one in soft-light, start from the touch point and grow as they fade.
The dashes are SVG rectangles with a grey track and a fill on top, scaled vertically from the bottom: back.out takes it just past full and the dash jumps 2 units and comes back on a spring.
The dash group runs a set of x keyframes with a shrinking amplitude (1, 0.85, 0.6, 0.38, 0.18), then the fills drain from the last with a reversed stagger.
Each dash slides to the centre of the row by its own distance; when they overlap the padlock lights up, its body starting at the size of a dash and growing with back.out on the x, y, width and height attributes. The shackle is a path drawn with strokeDashoffset, then it lifts and swings around its left leg with svgOrigin.
A timeline with repeatRefresh takes the drawn pointer to the keys reading their real positions each time and presses with the same functions as a finger. At the first real touch it stops, and starts again after eight quiet seconds.
| Name | File | Default | What it changes |
|---|---|---|---|
PIN | script.js | 2580 | The right passcode that unlocks the app, four digits. |
ACCENT | script.js | #111113 | The colour of the filled dashes and of the closed padlock. |
OPEN_COLOR | script.js | #1f9d55 | The colour of the padlock as it opens. |
PRESS | script.js | 0.9 | How far a pressed key goes down (1 = not at all). |
SHAKE | script.js | 9 | How many pixels the dashes shake with a wrong passcode. |
PAUSE | script.js | 1 | The seconds the autopilot waits between one gesture and the next. |
For the lock screen of a banking, payments or health app, the second step of a sign-in, the confirmation of a transfer, or anywhere a short code is asked for with a keypad.
The keys are sized from both the width and the height of the screen, between 38 and 62 pixels, so the whole keypad fits even the phone’s short preview box; below 460 pixels of height the small letters on the keys go away. The ripple starts where the finger lands.
The padlock is already open and green, with the welcome and the keypad dimmed: no ripples, shakes or slides; Esc or a tap on the padlock locks it again, and digits appear without motion.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.8 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.