025

Scroll Path Journey

£7
or the whole Vault, £99

Pinned scroll storytelling with GSAP ScrollTrigger and MotionPathPlugin: a route draws across a chart as the reader scrolls, a camera pans and zooms to frame each leg, and each stop's card slides in beside it.

ScrollTriggerMotionPathPlugin Lenis intermediate
7 more details
motion-pathsvg-animationscrubpinningscroll-storytellingmatchMediacheckpoint-navigation

Updated

About this effect

A pinned, map-led scroll story built with GSAP ScrollTrigger and MotionPathPlugin. The stage pins and holds a chart; as the reader scrolls, the route draws across it in one accent colour, carried by a small top-down marker that turns along the path and leaves a short fading wake. A camera, a single transform on the chart layer, frames each leg as it is paddled, shifts aside on arrival to make room for that stop's card, and pulls back to the whole route at the end, where a totals card closes the story. The route is a list of waypoints in chart-image pixels, so a buyer can swap the chart and re-plot; place names are HTML labels positioned on it, crisp at every zoom and renamed in the markup. On phones the chart still pins and the cards become a bottom sheet. Reduced motion shows the whole route drawn and the cards as a list, and the cards are real content in reading order either way.

Scroll Path Journey - GSAP animation effect preview

What's included

11 items
  • Pinned chart with a camera that pans and zooms to frame every leg, never showing past the image, then pulls back to the whole route
  • Route plotted as waypoints in chart-image pixels (a JSON block in the HTML), smoothed into one SVG path and measured once
  • Marker, walked stroke, checkpoints and camera all read the same path, so they cannot drift apart at any viewport size
  • Top-down marker that turns along the route, swells with scroll velocity and leaves a fading canvas wake
  • Each stop's card slides in on arrival on the side the chart leaves open; the camera re-frames to make room
  • Phones keep the pinned chart and turn the cards into a bottom sheet
  • HTML place names and generated day buttons positioned on the chart: crisp at every zoom, renamed in the markup
  • Day buttons on the chart jump straight to any stop, through Lenis when present
  • Live distance readout from per-stop kilometres (data-journey-km), plus the journey:checkpoint event
  • Reduced motion and no-JS: the full route on a static chart and every card listed below it
  • Lenis smooth scroll (0.5s) on the GSAP ticker, with URL and attribute opt-outs

Perfect for

5 use cases
  • Travel itineraries, tours and expeditions told stop by stop on a map
  • Delivery, logistics and supply-chain stories that follow a real route
  • Race, ride and trail recaps with per-stage photos and distances
  • Campus, venue or site tours on an illustrated plan
  • Company histories told as a journey between offices or markets

How it works

2 sections

The script reads the waypoints from a JSON block, joins them with a Catmull-Rom curve converted to cubic Bezier segments, and writes that one path into the base, walked and ahead strokes of an SVG laid over the chart image at its native pixel size. The arc length at each checkpoint is measured on a probe path made of the same segments, so it is exact, and each leg's bounding box is sampled from the path.

A pinned ScrollTrigger scrubs a single timeline value. A plan maps that value to the length walked (each leg eased, with a hold at every stop), to how far each card is in, and to camera keyframes: a box on the chart and the screen area it must fit, either the whole frame while paddling or the side the card leaves open on arrival. Between keyframes the box and area are blended and always widened to include the marker, then fitted with a translate and scale on the chart layer. The fit never lets the camera show past the image: the scale stays at or above the one that covers the stage, and when a leg cannot fit at that scale the marker is kept clear of the card instead. MotionPathPlugin turns the walked length into the marker's position and heading in chart pixels, which the same camera maps to the screen, so the marker sits on the stroke at every frame. Labels and day buttons are placed through the same camera, stroke widths are divided by the zoom, and a ResizeObserver re-measures the card slots and keyframes at the reader's position.

Plugins ScrollTrigger, MotionPathPlugin
Difficulty Intermediate
Smooth scroll Lenis integration
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Lighthouse, as measured

Google Lighthouse on this effect's demo, from the latest scan. A measurement of the demo as shipped, not a promise for your page.

Accessibility
100
Best practices
100

No performance score, on purpose. That figure depends on how you deploy: your server's compression and caching, your CDN, the connection and the device doing the test, none of which the code controls. The same page can score very differently on two consecutive runs, so measure it where it will live.

The Vault opens this source and the whole library.

Each product gives you the HTML, CSS and JavaScript source, the full documentation and an AI setup prompt, licensed for unlimited personal and commercial projects. Every paid product is tested for desktop and mobile layouts, reduced-motion handling, animation cleanup and keyboard controls wherever there is something to operate.

One payment, over 350 products, and future additions to the library.

Documentation

Quick Start

1. Add to your HTML <head>:

In your downloadThe working code for this step, in index.html.

2. Add before closing </body> tag:

In your downloadThe working code for this step, in index.html.

3. Add the journey markup:

In your downloadThe working code for this step, in index.html.

The three paths start empty. The script writes the same route into all of them.

Using It With Your Own Design

What the effect needs from your markup: a [data-path-journey] root holding a [data-journey-stage] (the element that pins), a [data-journey-frame] (the visible chart window), a [data-journey-chart] layer with your chart image and an <svg> containing [data-journey-base] and [data-journey-walked] paths, a [data-journey-marker], the route JSON in [data-journey-route], and your [data-journey-checkpoint] elements in route order. [data-journey-ahead], [data-journey-wake], [data-journey-nodes], [data-journey-intro], [data-journey-totals] and the readouts are optional.

Your own chart. Put any image in the chart layer and set width and height in the route JSON to its pixel size; the script sizes the chart layer from them. Plot the route as [x, y] points in those pixels, in travel order; mark each stop with a third value ([x, y, "stop"]), one per checkpoint. The script smooths a curve through every point, so add a waypoint wherever the route must bend around land. Open the image in any editor that shows cursor coordinates to read them off.

The camera never shows past the chart. Every frame is clamped so the image covers the whole stage, at every viewport shape. When a leg cannot be framed whole at that scale (a portrait phone, a stop near the chart's edge), the camera keeps the marker clear of the card instead, zooming in a little if it has to. So use a chart with land and sea well beyond the route: the more margin, the more freely the camera can frame.

Place names are HTML: any element with data-chart-x and data-chart-y (chart pixels) inside the frame is centred on that point and moves with the camera. Rename, restyle or add them freely; they stay crisp at every zoom.

Cards. Each checkpoint is shown in a slot beside the chart while the marker rests at its stop. The script picks the side the leg leaves open (a leg on the chart's right half is framed right, card left); force it with data-journey-side="left|right" on the card, the intro or the totals. Under 720px the slot is a bottom sheet (the demo's CSS) and the camera frames above it. The camera measures each card where it comes to rest, so cards of any size work.

What is only the demo's styling: the card design, the bottom sheet, the dashed planned course, the pill readout, the label styles, the kayak image and the orange accent. Keep these CSS rules or their equivalent:

  • .is-pinned (set by the script) turns the static layout into the pinned one: the stage is 100svh and overflow: hidden, the frame fills it, and slots are position: absolute with .is-left / .is-right placing them. Without it (no script, reduced motion) the page is a header, a static chart and a list.
  • .chart-frame.is-charted .chart has transform-origin: 0 0. The script sets its width and height from the route JSON and owns its transform.
  • Route strokes use calc(var(--chart-unit) * 4px) so they keep their screen width at every zoom.
  • Labels, day buttons, the marker and the wake canvas are position: absolute; top: 0; left: 0 inside the frame. The script owns their transform.

Options

All options go on the [data-path-journey] element.

Attribute Values Default Description
data-journey-scrub true, false, number 0.6 ScrollTrigger scrub. A number is the smoothing time in seconds
data-journey-pace number 0.5 Viewport heights of scroll per timeline unit. A leg is about one unit, each stop 0.7, the intro 1 and the pull-back 1.2 (about 5.5 viewport heights in the demo)
data-journey-zoom number 1.4 The closest the camera gets, in screen pixels per chart pixel. Past about 1.4 a chart at this resolution turns soft on high-density screens. The camera never goes below the scale that covers the stage
data-journey-lead chart pixels 100 Length of the faint "ahead" stroke past the marker. 0 hides it
data-journey-swell 0 to 1 0.25 How much the marker grows at full scroll speed before settling back elastically
data-journey-rotate true, false true Turn the marker to face along the route. The marker image should point up
data-journey-wake true, false true Draw the fading wake behind the marker
data-journey-active-class class name is-active Class on the current checkpoint

On each checkpoint: data-journey-label (used by the day readout, the generated button's name and the live region), data-journey-km (that leg's distance, summed by [data-journey-distance]) and data-journey-side.

Hook Receives
[data-journey-day] The label of the leg being paddled
[data-journey-distance] Kilometres paddled so far, from data-journey-km
[data-journey-progress-text] Route walked as a percentage
[data-journey-progress-bar] transform: scaleX(0..1)
[data-journey-status] A polite live-region sentence when a stop is reached

Checkpoint classes: the last stop reached gets the active class and aria-current="step", earlier ones is-passed, every stop reached is-reached. The generated day buttons get is-reached and the active class too.

How The Scroll Maps To The Chart

One pinned ScrollTrigger scrubs a single timeline value. The timeline runs: intro, then for each stop a leg (eased, longer legs take a little longer) and a hold, then the pull-back. The length walked comes from that value, and MotionPathPlugin turns the length into the marker's position and heading on the same path the strokes are drawn from. The camera blends between keyframes (a box on the chart and the screen area it must fit in), always widens the box to include the marker, and fits it with one translate and scale. Marker, labels and buttons are mapped to the screen through that same camera, so the marker always sits on the stroke.

Smooth Scroll

With Lenis loaded the script starts it (duration: 0.5) on the GSAP ticker and keeps ScrollTrigger in step. It leaves an existing window.lenis alone. Opt out with ?smooth=off in the URL or <html data-smooth="off">; reduced motion never starts it.

Accessibility

  • The cards are ordinary content in reading order, so screen readers and search engines get the whole story whether or not anything animates.
  • Each stop gets a native button on the chart, set beside the marker's arrival point so the kayak never covers it, named from its label and title (for example "Day 3, Eigg to Rùm: A night below the Rùm Cuillin"), with a visible focus ring. Activating it scrolls to that stop.
  • [data-journey-status] announces each stop as it is reached; the chart SVG, labels, wake and marker are aria-hidden.
  • prefers-reduced-motion: reduce does not pin: it shows the whole route drawn on a static chart and every card in a grid below it, and does not start Lenis. Switching the preference while the page is open swaps modes cleanly.
  • Without JavaScript the chart image, intro, cards and totals show as a plain page.

Dependencies

Required:

  • GSAP 3.12+
  • ScrollTrigger
  • MotionPathPlugin

Optional:

  • Lenis 1.x for smooth scroll

Also in your download: the full source, worked examples, the events and programmatic API, and the class reference.

£7