Skip to content
animorio
IT
Back to the library

Lineup formation

SVG, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 5.9 KBGSAP 28 KBFreeDownload the zip

A football team’s lineup on a pitch drawn as a diagram, on black: eleven circles with shirt numbers and the dotted lines of the three units. Picking 4-3-3, 4-4-2 or 3-5-2 the players glide to their new places, the ones nearest their own goal first, and the unit lines follow them. Pointing at a player colours his circle and below you read number, name and role in that shape.

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>
<!--
  "Lineup formation" 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>Lineup formation</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">
    <!-- a football lineup: a pitch drawn as a diagram, the eleven shirt numbers gliding to their places as the
         formation changes, the lines of the three units following them and the player pointed at named below -->
    <section class="fm" data-fm aria-label="Lineup">
      <header class="fm__head"><strong>Lineup</strong><span class="fm__team">Rovers</span></header>
      <div class="fm__seg" role="group" aria-label="Formation" data-seg>
        <i class="fm__pick" data-pick aria-hidden="true"></i>
        <button type="button" class="fm__opt" data-shape="0"><span>4-3-3</span></button>
        <button type="button" class="fm__opt" data-shape="1"><span>4-4-2</span></button>
        <button type="button" class="fm__opt" data-shape="2"><span>3-5-2</span></button>
      </div>
      <svg class="fm__pitch" viewBox="0 0 300 186" data-pitch aria-label="Pitch" role="group">
        <g class="lines" aria-hidden="true">
          <rect x="1" y="1" width="298" height="184" rx="12"></rect>
          <line x1="150" y1="1" x2="150" y2="185"></line>
          <circle cx="150" cy="93" r="24"></circle>
          <rect x="1" y="45" width="42" height="96"></rect>
          <rect x="257" y="45" width="42" height="96"></rect>
          <rect x="1" y="70" width="16" height="46"></rect>
          <rect x="283" y="70" width="16" height="46"></rect>
        </g>
        <g class="units" data-units aria-hidden="true"><path></path><path></path><path></path></g>
        <g data-players></g>
      </svg>
      <p class="fm__note"><span class="fm__clip"><span data-outnote>4 defenders · 3 midfielders · 3 forwards</span></span></p>
    </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 “Lineup formation” 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: “Lineup” and on the right “Rovers”. Below, three options in a row, “4-3-3”, “4-4-2” and “3-5-2”. Then the pitch, seen from above and drawn in thin lines: the edge, the halfway line, the centre circle and the two boxes. On it, eleven light circles with shirt numbers, the goalkeeper on the left and the others in three rows; every row is joined by a lime dotted line. At the bottom a box: “4 defenders · 3 midfielders · 3 forwards”. On entering the players come out of the goal and go to their places. Moving the pointer onto number 10 turns the circle lime and enlarges it, and the box says “10 · Vidal · Attacking midfielder”. Picking “4-4-2” slides the tile and the players move one after the other, settling slightly: 7 and 11 drop into midfield, 10 goes up beside 9, and the three dotted lines are redrawn following them. With “3-5-2” numbers 2 and 11 spread out on the flanks.

How it works

Every shape is a map

For every shirt number: where it stands along the pitch and across it, in which unit and with which role. Three shapes, three maps.

The players are SVG groups

Every player is a group with circle and number, put in place by writing the transform attribute from two animated numbers.

Changing shape

Every player goes to the new coordinates with a small overshoot; they set off in order of distance from their own goal, so the movement travels up the pitch.

The unit lines

On every frame the players of the same unit are sorted across the pitch and a dotted line joins them: when a player changes unit the line picks him up.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#c6f24eThe colour of the player pointed at and of the unit lines.
MOVEscript.js0.9How many seconds the players take to change place.
STAGGERscript.js0.04The delay between one player and the next, in seconds.
LOOPscript.jstrueLeft alone, the demo’s pointer points at three players, tries the three shapes and starts again.

Try them in the Playground

When to use it

On a match page, in the app of a team or a tournament, in a fantasy football game or on a coach’s board; the same diagram with circles changing place carries the seating of an event, the layout of a room or a ward’s shifts.

On phones

The card is at most 348 pixels wide and about 340 tall, and narrows with the screen: the pitch is an SVG scaling as a whole, and the circles stay large enough to tap. On a phone a tap on a player points at him and another lets go.

With reduced motion

No gliding players: on changing shape they are in their places at once with the unit lines already redrawn, and the player pointed at changes colour without a bounce. The demo’s pointer does not start.

Pitfalls

  • The players are buttons inside the SVG: they take keyboard focus and carry an aria-label with number, name and role, which changes with the shape.
  • Position and enlargement live in the same transform attribute, written by the script: leaving the scale to CSS would make it start from the corner of the pitch.
  • The shirt numbers are data, not decorative numbering: they stay the same in every shape, only where they stand changes.
  • Team, names and roles are invented.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 5.9 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 animations