
The elastic button
Buttons, Hover, Text
One field, one gesture, in the clean style of product interface pieces: the corner radius in the inspector of a design app, scrubbed sideways as in the real tools. As you drag, the digits roll, a thin ruler slides in underneath and the square above rounds its corners on a spring; pulled hard, the number widens and leans, and past the limit the field resists like a rubber band.
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>
<!--
"Corner radius scrubber" 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 corner radius counter you drag sideways, with a sliding ruler</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>
<!-- one field of a design tool's inspector: drag sideways on it and the radius changes,
the digits roll, a thin ruler slides underneath and the shape above follows -->
<div class="inspector" data-inspector>
<svg class="shape" data-shape viewBox="0 0 140 140" aria-hidden="true">
<path class="shape__fill" data-shape-fill></path>
<path class="shape__corner" data-shape-corner></path>
</svg>
<div class="field" data-field role="spinbutton" tabindex="0" aria-label="Corner radius" aria-valuemin="0" aria-valuemax="48" aria-valuenow="12">
<span class="field__face" data-face></span>
<svg class="field__icon" data-icon viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 12.5V8a4.5 4.5 0 0 1 4.5-4.5h4.5"></path></svg>
<span class="field__num" data-num></span>
<span class="field__unit">px</span>
<svg class="field__hint field__hint--l" data-hint-l viewBox="0 0 8 10" aria-hidden="true"><path d="M5.5 2 2.5 5l3 3"></path></svg>
<svg class="field__hint field__hint--r" data-hint-r viewBox="0 0 8 10" aria-hidden="true"><path d="M2.5 2l3 3-3 3"></path></svg>
</div>
<div class="ruler" data-ruler aria-hidden="true">
<svg class="ruler__tape" data-tape><path class="ruler__ticks" data-ticks></path><path class="ruler__major" data-major></path></svg>
<span class="ruler__mark"></span>
</div>
</div>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true">
<path class="ghost__arrow" d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path>
<path class="ghost__scrub" transform="translate(-6.5 -8.5)" d="M2.5 12h19M6.5 8 2.5 12l4 4M17.5 8l4 4-4 4"></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.
15 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 “Corner radius scrubber” from Animorio and fit it into my siteOn pointerdown the field captures the pointer (setPointerCapture) and remembers the starting x and value; on every pointermove the raw value is the start plus the movement divided by PX_PER_STEP, rounded and clamped between 0 and the maximum. That way the hand can leave the field without losing the gesture.
The square’s radius, the ruler’s position, the field’s offset past the limits and the strength of the pull are four springs damped just under critical, computed in one gsap.ticker with the step capped at 1/30 of a second; once they all rest the ticker removes itself and nothing is redrawn.
Past the limit the field moves by one minus e to the minus effort, times 14 pixels: it follows the hand less and less and never goes further. The ruler runs a couple of ticks past its end on the same curve, and on release everything springs back to the true value.
The pointer’s speed, smoothed on every move and decayed when the hand stops, becomes the strength of the pull: on Mona Sans’s wdth axis the number goes from 100 to 124 and leans a few degrees with the gesture. It is a spring too, so it straightens with a small settle.
Each digit sits in a one-line window with hidden overflow: the old one leaves up or down depending on the direction, the new one comes in from the other side with back.out. While dragging the roll is shorter, so the digits keep up with a fast hand.
| Name | File | Default | What it changes |
|---|---|---|---|
START | script.js | 12 | The radius at the start, in pixels. |
MAX | script.js | 48 | The largest radius: past it, the field resists like a rubber band. |
PX_PER_STEP | script.js | 4 | How many pixels of dragging for one pixel of radius. |
TICK | script.js | 6 | The gap between two ticks of the ruler. |
STRETCH | script.js | 1 | How much the number widens and leans when pulled hard: 0 never, 2 twice as much. |
SPRING | script.js | 1 | How springy the shape and the return are: 0.4 calm, 2 very bouncy. |
ACCENT | script.js | #3b5bfd | The colour of the corner, the ruler mark and the flash at the limits. |
AUTO | script.js | true | The field uses itself until someone touches it. |
For the number fields of an editor, a configurator or a settings panel (radius, opacity, spacing, size): you adjust it with a gesture, without typing, and the ruler tells you where you are.
On the phone you drag with a finger (touch-action: none on the field, so the page does not scroll); the square takes its size from the shorter side of the screen and the field from the width. There is no hover, everything else is the same.
No springs, leaning or rubber band: the square takes the new radius at once, the digits and the ruler change with a fade.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.3 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.