
The needle gauge
Counters, Physics, SVG
NewFree
The Sign in button with a pin tumbler lock cut in half inside it, drawn like a technical drawing: five spring loaded pin stacks at the wrong heights. Pressed, the key slides in from the left and its teeth lift the pins one by one as they pass, the springs squeeze and stretch; when every gap reaches the shear line a thin light runs along the line, the plug turns and the button says Signed in. With the wrong key one pin stays across the line, the plug shakes and says Wrong key.
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>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The key lock button</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist@5.3.0/index.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<main class="stage">
<!-- the button: a pin tumbler lock cut in half, drawn like a technical drawing inside the pill. Pressed, the key
slides in from the left, its teeth lift the five pin stacks one after the other, and when every gap meets the
shear line the plug turns. The small button under it tries a key that is cut wrong -->
<div class="lock" data-lock>
<button class="lock__btn" type="button" aria-describedby="lock-status" data-btn data-autoclic>
<!-- three layers: the still housing, the plug's cut face (it only moves when the plug turns) and the moving
parts, so a frame of the key sliding repaints only the light drawing on top -->
<svg class="lock__art" viewBox="0 0 390 120" aria-hidden="true" data-art="base"></svg>
<svg class="lock__art lock__art--face" viewBox="0 0 390 120" aria-hidden="true" data-art="face"></svg>
<svg class="lock__art" viewBox="0 0 390 120" aria-hidden="true" data-art="move"></svg>
<span class="lock__label" data-label>
<span class="lock__word" data-word>Sign in</span>
<svg class="lock__icon" viewBox="0 0 24 24" aria-hidden="true" data-icon><path d="M5 12h13M13 6.5l5.5 5.5-5.5 5.5"/></svg>
</span>
</button>
<button class="lock__wrong" type="button" data-wrong>Try wrong key</button>
<p class="sr" id="lock-status" aria-live="polite" data-live></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.
28 values to change
With the Animorio connector, Claude Code takes it from here, guide included, and fits it into your project. Paste this request:
Take “The key lock button” from Animorio and fit it into my siteThe measures are those of a pin tumbler cylinder: the shear line, the plug, the keyway and five chambers. Everything else comes from CUTS, the height of the key’s edge under each pin: each brass pin is as long as it must be for its top to reach the line exactly with the right key. The wrong key has a single cut that differs, and its pin goes past the line.
The key’s edge is a function: at each distance from the tip, the lowest of the tip’s ramp and, for each cut, the bottom of the cut plus a 45 degree climb. The same profile draws the key (sampled every pixel into an SVG path) and holds up the pins.
Each stack is a spring pushing down, with a preload, and some damping. Its floor is the key’s edge under the pin, sampled over the whole rounded tip: the pin never goes through it, and if the edge rises fast it throws the pin up at its speed. So the teeth make the pins jump and the springs bring them down. Eight small steps a frame, with the key sliding on between steps, and a stop when the spring is closed solid.
A spring in a technical drawing is a row of slanted strokes: dark in front, lighter behind. The script works it out every frame from its length, between the end of the chamber (a drill point, at 118 degrees) and the top of the driver pin, and the coils close up and open out by themselves.
With the key home the script checks that every gap is on the line within a pixel. The light is a gradient running along the line with a white head, plus a blurred copy. The plug’s turn flattens its cut face towards its axis by the cosine of the angle, while the edge of the key shows, as tall as the sine; the hatched face is an SVG layer of its own that turns as a picture, and the hatching is not repainted while the key slides.
| Name | File | Default | What it changes |
|---|---|---|---|
INSERT | script.js | 1.5 | The seconds the key takes to slide all the way in. |
PIN | script.js | [2400, 30] | The pin springs: how hard they push the pins down, and how damped they are. |
CUTS | script.js | [16, 8, 20, 12, 6] | The key’s cuts: how high its edge is under each pin, from 2 to 22 (the pins are made to match). |
TURN | script.js | 90 | How far the plug turns once the pins line up, in degrees. |
SIGNED | script.js | 2.6 | The seconds it stays signed in before the key comes out. |
WRONG | script.js | false | true: the main button tries the wrong key too, to see the lock jam. |
For the sign in of an app about security (a password manager, a bank, a file vault) or for the last step of a login form. It stands alone on a light background; on a real site the wrong key button goes, and WRONG, or your own failed login, shows Wrong key.
The pill scales to the width of the screen (at 390 pixels it is 358 wide) with all of the drawing. A finger resting on it brings the key to the keyway, lifting it slides the key in; the wrong key button is big enough for a thumb.
The key does not slide: it appears already in, with a fade, the pins already in place. The line lights up with a fade, the plug is shown turned without an animation, the words change with a fade; with the wrong key it does not shake, the red light stops at the wrong pin.
GSAP 3.15.0, Geist (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 9.8 KB; the libraries: GSAP 28 KB.
Tested on 5 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.
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.