
The elastic button
Buttons, Hover, Text
The roll call of a class, in a card on white: one row per pupil with three options, “Here”, “Late” and “Away”, and at the top a single bar split by share, green for present, amber for late, red for absent, striped for those still to mark. With every tap the coloured pill appears or slides under the option, the bar re-proportions with a bounce and the counts roll. “Mark all here” marks present everyone not yet marked, one row after another.
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>
<!--
"Class attendance" 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>Class attendance</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">
<!-- the roll call of a class: one row per pupil with Here, Late and Away, a bar at the top split in three
that re-proportions at every tap, the counts rolling, and Mark all here -->
<section class="ra" data-ra aria-label="Class attendance">
<header class="ra__head">
<div class="ra__what"><strong>Year 4B roll call</strong><span>Wednesday morning</span></div>
<button type="button" class="ra__all" data-all>Mark all here</button>
</header>
<div class="ra__sum">
<div class="ra__bar" aria-hidden="true"><i class="ra__b ra__b--here" data-b="here"></i><i class="ra__b ra__b--late" data-b="late"></i><i class="ra__b ra__b--away" data-b="away"></i><i class="ra__b ra__b--none" data-b="none"></i></div>
<p class="ra__counts"><span class="ra__c ra__c--here"><b class="ra__clip"><span data-n="here">0</span></b> here</span><span class="ra__c ra__c--late"><b class="ra__clip"><span data-n="late">0</span></b> late</span><span class="ra__c ra__c--away"><b class="ra__clip"><span data-n="away">0</span></b> away</span><span class="ra__c ra__c--none"><b class="ra__clip"><span data-n="none">5</span></b> to mark</span></p>
</div>
<ul class="ra__list">
<li class="ra__pupil" data-pupil data-name="Ada Lund"><strong>Ada Lund</strong><div class="ra__seg" role="radiogroup" aria-label="Ada Lund"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
<li class="ra__pupil" data-pupil data-name="Tom Baker"><strong>Tom Baker</strong><div class="ra__seg" role="radiogroup" aria-label="Tom Baker"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
<li class="ra__pupil" data-pupil data-name="Mei Sato"><strong>Mei Sato</strong><div class="ra__seg" role="radiogroup" aria-label="Mei Sato"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
<li class="ra__pupil" data-pupil data-name="Zoe Klein"><strong>Zoe Klein</strong><div class="ra__seg" role="radiogroup" aria-label="Zoe Klein"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
<li class="ra__pupil" data-pupil data-name="Omar Haddad"><strong>Omar Haddad</strong><div class="ra__seg" role="radiogroup" aria-label="Omar Haddad"><i data-thumb></i><button type="button" role="radio" aria-checked="false" data-v="here">Here</button><button type="button" role="radio" aria-checked="false" data-v="late">Late</button><button type="button" role="radio" aria-checked="false" data-v="away">Away</button></div></li>
</ul>
</section>
<span class="live" aria-live="polite" data-live></span>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.
40 values to change
Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI
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 “Class attendance” from Animorio and fit it into my siteEvery row keeps a single word: here, late, away or nothing. Counts and bar come from counting the rows at every tap.
The four parts of the bar sit in a row with `flex`: the script only animates their `flex-grow` up to the number of pupils, and the browser does the proportions.
A CSS variable on the control says the state’s colour: the pill slides and changes tint on the way, with no need for three different pills.
“Mark all here” only touches those not marked yet: a late or an absence already set stays where it is.
| Name | File | Default | What it changes |
|---|---|---|---|
HERE | script.js | #1f9d6b | The colour of those present. |
LATE | script.js | #d98a0b | The colour of late arrivals. |
AWAY | script.js | #d8452f | The colour of those absent. |
CASCADE | script.js | 0.07 | How many seconds between rows when “Mark all here” runs. |
LOOP | script.js | true | Left alone, the demo’s pointer marks everyone here and then a late and an absence. |
In a school’s electronic register, in an app for courses, gyms or after-school clubs, in the sign-in sheet of a workshop or a volunteer shift; the same three-way list carries the answers to an invitation (yes, maybe, no), the state of deliveries or the check of a list of things.
The card is at most 352 pixels wide and about 325 tall. Each row is 40 pixels tall; the three options are 52 pixels wide each (48 under 350) and 24 tall inside a 28-pixel pill. Long names are cut with an ellipsis.
No snaps, bounces or cascade: the pills appear in place, the bar and the counts change in one step and “Mark all here” marks everyone at once. The demo’s pointer does not start.
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 2 December 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.
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.