
The elastic button
Buttons, Hover, Text
One button, one gesture, in the simple style of product interface pieces: the white «Upvote» pill of a launch page, with an arrow drawn in a thin line and the vote count; on tap the arrow rises a few pixels leaving a thin trail under it, fills from the bottom with the accent colour and comes back down a pixel too far; in the count only the digit that changes rolls and the label becomes «Upvoted». On a second tap the colour drains out and the digit rolls back down.
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>
<!--
"Upvote 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 Upvote button with the arrow that rises</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 button, one gesture: the thin arrow rises, fills from the bottom and the count ticks up a digit -->
<button class="vote" type="button" data-vote aria-pressed="false" aria-label="Upvote, 128 votes">
<span class="vote__body" data-body>
<span class="vote__mark" aria-hidden="true">
<svg class="vote__icon" viewBox="4 2 24 28">
<defs>
<clipPath id="vote-fill-clip"><rect data-level x="0" y="32" width="32" height="32"/></clipPath>
</defs>
<path class="vote__trail" data-trail d="M16 30.5V22.5"/>
<g data-arrow>
<path class="vote__fill" clip-path="url(#vote-fill-clip)" d="M16 8.2 24.4 20.4H7.6Z"/>
<path class="vote__arrow" d="M16 8.2 24.4 20.4H7.6Z"/>
</g>
</svg>
</span>
<span class="vote__label" data-label aria-hidden="true">
<span class="vote__word" data-word="off">Upvote</span>
<span class="vote__word" data-word="on">Upvoted</span>
</span>
<span class="vote__rule" aria-hidden="true"></span>
<span class="vote__count" data-count aria-hidden="true"></span>
</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.
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 “Upvote button” from Animorio and fit it into my siteThe arrow is the same triangle drawn twice: on top the thin outline, underneath the accent fill cut by a clipPath holding a rectangle. The fill rises by animating the rectangle’s y attribute from the base to the tip: the colour grows from the bottom with no masks or gradients.
The arrow group rises by LIFT pixels with power3.out in a quarter of a second and goes back to zero with back.out: the ease takes it a pixel below its place and settles it. Below, a short line draws with strokeDashoffset as the arrow rises and pulls away upwards by going to minus its length: that is the trail.
The number is a row of slots, one per digit, each a grid with its digits in the same cell. The old and new numbers are compared right-aligned and only the slot that changes rolls: the old digit leaves upwards, the new one comes in from below with back.out, and the slot springs to the new digit’s width (Mona Sans digits are not all the same width). Several digits start from the right, five hundredths apart.
The old word rises and leaves before the new one arrives, coming up from below with the wdth axis at 75 and the weight at 420 and landing at 100 and 560 with back.out. The pill’s border and tint are two CSS variables tweened by GSAP, so the shadow stays the CSS one.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #ff5a1f | The colour that fills the arrow and the count. |
LABEL_OFF | script.js | Upvote | The word before voting. |
LABEL_ON | script.js | Upvoted | The word once the vote is in. |
COUNT | script.js | 128 | The votes before yours: with 199 or 999 more digits roll. |
LIFT | script.js | 5 | How many pixels the arrow rises on the vote. |
SPRING | script.js | 1 | How springy the press and the landing 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.2 | How many seconds each state stays when the button plays by itself. |
AUTO | script.js | true | The button plays the gesture by itself until someone touches it. |
For the vote on a product launch page, a forum, a ranking of ideas or feature requests: the rising arrow and the ticking digit say by themselves that the vote was counted.
On the phone the pill, the arrow and the words take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.
The arrow does not move: the colour fills it with a fade, digits and words swap in place, the pill takes its new width at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 5.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.