
The elastic button
Buttons, Hover, Text
A poll card in a community, on very light grey: a question and four answers in whole rows. Pick one and every row becomes a bar that fills from the left to its share on a spring, the percentages roll, the pick gets a drawn tick and the purple border, the most voted turns bold and the total grows by one; Change vote takes it all back.
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>
<!--
"Poll with results" 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 poll that reveals its results</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">
<!-- a poll in a community app: four answers in whole rows. Pick one and every row becomes a bar that fills to its
share on a spring, the percentages roll, the pick gets a drawn tick and the accent border, the leader turns
bold and the total grows by one. Change vote runs it back -->
<section class="card" data-card aria-labelledby="q">
<header class="card__top">
<span class="badge" aria-hidden="true">D</span>
<div class="who">
<span class="who__name">Driftline</span>
<span class="who__meta">Poll from <b>Mara Ilves</b> · 3h</span>
</div>
</header>
<h1 class="q" id="q" data-question>Where do you prototype first?</h1>
<div class="opts" role="radiogroup" aria-labelledby="q" data-opts>
<button class="opt" type="button" role="radio" aria-checked="false" data-opt="0">
<span class="opt__fill" data-fill></span>
<span class="opt__row">
<span class="opt__label">Paper sketches</span>
<svg class="opt__tick" viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 12.6l4.1 4 8.9-9.2"></path></svg>
<span class="opt__pct" data-pct aria-hidden="true"></span>
</span>
</button>
<button class="opt" type="button" role="radio" aria-checked="false" data-opt="1">
<span class="opt__fill" data-fill></span>
<span class="opt__row">
<span class="opt__label">In the design tool</span>
<svg class="opt__tick" viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 12.6l4.1 4 8.9-9.2"></path></svg>
<span class="opt__pct" data-pct aria-hidden="true"></span>
</span>
</button>
<button class="opt" type="button" role="radio" aria-checked="false" data-opt="2">
<span class="opt__fill" data-fill></span>
<span class="opt__row">
<span class="opt__label">Straight in code</span>
<svg class="opt__tick" viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 12.6l4.1 4 8.9-9.2"></path></svg>
<span class="opt__pct" data-pct aria-hidden="true"></span>
</span>
</button>
<button class="opt" type="button" role="radio" aria-checked="false" data-opt="3">
<span class="opt__fill" data-fill></span>
<span class="opt__row">
<span class="opt__label">On a whiteboard</span>
<svg class="opt__tick" viewBox="0 0 24 24" aria-hidden="true"><path d="M5.5 12.6l4.1 4 8.9-9.2"></path></svg>
<span class="opt__pct" data-pct aria-hidden="true"></span>
</span>
</button>
</div>
<footer class="card__foot">
<p class="total" aria-live="polite"><span data-total>1,284</span> votes · <span data-days>2 days left</span></p>
<button class="change" type="button" data-change tabindex="-1">Change vote</button>
</footer>
</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.
31 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 “Poll with results” from Animorio and fit it into my siteEach answer is a button with role radio inside a radiogroup: the whole row is clickable and the arrows move between them. The bar is a full size child with scaleX from 0 to its share and transform-origin on the left, so GSAP moves the bar and CSS keeps the row’s border and background still.
The percentages use the largest remainder method: everything is rounded down and the missing points go to the highest remainders, so the four figures always add up to 100, even after your vote.
Each digit is a column from 0 to 9 inside a window one line tall; GSAP moves the column with yPercent, starting from zero for the percentages and from the previous digit for the total, so only the last one moves in the total.
The bars start 60 thousandths apart with back.out, the percentages come in with them, the tick is drawn with stroke-dashoffset, the leader’s bold arrives halfway through the fill with a transition of the variable font’s weight, and Change vote appears last.
| Name | File | Default | What it changes |
|---|---|---|---|
QUESTION | script.js | Where do you prototype first? | The poll’s question. |
VOTES | script.js | 231, 591, 347, 115 | The votes of the four answers before yours. |
DAYS_LEFT | script.js | 2 | How many days the poll has left. |
FILL_TIME | script.js | 0.9 | How long the bars take to fill, in seconds. |
BOUNCE | script.js | 1.15 | How far the bar goes past and comes back. |
STAGGER | script.js | 0.06 | The delay between one bar and the next. |
ACCENT | script.js | #6d5efc | The colour of the pick, the tick and the border. |
For polls in a community, a social app, a newsletter or a team tool, to ask for an opinion inside an article or for quick votes in an app.
The card takes the width with a margin, rows and type are sized on the height too with clamp and min, so the four bars, the total and Change vote fit in the box. A tap votes like a click.
No springs or rolling: the bars fade in already at their share, the percentages show their number at once and the tick appears.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.0 KB; the libraries: GSAP 28 KB.
Tested on 25 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.