
The elastic button
Buttons, Hover, Text
One button, one gesture, in the simple style of product interface pieces: the priority button of a task in a project app, with three thin bars, the word and the P key; each tap raises the priority by one bar, which fills from the bottom going a pixel past the top, and the word rolls (Low, Medium, High); past High the three bars close together and become the orange Urgent square with an exclamation mark that draws itself.
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>
<!--
"Priority button" 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 Priority button with the bars that rise</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">
<!-- one button, one gesture: each tap raises the priority of a task by one bar; past High the bars close into Urgent -->
<button class="prio" type="button" data-prio aria-label="Priority: no priority. Press to raise it">
<span class="prio__body" data-body>
<span class="prio__mark" aria-hidden="true">
<svg class="prio__icon" viewBox="0 0 24 24">
<g data-bars>
<g class="prio__bar" data-bar><rect class="prio__track" data-track/><rect class="prio__fill" data-fill/></g>
<g class="prio__bar" data-bar><rect class="prio__track" data-track/><rect class="prio__fill" data-fill/></g>
<g class="prio__bar" data-bar><rect class="prio__track" data-track/><rect class="prio__fill" data-fill/></g>
</g>
<g data-urgent>
<rect class="prio__urgent" x="3" y="3" width="18" height="18" rx="4.5"/>
<path class="prio__bang" data-bang d="M12 7.4V13.2"/>
<rect class="prio__dot" data-dot x="10.85" y="15.3" width="2.3" height="2.3" rx="0.6"/>
</g>
</svg>
</span>
<span class="prio__label" data-label aria-hidden="true"></span>
<span class="prio__rule" aria-hidden="true"></span>
<kbd class="prio__key" data-key aria-hidden="true">P</kbd>
</span>
</button>
</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.
14 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 “Priority button” from Animorio and fit it into my siteEach bar is an SVG group with two rectangles: underneath the grey track, on top the black fill. GSAP does not tween the attributes but two numbers per bar, the height h and the fill f, and on every frame one function redraws y, height and rx of both rectangles: this way the corner radius stays right even when the bar is a tick two pixels tall.
The fill rises to 1 + OVERSHOOT / h, exactly OVERSHOOT pixels above the track whatever the bar’s height, in a quarter of a second with power2.out, then goes back to 1 on an elastic spring. Meanwhile the bar group rises a pixel and a half and falls back: the hop.
Past High each bar slides towards the centre by four fifths of its distance, narrows on the x axis and disappears in a tenth of a second; right after, the orange square comes in from 0.45 to 1 with back.out, starting turned by ten degrees. The stroke of the exclamation mark draws with strokeDashoffset, the dot arrives on a spring, and the square’s rx beats once from 4.5 to 5.6 like a stamp settling.
The five words sit in the same grid cell; the old one leaves before the new one arrives, coming in with the wdth axis at 75 and the weight at 420 and landing at 100 and 560 with back.out. The slot springs to the new word’s width, measured at its final shape; the direction of the roll follows the priority’s.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #f2541b | The colour of Urgent: the square, the word and the warm border. |
LEVELS | script.js | No priority, Low, Medium, High, Urgent | The five words, from none to urgent, comma separated. |
START | script.js | 0 | The level it starts on: 0 no priority, 4 urgent. |
OVERSHOOT | script.js | 1 | How many pixels the fill goes past the top of the bar before settling. |
SPRING | script.js | 1 | How springy the press and the bars 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 | 1.3 | How many seconds each level stays when the button goes round by itself. |
AUTO | script.js | true | The button goes round by itself until someone touches it. |
For the priority of a task, an issue or a ticket in a project management app, a to-do list or the toolbar of a team document: the rising bars tell the level without reading the word, and Urgent stands out from across the room.
On the phone the button, the bars and the words take their size from the screen (clamp on the shorter side); there is no hover and the P key stays as a sign of the shortcut, everything else is the same.
Nothing moves: the bars take their height at once and the black fills them with a fade, the Urgent square fades in and out, the words swap in place.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.5 KB; the libraries: GSAP 28 KB.
Tested on 1 November 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.