Skip to content
animorio
IT
Back to the library

Marathon course map

Scroll, SVGGSAPMediumCompressed weight: Demo 14 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

The course page of a made-up city marathon, Harbour City Marathon 2026: as you scroll, on a thin-line SVG map of the city (blocks, the river with its two bridges, the harbour with its piers, the park with its pond) the orange course draws itself from the start with a glowing head and a hot trail at the tip of the line, the 5, 10, 21.1 and 30 km marks with their aid stations and the finish light up as it passes, each with a tag opening on a spring, and beside it a glass card counts the kilometres, fills the elevation profile with the gain and gives the split time at the chosen pace. At the end the finish lights up, a light runs the whole course and the course keeps its glow.

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>
<!--
  "Marathon course 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>Harbour City Marathon course</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/inter-tight@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the course page of a made-up city marathon, Harbour City Marathon 2026. The stage sticks while you scroll: a
       thin-line map of the city (blocks, the river, the harbour, the park) and the course drawing itself from the start
       with a glowing head running at its tip. The kilometre marks, the aid stations and the finish light up as the
       head passes, each with a small tag opening on a spring; beside the map a glass card counts the kilometres,
       fills the elevation profile and gives the split time at the pace you choose. At the end the finish lights up
       and the whole course takes a glow. -->
  <main>
    <section class="race" data-race>
      <div class="stage" data-stage>
        <div class="light light--a" data-light-a aria-hidden="true"></div>
        <div class="light light--b" data-light-b aria-hidden="true"></div>
        <div class="grain" aria-hidden="true"></div>

        <div class="frame" data-frame>
          <article class="panel" data-panel>
            <span class="panel__edge" aria-hidden="true"></span>

            <header class="head">
              <span class="mark" aria-hidden="true">
                <svg viewBox="0 0 16 16"><path d="M2.6 11.6c2.2-.2 3.4-1.6 4.4-3.6s2.2-3.6 4.4-3.8"/><path d="M11.4 4.2l2 0"/><path d="M2.6 11.6h3"/></svg>
              </span>
              <div class="head__words">
                <p class="brand">Harbour City Marathon</p>
                <p class="when">Sun 18 Oct 2026 <span class="sep" aria-hidden="true"></span> 07:30 <span class="sep sep--wide" aria-hidden="true"></span> <span class="wide">42.195 km, one loop</span></p>
              </div>
              <span class="tag-course">Course</span>
            </header>

            <div class="body">
              <div class="map" data-map>
                <div class="cam" data-cam>
                  <svg class="city" viewBox="0 0 600 400" aria-label="Map of the marathon course through Harbour City" role="img" data-city>
                    <defs>
                      <pattern id="waves" width="7" height="7" patternUnits="userSpaceOnUse" patternTransform="rotate(-32)">
                        <path d="M0 3.5h7" class="sea__hatch"/>
                      </pattern>
                      <pattern id="trees" width="9" height="9" patternUnits="userSpaceOnUse" patternTransform="rotate(18)">
                        <path d="M1.5 4.5h3" class="park__hatch"/>
                      </pattern>
                      <mask id="land" maskUnits="userSpaceOnUse" x="0" y="0" width="600" height="400" data-land></mask>
                      <radialGradient id="halo">
                        <stop offset="0" stop-color="#ffd7c4" stop-opacity="0.95"/>
                        <stop offset="0.35" stop-color="#ff6a3d" stop-opacity="0.45"/>
                        <stop offset="1" stop-color="#ff6a3d" stop-opacity="0"/>
                      </radialGradient>
                      <filter id="blur" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="3.2"/></filter>
                      <filter id="soft" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="7"/></filter>
                    </defs>
                    <rect class="ground" width="600" height="400"/>
                    <g data-sea></g>
                    <g data-river></g>
                    <g data-park></g>
                    <g class="blocks" mask="url(#land)" data-blocks></g>
                    <g data-bridges></g>
                    <g class="names" data-names></g>
                    <path class="route route--ghost" data-ghost/>
                    <path class="route route--aura" data-aura filter="url(#soft)"/>
                    <path class="route route--glow" data-glow filter="url(#blur)"/>
                    <path class="route route--line" data-line/>
                    <path class="route route--trail" data-trail/>
                    <path class="route route--sweep" data-sweep filter="url(#blur)"/>
                    <g data-marks></g>
                    <g class="head-dot" data-head>
                      <circle class="head-dot__halo" r="16" fill="url(#halo)" data-halo/>
                      <circle class="head-dot__ring" r="5.2"/>
                      <circle class="head-dot__core" r="2.6"/>
                    </g>
                  </svg>
                  <div class="labels" data-labels></div>
                </div>
                <div class="map__vignette" aria-hidden="true"></div>
              </div>

              <aside class="card" data-card>
                <span class="card__edge" aria-hidden="true"></span>
                <span class="card__glow" aria-hidden="true"></span>
                <div class="card__top">
                  <span class="eyebrow">Live split</span>
                  <span class="chip"><span class="chip__words" data-chip>On course</span></span>
                </div>

                <div class="km">
                  <span class="km__num" data-km>0.0</span>
                  <span class="km__unit">km</span>
                  <span class="km__of">of 42.195</span>
                </div>

                <div class="elev">
                  <div class="row">
                    <span class="label">Elevation</span>
                    <span class="val"><span data-gain>+0</span> m</span>
                  </div>
                  <svg class="profile" viewBox="0 0 200 40" preserveAspectRatio="none" aria-hidden="true" data-profile>
                    <defs>
                      <linearGradient id="fillUp" x1="0" y1="0" x2="0" y2="1">
                        <stop offset="0" stop-color="#ff6a3d" stop-opacity="0.55"/>
                        <stop offset="1" stop-color="#ff6a3d" stop-opacity="0"/>
                      </linearGradient>
                      <clipPath id="done"><rect x="0" y="0" width="0" height="40" data-done/></clipPath>
                    </defs>
                    <path class="profile__base" data-profile-area/>
                    <path class="profile__line" data-profile-line/>
                    <g clip-path="url(#done)">
                      <path class="profile__fill" data-profile-fill/>
                      <path class="profile__lit" data-profile-lit/>
                    </g>
                    <path class="profile__cursor" data-cursor d="M0 0V40"/>
                  </svg>
                </div>

                <div class="pace">
                  <div class="row">
                    <span class="label">Split at pace</span>
                    <span class="val val--muted">per km</span>
                  </div>
                  <div class="seg" role="radiogroup" aria-label="Pace" data-seg>
                    <span class="seg__thumb" data-thumb aria-hidden="true"></span>
                    <button class="seg__opt" type="button" role="radio" aria-checked="false" data-pace="255">4:15</button>
                    <button class="seg__opt" type="button" role="radio" aria-checked="true" data-pace="300">5:00</button>
                    <button class="seg__opt" type="button" role="radio" aria-checked="false" data-pace="345">5:45</button>
                  </div>
                </div>

                <div class="time">
                  <span class="time__num" data-time>0:00:00</span>
                  <span class="next"><span class="label">Next</span> <span class="next__words" data-next>Water, 5 km</span></span>
                </div>
              </aside>
            </div>
          </article>
        </div>
        <p class="sr" aria-live="polite" data-live></p>
      </div>
    </section>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.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.

42 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 “Marathon course 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 midnight blue background with two soft lights, one orange and one blue, sits the panel of the Harbour City Marathon, a made-up race: the brand, ‘Sun 18 Oct 2026’, ‘07:30’, ‘42.195 km, one loop’ and the ‘Course’ pill. On the left the thin-line map of the city: the blocks, some split in two, the river Arne with its banks and two bridges, the harbour on the right with the hatched water and the piers, North Park with its hatched lawn, its walks and its pond, the names of the districts barely there, and the whole course already hinted by a light dotted line. As you scroll the stage stays put and the course draws itself from the start, Waterfront, along the streets: east, north over the first bridge and up the park, then diagonally down Harbour Ave, south along the harbour over the second bridge and west to the finish on Harbour Square. A glowing head with a hotter trail runs at the tip of the line, and the map leans in a little and drifts towards it. At 5, 10, 21.1 and 30 km the aid station mark lights up with a wave of light and a tag springs open from it (‘5 km, Water’, ‘10 km, Water and gel’, ‘Half 21.1, Water, timing mat’, ‘30 km, Water and fruit’); when the next one arrives, the one before folds back to its name. Beside it the glass card counts the kilometres, fills the elevation profile in orange with its cursor and the rising gain, gives the split time at the pace chosen in the switch (4:15, 5:00, 5:45 per km, with the thumb sliding on a spring and the time recounting) and names the next aid station. At the end the finish lights up, ‘Finish 42.195’, the map pulls back to the whole city, a white light runs the whole course from start to finish, the course keeps a glow, the card says ‘Finished’ and 3:30:59 at a 5:00 pace. Scrolling back takes it all apart.

How it works

One still stage and one timeline

The section is 480vh tall and the stage inside is sticky at 100vh (100lvh where available). A paused GSAP timeline carries a single value from 0 to 1 and ScrollTrigger drives it with scrub: every frame the render function reads that value and places the line, the head, the map, the marks and the card.

The city generated in the viewBox

The script draws the map in a 600 by 400 viewBox: blocks on a 40 grid, some split in two by a fixed-seed generator, kept off the river, the harbour, the park and the avenue by a mask; the river is a wide stroke with its two banks shifted by ten, the bridges sit where the course crosses the river, searched on its path.

DrawSVG by hand

The course is a path with rounded corners; its real length L comes from getTotalLength. stroke-dasharray is L and stroke-dashoffset goes from L to 0, written as attributes with setAttribute: the line pulls itself from the start. The hot trail is the same path with a 46-long dash moved to the tip, and the head sits at getPointAtLength.

Marks on thresholds

Every aid station has its fraction, kilometres over 42.195. When the value passes it, the mark lights up and the HTML tag, placed over the map in percent of the viewBox, springs open from the mark's side; going back it closes. The one before folds to its name with a CSS transition.

The card and the finish

The elevation profile is a 120-point path; a clipPath as wide as the distance run shows the orange part, and the gain is the sum of the climbs so far. The time is kilometres times pace, and changing the pace makes it roll. At the finish a 70-long dash runs the whole course once and a blurred aura stays lit.

Values to change

NameFileDefaultWhat it changes
RIDEscript.js1How much scroll the whole course takes: 2 = twice as long.
TRAILscript.js46How long, in map units, the hot trail behind the head is.
LEANscript.js0.1How much the map zooms in and leans towards the head (0 = still).
POPscript.js1.7How far a tag passes its size when it opens (1 = no spring).
GLOWscript.js1How strong the course glow and the lights behind the panel are.
SWEEPscript.js1.6The seconds the finish light takes to run the whole course.

Try them in the Playground

When to use it

On the course page of a marathon, a half, a road race, a cycling race or a trail, a staged walk, a city tour; or to tell a delivery route, a trip, a track in a running app. The course is changed in PTS (the points on the streets), the aid stations in MARKS, the elevation in the height function; the colours in --course, --water and --park in the CSS.

On phones

The same animations at adapted sizes: below 600 pixels the map goes on top at full width (at most 46% of the height) and the card underneath, in two columns with the kilometres and the time on the left, the profile and the switch on the right; the tags are smaller and on short screens the date goes, so it all fits in 341 by 410.

With reduced motion

No long scroll and no movement: the course is already drawn with its glow, the aid stations and the finish lit with their tags, the card with 42.195 km, the gain and the final time; the panel fades in and the pace switch changes the time without rolling.

Pitfalls

  • stroke-dashoffset written as an attribute: if the same path also has a dasharray in the CSS, the CSS beats the attribute. The line, the glow and the trail have dasharray and dashoffset only as attributes; the dotted ghost of the course is a separate path.
  • Tags inside the SVG shrink with the map and become unreadable on a phone: they are HTML over the map, placed in percent (x / 6, y / 4) inside the same box the camera zooms, so they stay stuck to their mark.
  • A tag folding to make room for the next one stays as wide as its longest line if only the height is hidden: max-width and the gap are closed too.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0, Inter Tight (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 14 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

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