Skip to content
animorio
IT
Back to the library

Poll votes drop

Physics, SVGGSAP, CSS onlyMediumCompressed weight: Demo 8.8 KBGSAP 28 KBFreeDownload the zip

The weekly poll of a made-up app, Quorum, in Bencho’s clean style: every vote is a small round token that drops from above into the glass column of its answer, bounces and piles up on the others; yours falls in the accent colour, the percentages above the columns roll digit by digit and at the end the floor opens and the columns empty out.

The code

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 votes drop" 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>Votes that drop into the poll columns</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 weekly poll of a made-up team app, Quorum: every vote is a small round token that drops into the column of
         its answer, bounces and piles up; yours falls in the accent colour -->
    <section class="poll" data-poll aria-label="Quorum weekly poll">
      <header class="poll__head">
        <div class="brand">
          <svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><rect x="2.5" y="9" width="3.6" height="8.5" rx="1.2"/><rect x="8.2" y="4" width="3.6" height="13.5" rx="1.2"/><rect x="13.9" y="11.5" width="3.6" height="6" rx="1.2"/></svg>
          <span>Quorum</span>
        </div>
        <span class="poll__tag">Weekly poll</span>
      </header>
      <h1 class="poll__q">How do you start your workday?</h1>
      <p class="poll__meta"><span class="roll" data-total></span> votes<span class="poll__sep"></span><span data-state>Pick one</span></p>

      <div class="board" data-board>
        <svg class="board__svg" data-svg viewBox="0 0 400 236" preserveAspectRatio="xMidYMax meet" aria-hidden="true">
          <defs>
            <linearGradient id="glass" x1="0" x2="1">
              <stop offset="0" stop-color="#fff" stop-opacity=".9"/>
              <stop offset=".5" stop-color="#fff" stop-opacity=".2"/>
              <stop offset="1" stop-color="#fff" stop-opacity=".7"/>
            </linearGradient>
            <radialGradient id="shine" cx=".35" cy=".3" r=".75">
              <stop offset="0" stop-color="#fff" stop-opacity=".55"/>
              <stop offset=".45" stop-color="#fff" stop-opacity="0"/>
            </radialGradient>
          </defs>
          <g data-cols></g>
          <g data-tokens></g>
          <g data-rims></g>
        </svg>
        <div class="pcts" data-pcts></div>
      </div>

      <div class="answers" data-answers role="radiogroup" aria-label="Answers"></div>
    </section>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></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>

Playground

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.

18 values to change

Or ask your AI assistant for it

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 votes drop” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a warm white background sits the weekly poll card of Quorum, a made-up app for teams: the mark with its three bars, the question How do you start your workday?, the number of votes and, below, four glass columns with their answers, Coffee first, Inbox zero, Plan the day and Just start. On arrival the walls of the columns draw themselves and the floors close, then the others’ votes start falling: every vote is a round token, each a slightly different grey, that comes down from above with gravity, enters the column of its answer, bounces on the floor or on the other tokens, squashes a little on impact and settles; the columns fill in proportion to the votes, while the total and the percentages above the columns roll digit by digit. A drawn pointer passes over the answers, the walls of the column under it darken, and it presses Plan the day: the answer squashes and springs back, the check draws itself, the outline of the column lights up in blue and your token, blue, drops into the column and bounces among the others; the percentages and the total update and the line says Thanks, you voted. After a moment the floors of the columns open from the centre one after another, the tokens fall out and disappear, the percentages go back to zero, the floors close again and the poll starts over. It really works too: you vote by tapping an answer, and if you pick another the old token fades and the new one drops.

How it works

A drawing that doesn’t depend on pixels

Columns and tokens live in an SVG with a 400 by 236 viewBox and preserveAspectRatio meet: the physics works in these units, so the same pile forms the same way on the computer and in the phone box, and nothing has to be recomputed on resize. The percentages, which are HTML, sit over the column centres as a percentage of the width.

Physics written by hand

Each token has a position and a velocity. A single gsap.ticker accumulates time and takes fixed steps of a two hundred and fortieth of a second: gravity, the walls of its column, a floor with a bounce that dies out under a certain speed, and the collisions between tokens in the same column, which push apart by half the overlap each and exchange the impulse along the normal, with a touch of sideways friction.

The squash on impact

When a token hits the floor or another token hard enough it gets a squash proportional to the speed, which fades quickly: the drawing widens and lowers it while keeping it resting on its bottom, with a translate, a scale and a translate back in the same transform.

Rolling digits

Each digit is a strip from 0 to 9 inside a window one line tall, and GSAP moves it with yPercent; the digits start from right to left, six hundredths apart, with back.out. The rounded percentages always add up to a hundred, using the largest remainder method.

The floor that opens

The floor of each column is a separate line: it shrinks from the centre with scaleX and, a moment later, the physics stops holding that column’s tokens. A clipPath cuts the tokens at the floor line, so as they fall they disappear instead of passing over the answers. The randomness is a seeded generator, so every loop falls the same way.

Values to change

NameFileDefaultWhat it changes
QUESTIONscript.js'How do you start your workday?'The poll question.
ACCENTscript.js'#2f5bea'The colour of your vote, the chosen column and the check mark.
GRAVITYscript.js1700The gravity that makes the tokens fall, in drawing units per second squared.
BOUNCEscript.js0.3How much a token bounces when it hits the floor or another token.
TOKENSscript.js44How many tokens fall for the others’ votes, split between the columns in proportion.
DROP_SPREADscript.js3The seconds over which the others’ votes fall.
HOLDscript.js2.6The seconds the poll stays full before emptying through the floor.

Try them in the Playground

When to use it

For a poll in a team app, on a blog or on an event page, when voting should feel like a real gesture: whoever votes sees their token fall among the others’ and understands at a glance where the majority is.

On phones

The same animation with adapted sizes: the columns are sized on the height of the screen and the drawing scales as a whole, so the tokens fall and pile up the same way; you vote by tapping an answer.

With reduced motion

No falling or bouncing: the piles form already settled and fade in, your token appears in its place, the digits change without rolling and at the end the tokens fade away instead of dropping through the floor.

Pitfalls

  • With the physics step tied to frames the tokens passed through each other when a frame was late: small fixed steps and a time accumulator capped at a tenth of a second.
  • Without the clipPath the tokens falling through the open floor passed over the answers below the columns.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.8 KB; the libraries: GSAP 28 KB.

Testing

Tested on 27 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

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.

All animations