
The elastic button
Buttons, Hover, Text
The penalties of a football match in a card on black: two teams, five boxes each and the score. Whoever keeps count taps “Goal” or “Miss” for the side kicking: the box fills with a tick or takes a cross, both drawn, the score rolls and the turn passes to the other. As soon as one side can no longer be caught the series closes and the winner is written at the top.
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>
<!--
"Penalty shootout" 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>Penalty shootout</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 penalties of a match: two teams with five boxes each, Goal or Miss for whoever kicks, the box filling
with a drawn tick or cross, the score counting and the series closing as soon as it is decided -->
<section class="ps" data-ps aria-label="Penalty shootout">
<header class="ps__head"><strong>Penalties</strong><span class="ps__turn"><span data-outturn>Rovers to kick</span></span></header>
<div class="ps__teams" data-teams></div>
<div class="ps__acts" data-acts>
<button type="button" class="ps__btn ps__btn--goal" data-kick="goal">Goal</button>
<button type="button" class="ps__btn ps__btn--miss" data-kick="miss">Miss</button>
<button type="button" class="ps__btn ps__btn--new" data-new tabindex="-1" aria-hidden="true">New shootout</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.
15 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 “Penalty shootout” from Animorio and fit it into my siteEach side keeps its kicks taken and its goals. One number says who kicks: after every kick it passes to the other.
The kick fills the next box of the side whose turn it is: an attribute says goal or miss and decides colour and edge, and the path of the tick or the cross is drawn with stroke-dashoffset.
After every kick it checks whether one side has more goals than the other can still reach with the penalties it has left. If so, it ends there, even before the tenth kick.
The verdict rolls in at the top, the two buttons leave and the one to start again takes their place.
| Name | File | Default | What it changes |
|---|---|---|---|
GOAL | script.js | #3ecf8e | The colour of a penalty scored. |
MISS | script.js | #ff6b5a | The colour of a penalty missed. |
KICKS | script.js | 5 | How many penalties each side takes. |
SPRING | script.js | 1 | How much the boxes and the score bounce. |
LOOP | script.js | true | Left alone, the demo’s pointer plays a series to the end and starts again. |
In the app of an amateur tournament, a football school or someone following a match live, to keep count of the penalties from the touchline; the same row of boxes in turns carries the sets of a tennis match, the attempts in a jumping event or the answers of a team quiz.
The card is at most 348 pixels wide and about 240 tall, and narrows with the screen: long names truncate with an ellipsis, the boxes stay 24 pixels. The two buttons are 44 pixels tall and half the card wide, easy to tap without looking.
No bounces, shakes or rolling figures: the box is filled at once with the tick or the cross already drawn, the score and the text at the top change in one step. 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 30 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.