Skip to content
animorio
IT
Back to the library

Layover flight itinerary

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

A flight with one stop drawn on a line: the plane is dragged along the route and with it change the local time, the sentence saying where you are and the leg lit in the list. At the stop, a short one, the row turns amber, “Tight” appears and a small bar shows how much of the 55 minutes goes on the walk between the two gates.

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>
<!--
  "Layover flight itinerary" 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>Layover itinerary</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 flight with one stop: the plane can be dragged along the route, the clock and the line below follow it,
         and at the stop the short connection shows how much of it the walk to the next gate takes -->
    <section class="lo" data-lo aria-labelledby="lo-title">
      <header class="lo__head">
        <div>
          <h1 id="lo-title">Milan to Tokyo</h1>
          <p class="lo__sub">1 stop, 17 h 05 in all</p>
        </div>
        <p class="lo__clock"><b data-clock>10:35</b><i data-day></i></p>
      </header>

      <div class="lo__route" data-route role="slider" tabindex="0" aria-label="Moment of the journey" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
        <svg viewBox="0 0 300 62" aria-hidden="true">
          <path class="lo__rail" d="M20 26H96M124 26H280"></path>
          <path class="lo__rail lo__rail--stop" d="M96 26h28"></path>
          <line class="lo__done" data-done x1="20" y1="26" x2="20" y2="26"></line>
          <path class="lo__tick" d="M20 19v14M110 19v14M280 19v14"></path>
          <g data-plane><path class="lo__plane" d="M-8 0c0-1 1-1.600 2.400-1.600h3.200l3-5.400h2.400l-1.600 5.400h3.600c2 0 3 .700 3 1.600s-1 1.600-3 1.600H1.400l1.600 5.400H.600l-3-5.400h-3.200C-7 1.600-8 1-8 0Z"></path></g>
          <text x="20" y="52" text-anchor="start">MXP</text><text x="110" y="52" text-anchor="middle">HEL</text><text x="280" y="52" text-anchor="end">NRT</text>
        </svg>
      </div>
      <p class="lo__now"><span data-now>Boarding in Milan</span></p>

      <ul class="lo__legs">
        <li class="lo__leg" data-leg="0"><b>Milan to Helsinki</b><span>10:35 to 14:40</span><i>3 h 05</i></li>
        <li class="lo__leg lo__leg--stop" data-leg="1"><b>Helsinki <em data-tight>Tight</em></b><span class="lo__walk"><u data-walk></u></span><i>55 min</i></li>
        <li class="lo__leg" data-leg="2"><b>Helsinki to Tokyo</b><span>15:35 to 11:40</span><i>13 h 05</i></li>
      </ul>
      <span class="lo__say" data-say aria-live="polite"></span>
    </section>

    <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.

28 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 “Layover flight itinerary” 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 pale grey, a white card: at the top “Milan to Tokyo”, “1 stop, 17 h 05 in all” and on the right the time in large type, “10:35”. Below, the route on one line: three ticks with the codes MXP, HEL and NRT, two grey legs and between them a short stretch dashed in amber, the stop; a small blue plane sits at departure. Further down the sentence “Boarding in Milan” and three rows: “Milan to Helsinki, 10:35 to 14:40, 3 h 05”, “Helsinki, Tight, 55 min”, “Helsinki to Tokyo, 15:35 to 11:40, 13 h 05”. Drag the plane, or any point of the route, and the line behind it turns blue, the time runs, the sentence updates (“Flying to Helsinki, 1 h 15 to go”) and the leg in progress lights up in the list. At the stop the plane gets smaller, the Helsinki row turns amber, the “Tight” label bounces and the small bar fills by a third: the minutes on foot between gates. Beyond it, towards Tokyo, “+1” appears beside the time and at the end “Landed in Tokyo, the next day”.

How it works

A single moment

The state is one number: the minutes since take-off. Dragging, the arrow keys and a click on a row change only that, with a short tween.

From the moment to the drawing

Two lists say where each stretch starts on the drawing and at which minute: between two points you interpolate, and the same rule backwards gives the minute under the finger.

All in SVG, through attributes

The plane moves by writing the transform attribute, the done line by stretching x2: no GSAP transform on SVG elements, no pivots to get wrong.

The stop

When the moment enters the middle stretch the row changes class, the label bounces and the small bar scales to WALK divided by 55.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#3565f6The colour of the plane and of the route already flown.
WARNscript.js#e8890cThe colour of the tight stop.
WALKscript.js18The minutes on foot between the stop’s two gates (the stop lasts 55 minutes).
FOLLOWscript.js0.5In how many seconds the plane reaches the pointed spot.
SPRINGscript.js1How much the stop’s label bounces: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer drags the plane along the whole route and returns to the stop.

Try them in the Playground

When to use it

In the results and the summary of a flight site or app, on the “my trip” page, in the booking email. It also suits trains with a change, coaches, shipments with a sorting stop.

On phones

The same card, 312 pixels wide at most: the route is dragged with the finger (touch-action none on the route only), the three rows are tapped to jump to that leg and the times stay on one line.

With reduced motion

The plane goes straight to the pointed spot, without gliding; the time, the sentence and the lit row change at the same moment and the stop’s small bar appears already filled. The demo does not move by itself.

Pitfalls

  • Flights, times and gates are made up; the time shown is interpolated between each leg’s departure and arrival, so mid-flight it mixes two time zones: a real app picks which zone to show.
  • The route is a real slider (role=slider): the arrows move by 15 minutes, with Shift by an hour, Home and End go to the two ends, and aria-valuetext gives time and sentence.
  • The stop on the drawing is wider than its real time, or 55 minutes out of 17 hours would not show: that is why the position has to be computed stretch by stretch.
  • The tight stop is not told by amber alone: there is the “Tight” label and the sentence with the minutes left.
  • The pointer has to be captured while dragging, or leaving the route stops the plane.

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 23 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