Skip to content
animorio
IT
Back to the library

Truck fleet map

SVG, HoverGSAP, CSS onlyAdvancedCompressed weight: Demo 13 KBGSAP 28 KBFreeDownload the zip

The fleet tracking dashboard of Larkhaul, a made-up haulage company: a clean map with thin roads and a river, four trucks seen from above, cab and trailer, moving along their routes. The selected truck is 4.20 metres tall and its route goes under a 3.8 metre bridge: the bridge is flagged, the rest of the old route fades into dashes, the new one draws itself around the bridge and the ETA rolls to the new time. With the pointer on a truck its route lights up and the card changes; a click keeps it selected.

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>
<!--
  "Truck fleet map" 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>Larkhaul, the live fleet map with a route around a low bridge</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>
  <!-- the live fleet panel of Larkhaul, a made-up haulage company: a clean map with thin roads and a river, four
       trucks seen from above driving their routes. The selected one is 4.20 m tall and its route crosses a 3.8 m
       bridge: the bridge is flagged, the old route fades into dashes, the new one draws itself around it and the ETA
       rolls to the new time. Hover a truck and its route lights up and the card changes; click it to select it -->
  <main class="stage" data-stage>
    <section class="panel" data-panel aria-label="Larkhaul live fleet">
      <header class="bar">
        <div class="brand">
          <svg class="brand__mark" viewBox="0 0 24 24" aria-hidden="true">
            <rect x="1" y="1" width="22" height="22" rx="7" />
            <path d="M6.5 16.5 L11 7.5 L13.2 12 L15.2 9.6 L17.5 16.5" />
          </svg>
          <span class="brand__name">Larkhaul</span>
          <span class="brand__sub">Fleet</span>
        </div>
        <div class="bar__right">
          <span class="bar__count"><b>4</b> trucks on the road</span>
          <span class="bar__time">13:52</span>
        </div>
      </header>

      <div class="body">
        <div class="map" data-map>
          <svg class="map__svg" viewBox="0 0 640 440" preserveAspectRatio="xMidYMid slice" aria-hidden="true" data-svg>
            <defs>
              <filter id="soft" x="-50%" y="-50%" width="200%" height="200%">
                <feGaussianBlur stdDeviation="1.6" />
              </filter>
              <filter id="badge-shadow" x="-40%" y="-60%" width="180%" height="240%">
                <feDropShadow dx="0" dy="2" stdDeviation="2.4" flood-color="#2a2118" flood-opacity="0.16" />
              </filter>
            </defs>
            <rect class="ground" x="-40" y="-40" width="720" height="520" />
            <g data-blocks></g>
            <path class="river river--bank" data-river d="M-40 232 C 110 254 210 176 330 196 S 540 250 680 208" />
            <path class="river" d="M-40 232 C 110 254 210 176 330 196 S 540 250 680 208" />
            <path class="river river--sheen" d="M-40 232 C 110 254 210 176 330 196 S 540 250 680 208" />
            <g data-roads></g>
            <g data-bridges></g>
            <g data-base></g>
            <g data-hi></g>
            <g data-marks></g>
            <g data-flag></g>
            <g data-trucks></g>
          </svg>
          <div class="map__scale" aria-hidden="true"><span class="map__ruler"></span>500 m</div>
          <p class="map__hint">Hover a truck, click to select</p>
        </div>

        <aside class="card" data-card aria-live="polite">
          <div class="card__top">
            <span class="card__label">Truck</span>
            <span class="chip" data-chip>
              <svg class="chip__icon" viewBox="0 0 16 16" aria-hidden="true">
                <g data-icon="route"><path d="M3 12.5 C 3 8.5 13 9.5 13 4.5" /><path d="M10.6 4.2 L13 3.2 L13.9 5.7" /></g>
                <g data-icon="bridge"><path d="M1.5 6 H14.5" /><path d="M2.5 13 V8.6 C 4 7.4 6 6.8 8 6.8 C 10 6.8 12 7.4 13.5 8.6 V13" /><path d="M8 9.6 V13" /></g>
                <g data-icon="detour"><path d="M3 13 V8 C 3 6 4 5 6 5 H12" /><path d="M10 2.8 L12.4 5 L10 7.2" /></g>
                <g data-icon="done"><path d="M3.4 8.4 L6.6 11.4 L12.8 4.6" /></g>
              </svg>
              <span data-chip-text>On route</span>
            </span>
          </div>
          <div class="card__main" data-main>
            <p class="plate" data-plate>LK 24 HAR</p>
            <p class="driver"><span class="avatar" data-initials>MH</span><span data-driver>Maren Holt</span></p>
            <dl class="stats">
              <div class="stat" data-stat-height><dt>Height</dt><dd data-height>4.20 m</dd></div>
              <div class="stat"><dt>Load</dt><dd data-load>18.4 t</dd></div>
              <div class="stat stat--cargo"><dt>Cargo</dt><dd data-cargo>Paper rolls</dd></div>
              <div class="stat stat--left"><dt>Left</dt><dd data-km>30.5 km</dd></div>
              <div class="stat stat--low" data-stat-low><dt>Lowest bridge on route</dt><dd data-low>3.8 m</dd></div>
            </dl>
          </div>
          <div class="eta">
            <span class="eta__label">ETA</span>
            <span class="eta__row"><span class="roll" data-eta aria-label="14:20"></span><span class="eta__delta" data-delta>+12 min</span></span>
          </div>
          <div class="trip" aria-hidden="true"><span class="trip__fill" data-bar></span></div>
          <p class="note" data-note>Depot to Dock 7, via Mill Lane</p>
        </aside>
      </div>
    </section>
  </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.

44 values to change

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 “Truck fleet map” 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 a sand coloured page, the warm white Larkhaul Fleet panel: at the top the brand, «4 trucks on the road» and the time. On the left the map: beige blocks with lanes between them, white roads with an edge, a grey blue river running across and four bridges, each with its clearance written next to it. On it, four trucks seen from above, each with a ribbed trailer and a cab with a windscreen, and a soft shadow that always falls on the same side: on a corner the cab turns before the trailer and the truck bends like a real articulated rig. On the right the card of the truck on show: the status, the licence plate on a small plate, the driver with initials, height, load, cargo and the kilometres left, the big ETA and a thin bar for the trip. The selected truck, LK 24 HAR, is 4.20 metres tall and leaves the depot for Dock 7: its route is lit in orange. Halfway, the Mill Lane bridge, 3.8 metres high, is flagged by a small card with a drawing of the bridge and its clearance, which pops in on a spring, and an orange bar closing the road; the status turns to «Low bridge ahead» and the height on the card is tinted. Right after, the old route blinks, turns dashed and fades, the new one draws itself from the point where they part to the Weir Road bridge, 4.6 metres, and on to the dock; the ETA rolls digit by digit from 14:20 to 14:32 and «+12 min» appears. The truck turns, crosses the high bridge, arrives, gives a small bounce and the status turns to «Arrived»; then the loop starts again. The other three trucks run their own routes meanwhile. With the pointer on a truck it grows on a spring, its route lights up and the card slides to its data; a click keeps it selected.

How it works

The map, made by the script

Four vertical roads and four horizontal ones; between them the script lays one or two blocks with a lane in the middle, and in the river's band it shortens them as needed by sampling the river curve with getPointAtLength. Where a vertical road crosses the river a bridge appears: two flared rails and the clearance.

Routes with round corners

Each route is a list of points; a function turns it into a path with a Q curve at each corner. For the tall truck there are two whole routes, the old one and the new one: the script finds the length at which they part and cuts three pieces, the shared stretch, the old tail and the new tail.

Cab and trailer

Each truck reads three points on its route: the hitch, 9 units ahead for the cab and 22 behind for the trailer. Cab and trailer each turn toward their own point, so on a corner the truck bends. The shadow is the same blurred shape, always moved by 1.2 and 2 units on the map, not in the truck's own frame.

The bridge, the detour and the ETA

A single tween carries the truck from the start of the route to the end; every frame it checks the distance: 150 units before the fork the alert goes up, at 110 the old tail turns dashed and fades and the new one draws itself with stroke-dashoffset. The ETA is made of reels from 0 to 9: each digit that changes slides with yPercent and a back.out, one after the other.

Pointer and click

The card shows the truck under the pointer, otherwise the selected one. On a change the data leaves upward in 0.12 s and comes back from below with a back.out, staggered; the route of the truck on show lights up with a glow, and the truck grows with a CSS transition on a child element, so it never fights with GSAP.

Values to change

NameFileDefaultWhat it changes
TRIPscript.js13Seconds for the tall truck's trip, depot to dock.
TRUCK_HEIGHTscript.js4.2Height of the tall truck, in metres.
BRIDGE_HEIGHTscript.js3.8Clearance of the low bridge, in metres: if the truck fits, it keeps its route.
DETOUR_MINscript.js12Minutes the detour adds to the ETA.
DRAW_TIMEscript.js1.1Seconds for the new route to draw itself.
RESTscript.js2.4Seconds at the dock before the trip starts again.
FLEET_TRIPscript.js24Seconds for the other trucks to run their routes.
CORNERscript.js16Radius of the corners of the routes, in map units.

Try them in the Playground

When to use it

For the panel of a logistics or fleet management product, the page of a haulage company showing what its tracking can do, the incoming delivery in a shop, or the hero of a landing page for an app for drivers and dispatchers.

On phones

The same, with the card under the map in a short form: plate, driver, height, load, kilometres, the ETA on the right and the status. The map crops to its centre (preserveAspectRatio slice) and the panel is sized on the height too. Without a pointer a tap on a truck selects it.

With reduced motion

No moving trucks or rolling digits: the map already shows the result, with the tall truck past the fork, the old route dashed, the new one drawn, the bridge flagged and the new ETA. With the pointer or a click the card changes with a fade.

Pitfalls

  • The old and the new route share their start but have different corners at the fork: cutting them by hand from the points leaves a step. The script walks both routes together and takes the first length at which they part, then cuts the pieces from there as fine polylines.
  • A shadow inside the group that turns with the truck would turn with it: on a corner it would fall on another side. It has its own two pieces, moved on the map and then rotated.
  • The pointer grows the truck with a CSS transition; the click's bounce goes on another element, the inner group, otherwise GSAP's inline transform wipes out the class's.
  • In the first and last metres the trailer would look for a point before the start of the route: the point function extends the route in a straight line past its ends.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 13 KB; the libraries: GSAP 28 KB.

Testing

Tested on 18 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