Skip to content
animorio
IT
All components

Penalty shootout

Counters, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.4 KBGSAP 28 KBFreeDownload the zip

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.

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>
<!--
  "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>

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.

15 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Penalty shootout” 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 black, a dark rounded card: “Penalties” and on the right “Rovers to kick”. Below, two rows: “Rovers” and “Harbour FC”, each with five empty boxes and a large zero on the right; the row of the side kicking has a lighter ground. At the bottom two buttons: “Goal”, green, and “Miss”, outlined. Tapping “Goal” turns the Rovers’ first box green with a small bounce and the tick is drawn inside, the zero rolls into one, the lighter ground moves to the other side’s row and at the top the text rolls into “Harbour FC to kick”. With “Miss” the box takes a red edge, shakes and the cross is drawn inside. When, after eight kicks, Rovers are four to two with a single penalty left to the others, the series stops: at the top “Rovers win 4–2” in green, their four swells for a moment, the other side’s name dims and the two buttons give way to “New shootout”.

How it works

Two sides, one turn

Each side keeps its kicks taken and its goals. One number says who kicks: after every kick it passes to the other.

The box

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.

When it is decided

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 end

The verdict rolls in at the top, the two buttons leave and the one to start again takes their place.

Values to change

NameFileDefaultWhat it changes
GOALscript.js#3ecf8eThe colour of a penalty scored.
MISSscript.js#ff6b5aThe colour of a penalty missed.
KICKSscript.js5How many penalties each side takes.
SPRINGscript.js1How much the boxes and the score bounce.
LOOPscript.jstrueLeft alone, the demo’s pointer plays a series to the end and starts again.

Try them in the Playground

When to use it

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.

On phones

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.

With reduced motion

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.

Pitfalls

  • Goal and miss are not told apart by colour alone: one is a filled box with a tick, the other an empty box with a cross.
  • The series ends level after five penalties each: sudden death is not here, and in a real app it has to be added one pair at a time.
  • Every row gives the side, the goals and the kicks in its aria-label; an aria-live region gives every kick, the score and whose turn it is.
  • There is no “undo last kick”: from the touchline people hit the wrong button, and a real product needs it.
  • Teams and result are invented.

Libraries

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.

Testing

Tested on 30 November 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 components