
The elastic button
Buttons, Hover, Text
The timer of an online exam: the time left in large rolling digits, the twenty questions as a row of segments (done, flagged, the current one) and the “Next question” and “Flag” buttons. In the last minute everything turns orange and the “Last minute” label appears; once the questions are done the button becomes “Hand in exam”, and on handing in the timer stops, turns green and says how much time was to spare.
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>
<!--
"Exam timer" 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>Exam timer</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 timer of an online exam: the time left counting down, the questions answered and flagged,
the last minute changing colour, and handing in with the tick -->
<section class="ex" data-ex data-state="run" aria-label="Exam timer">
<header class="ex__head">
<span class="ex__course">Biology 201 · Midterm</span>
<span class="ex__badge" data-badge aria-hidden="true"><svg viewBox="0 0 14 14"><circle cx="7" cy="7" r="5.200"></circle><path d="M7 4.300V7l1.900 1.300"></path></svg>Last minute</span>
</header>
<div class="ex__clock" data-clock role="timer" aria-label="Time left">
<span class="ex__d"><span data-outd>0</span></span><span class="ex__d"><span data-outd>1</span></span><span class="ex__colon" aria-hidden="true">:</span><span class="ex__d"><span data-outd>0</span></span><span class="ex__d"><span data-outd>8</span></span>
</div>
<p class="ex__sub"><span data-outsub>Time left</span></p>
<div class="ex__qs" data-qs aria-hidden="true"></div>
<div class="ex__meta">
<span class="ex__count"><span data-outcount>17 of 20 answered</span></span>
<span class="ex__flags"><svg viewBox="0 0 14 14" aria-hidden="true"><path d="M3.500 12.300V2.200M3.500 2.800h6.600l-1.500 2.400 1.500 2.400H3.500"></path></svg><span data-outflags>1 flagged</span></span>
</div>
<div class="ex__actions">
<button class="ex__main" type="button" data-next><span class="ex__face" data-face="next">Next question</span><span class="ex__face" data-face="hand">Hand in exam</span><span class="ex__face" data-face="busy">Handing in</span><span class="ex__face" data-face="done"><svg viewBox="0 0 16 16" aria-hidden="true"><path data-tick pathLength="1" d="m3.600 8.400 2.900 2.900 5.900-6.600"></path></svg>Handed in</span></button>
<button class="ex__flag" type="button" data-flag aria-pressed="false"><svg viewBox="0 0 14 14" aria-hidden="true"><path d="M3.500 12.300V2.200M3.500 2.800h6.600l-1.500 2.400 1.500 2.400H3.500"></path></svg>Flag</button>
</div>
</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.
26 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 “Exam timer” from Animorio and fit it into my siteOn every frame the time left is the start minus the seconds elapsed on GSAP’s clock: no counter going down by one, so it never falls behind when the browser tab sleeps. The page is touched only when the second changes.
The four digits are four equal-width cells, each with its own window. The new text is compared with the one in place: only what changes rolls, nearly always the last digit, and every ten seconds the one before it.
Running, last minute and handed in are one attribute on the card that changes a single variable: the ground, the edge, the shadow, the digits and the current question all take their colour from it.
The twenty segments are written by the script. On every change they get three classes (done, current, flagged) and a spring on their height: the one just closed jumps and settles, the new one rises.
| Name | File | Default | What it changes |
|---|---|---|---|
WARN | script.js | #d9770b | The colour of the last minute and of the flagged questions. |
GOOD | script.js | #128a5e | The colour of the handed-in exam. |
START | script.js | 68 | How many seconds are left when the timer starts. |
LAST | script.js | 60 | Below how many seconds the last-minute warning starts. |
SPEED | script.js | 1 | How many timer seconds pass in one real second. |
SPRING | script.js | 1 | How much digits, segments and buttons bounce. |
LOOP | script.js | true | Left alone, the demo’s pointer answers, hands in and then starts again. |
At the top of the page of a timed exam, test or quiz of an online school or a university; the same timer with its final warning carries a hiring assessment, a language test, an auction about to close or a basket held for a few minutes.
The card is at most 336 pixels wide and about 270 tall, and narrows with the screen: the question segments share the room by themselves. The two buttons are 46 pixels tall; on a very short screen the digits get smaller.
The timer still counts, but digits and texts change without rolling, the segments change colour without jumping and the last-minute label fades in. The tick is already drawn. 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 6.5 KB; the libraries: GSAP 28 KB.
Tested on 29 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.
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.