
The elastic button
Buttons, Hover, Text
The «Confirm password» field of a sign-up, under the new password one: every dot you type drops under its twin above and, if the character is the same, a thin thread stitches them while the dot above dips by a hair, pulled. A wrong character lands hollow, shakes, and its thread is left hanging and swinging; when the two passwords are the same the threads take the accent colour from the left and a tick draws itself at the end of the field.
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>
<!--
"Confirm password field" 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 confirm password field with the dots stitching together</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">
<!-- two password fields, one above the other: every dot typed in the second one drops under its twin in the
first, and a thin stitch joins them when the two characters are the same -->
<div class="pair" data-pair>
<div class="fld" data-fld="a">
<label class="fld__cap" for="pw-new">New password</label>
<input class="fld__input" id="pw-new" type="password" autocomplete="new-password" spellcheck="false" autocapitalize="off" autocorrect="off" data-input>
<div class="fld__row" aria-hidden="true" data-row><span class="caret" data-caret></span></div>
</div>
<div class="rungs" aria-hidden="true" data-rungs></div>
<div class="fld" data-fld="b">
<label class="fld__cap" for="pw-again">Confirm password</label>
<input class="fld__input" id="pw-again" type="password" autocomplete="new-password" spellcheck="false" autocapitalize="off" autocorrect="off" aria-describedby="pw-note" data-input>
<div class="fld__row" aria-hidden="true" data-row><span class="caret" data-caret></span></div>
<svg class="fld__tick" viewBox="0 0 24 24" aria-hidden="true"><path data-tick d="M6.5 12.6 10.4 16.4 17.6 8.4"/></svg>
</div>
<p class="note" id="pw-note" aria-live="polite"><span class="note__clip"><span class="note__word" data-note>Type it once more</span></span></p>
</div>
</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 “Confirm password field” from Animorio and fit it into my siteUnderneath are two real password inputs (autocomplete new-password, labels, aria-describedby to the line under, which is aria-live): keyboard, pasting and password managers work by themselves. The input’s text and caret are transparent; the script reads the value on every input and draws one dot per character, in a row with a fixed pitch, the same in both fields. So the dot below is always in a column with its twin above, with nothing to measure.
Each place is empty, the same or different. On every key the two passwords are compared character by character and only the place whose state has changed is animated: a thread stitching, one left hanging, one pulling back. The comparison is never shown in writing: only the dots and the threads are seen.
The thread is a one-pixel line growing with scaleY from the top in power3.out; a moment later the dot above drops by 1.2 pixels and comes back with elastic.out, and that is what sells the pull. The wrong thread stops at a third and swings on rotation keyframes that die down: 26, minus 14, 7, minus 3, zero.
When the passwords are the same the threads change colour one after the other, 35 milliseconds apart, each widening on scaleX and coming back, and the tick draws with strokeDashoffset to minus 0.8, a pixel past the end, and back to zero. The line under comes in with the wdth axis from 78 to 100 on back.out, after the old one has left upwards.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #3a5cff | The colour of the focused edge, the caret, the threads once everything matches and the tick. |
PASSWORD | script.js | harbor-1847 | The password already in the first field. |
TYPO_AT | script.js | 4 | The character where the field slips when it types by itself. |
PITCH | script.js | 14 | The pixels from one dot to the next. |
SPRING | script.js | 1 | How springy the dots 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.4 | How many seconds the matching password stays before the field types again by itself. |
AUTO | script.js | true | The field types by itself until someone touches it. |
When signing up to a site or an app, changing a password, accepting an invite to an account: anywhere the password has to be typed twice and it helps to show where it differs without showing it.
The fields take the width of the screen up to 340 pixels; a tap opens the phone’s keyboard. There is no hover, everything else is the same.
The dots, the threads, the tick and the lines fade in and out in place, with no drops, springs or swinging; the caret does not blink.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.4 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.