
The elastic button
Buttons, Hover, Text
The brand color panel of an editor, in the clean style of real product interface pieces: a saturation and brightness square to drag, the hue bar, six saved swatches and the hex field. The handle grows when you grab it, the hex digits roll one by one, the sample headline and button change color live and the contrast label says whether text stays readable (AA, AAA). A swatch sends the handle flying to its place on a spring; Copy copies the color and draws a check.
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>
<!--
"Brand color picker" 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 brand color picker</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 brand color panel of a design tool: drag the saturation and brightness square, slide the hue,
pick a saved swatch, and the hex rolls digit by digit while the preview and the contrast follow -->
<section class="panel" data-panel aria-label="Brand color">
<header class="panel__head">
<div>
<p class="panel__title">Brand color</p>
<p class="panel__sub">Tintwell <span>/ Design tokens</span></p>
</div>
<p class="badge" data-badge aria-live="polite">
<span class="badge__roll" data-badge-roll><span data-badge-text>AA</span></span>
<span class="badge__ratio" data-ratio>4.6:1</span>
</p>
</header>
<div class="sv" data-sv role="slider" tabindex="0" aria-label="Saturation and brightness" aria-valuetext="">
<div class="sv__white"></div>
<div class="sv__black"></div>
<div class="thumb thumb--sv" data-sv-thumb><span class="thumb__ring" data-sv-ring></span></div>
</div>
<div class="hue" data-hue role="slider" tabindex="0" aria-label="Hue" aria-valuemin="0" aria-valuemax="360">
<div class="thumb thumb--hue" data-hue-thumb><span class="thumb__ring" data-hue-ring></span></div>
</div>
<div class="swatches" data-swatches role="listbox" aria-label="Saved colors"></div>
<div class="hexrow">
<div class="hex" data-hex>
<span class="hex__hash">#</span>
<span class="hex__digits" data-digits></span>
</div>
<button class="copy" type="button" data-copy aria-label="Copy hex">
<svg viewBox="0 0 24 24" aria-hidden="true">
<g data-copy-sheets>
<rect x="8.5" y="8.5" width="11" height="11" rx="2.4"></rect>
<path d="M15.5 5.6V5.4c0-1.3-1-2.4-2.4-2.4H6.4C5 3 4 4 4 5.4v6.7c0 1.3 1 2.4 2.4 2.4h.2"></path>
</g>
<path class="copy__check" data-check d="M5.5 12.6 9.8 16.8 18.6 7.6"></path>
</svg>
<span class="copy__roll"><span class="copy__label" data-copy-label>Copy</span><span class="copy__label copy__label--done" data-copy-done>Copied</span></span>
</button>
</div>
<div class="preview" aria-label="Preview">
<p class="preview__title" data-preview-title>Ship it brighter</p>
<span class="preview__btn" data-preview-btn>Get started</span>
</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.
24 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 “Brand color picker” from Animorio and fit it into my siteThe color lives in an object with hue, saturation and value: the square writes saturation and value, the bar writes hue, and a render function works out red, green and blue from there, the hex, the position of both knobs, the square’s background and the preview’s CSS variables.
Each digit is a 1ch box holding the current character; when it changes the new one comes in from below (or from above if the value falls) and the old one leaves the other way. While dragging the digits update at most every 70 milliseconds: they roll, they don’t buzz.
Clicking a swatch doesn’t jump: a back.out tween takes saturation and value from where they are to the swatch’s with a small overshoot, and the hue turns the short way round the circle (never more than 180 degrees).
The color’s relative luminance (the WCAG formula) gives its ratio against white and against black: the button takes whichever text reads better and the label says AAA from 7, AA from 4.5, AA Large from 3, Low below.
| Name | File | Default | What it changes |
|---|---|---|---|
START | script.js | #5b5bd6 | The brand color it starts from. |
SWATCHES | script.js | #5b5bd6,#e5484d,#f76b15,#30a46c,#0090ff,#111113 | The saved swatches, comma separated. |
ROLL | script.js | 0.22 | How many seconds a hex digit takes to roll. |
FLY | script.js | 0.7 | How many seconds the handle takes to fly to a swatch. |
GRAB | script.js | 1.35 | How much the handle grows when you grab it. |
PAUSE | script.js | 0.8 | How many seconds the autopilot waits between gestures. |
For the brand settings of a design tool, a site builder or a design system, an app’s theme customization, anywhere a color is picked and you need to know right away whether text stays readable.
The panel takes the width of the box, the square gets shorter with the screen height (24vh, between 84 and 168 pixels) and the knobs drag with a finger: touch does what the mouse does.
No flights and no rolling digits: the color changes at once, the swatch ring and the Copy check appear without a spring and the drawn pointer stays hidden.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 8.1 KB; the libraries: GSAP 28 KB.
Tested on 26 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.