Skip to content
animorio
IT
Back to the library

Tide chart

Scroll, SVGGSAP, CSS onlyMediumCompressed weight: Demo 7.8 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A harbour’s tide page, to scroll: the scroll is the day. The hour moves along the curve, the height reads in metres, the water in the glass rises, falls and tilts with the speed of the scroll, and the high and low waters light up as they pass.

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>
<!--
  "Tide chart" 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>Tide chart</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 tide page of a made-up harbour app, Saltmere Bay. The page sticks while you scroll and the scroll is the day:
       the hour moves along the tide curve, the height is read off it, the water in the glass follows and tilts with
       the speed of the scroll, and the high and low waters light up as they pass. -->
  <main>
    <section class="viaggio" data-viaggio>
      <div class="palco" data-palco>
        <div class="tide">
          <header class="tide__head">
            <span class="tide__place">
              <svg viewBox="0 0 18 18" aria-hidden="true"><path d="M1.500 7.500c2.500 0 2.500-3 5-3s2.500 3 5 3 2.500-3 5-3"/><path d="M1.500 12.500c2.500 0 2.500-3 5-3s2.500 3 5 3 2.500-3 5-3"/></svg>
              Saltmere Bay
            </span>
            <span class="tide__day"><span class="tide__roll"><span data-day>Scroll through the day</span></span></span>
          </header>

          <div class="tide__read">
            <div class="tide__now">
              <span class="tide__time" data-time aria-live="off">00:00</span>
              <span class="tide__trend">
                <svg class="tide__arrow" data-arrow viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
                <span class="tide__roll"><span data-trend>Rising</span></span>
              </span>
            </div>
            <div class="tide__level">
              <span class="tide__height"><b data-height>0.00</b><i>m</i></span>
              <svg class="tide__glass" viewBox="0 0 56 72" aria-hidden="true">
                <defs><clipPath id="glass"><rect x="1" y="1" width="54" height="70" rx="13"/></clipPath></defs>
                <g clip-path="url(#glass)">
                  <path class="tide__water" data-water></path>
                  <path class="tide__skin" data-skin></path>
                </g>
                <g class="tide__staff"><path d="M8 14h7M8 25h4M8 36h7M8 47h4M8 58h7"/></g>
                <rect class="tide__rim" x="1" y="1" width="54" height="70" rx="13"/>
              </svg>
            </div>
          </div>

          <div class="tide__chart" data-chart>
            <svg data-svg aria-hidden="true">
              <defs>
                <linearGradient id="fill" x1="0" y1="0" x2="0" y2="1">
                  <stop offset="0" style="stop-color: var(--accent); stop-opacity: 0.34"/>
                  <stop offset="1" style="stop-color: var(--accent); stop-opacity: 0"/>
                </linearGradient>
                <clipPath id="passed"><rect data-clip x="0" y="-20" width="0" height="2000"/></clipPath>
              </defs>
              <rect class="tide__night" data-night-a></rect>
              <rect class="tide__night" data-night-b></rect>
              <g class="tide__ticks" data-ticks></g>
              <path class="tide__ghost" data-ghost></path>
              <g clip-path="url(#passed)">
                <path class="tide__area" data-area></path>
                <path class="tide__line" data-line></path>
              </g>
              <g class="tide__caps" data-caps></g>
              <line class="tide__drop" data-drop></line>
              <circle class="tide__dot" data-dot r="5.500"></circle>
            </svg>
            <span class="tide__sun" data-sunrise></span>
            <span class="tide__sun" data-sunset></span>
          </div>

          <ol class="tide__list" data-list aria-label="High and low water today"></ol>
        </div>
      </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.

20 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 “Tide chart” 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 night-blue ground, the tide page of Saltmere Bay stays put while you scroll, and the scroll runs through the twenty-four hours. At the top the time, large, its digits growing heavier when the water is high; under it, an arrow that leans as much as the curve does at that point and a word rolling between “Rising”, “High water”, “Falling” and “Low water”. On the right the height in metres and a glass with a tide staff: the water rises and falls with the tide, its surface ripples by itself and tilts if you scroll fast, then levels out. In the chart the whole day is dashed; the part already gone lights up, with a fading area below and a dot running on the curve with its plumb line. The shaded bands are the night, with sunrise and sunset marked, and the whole ground brightens by day. Below, the four waters of the day: the ones gone by dim, the next lights up and says how long until it comes; when one passes, its row and the dot give a small springy kick.

How it works

The tide is a formula

Two cosines: the wave of 12 hours and 25 minutes and a smaller one a day long, as in real harbours. Height, slope, high and low waters all come from there: the waters are found minute by minute where the slope changes sign.

The scroll is the hour

One ScrollTrigger on the section five screens tall gives only the progress. The hour chases it with an exponential damping on the ticker, so even a notched wheel moves everything smoothly.

Everything is read off the hour

On every frame the hour has changed: the width of the clipPath that lights the curve, the dot, the time, the metres, the weight of the digits, the angle of the arrow (the arctangent of the slope), the state of the rows. Scrolling back puts everything right, because nothing is remembered.

The water that tilts

The surface in the glass is a path of fifteen points: two sines for the ripple and a tilt that is a spring pushed by the speed of the hour. Scroll fast and the water lurches, then swings and settles.

The chart in real pixels

The viewBox is as large as the box and the curve is rebuilt on resize by a ResizeObserver: lines keep their weight and labels are never stretched, at any width.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#63d6c6The colour of the water, the curve and the next water.
HIGH_ATscript.js5.2The hour of the day’s first high water (hours, 0 to 12).
RANGEscript.js1.7How many metres lie between low and high water.
SUNRISEscript.js7.2The hour of sunrise: before it the chart is in shade.
SUNSETscript.js16.6The hour of sunset: after it the chart is in shade again.
RIDEscript.js1How long the page is: 1 = five screens for a whole day.
LAGscript.js0.5How far the hour trails the scroll: 0 = glued, 1 = very soft.
WAVEscript.js1How much the water in the glass moves: 0 = still, 2 = choppy.

Try them in the Playground

When to use it

On the site of a seaside hotel, a marina, a surf or sailing school, a campsite on the coast: wherever the tide decides the day. With another formula, for any figure with a daily course: daylight, traffic, the price of energy, how busy a beach is.

On phones

The same page, by finger: the time and the glass at the top, the chart in the middle, the four waters in two columns. Every size also looks at the height of the screen, so the page fits whole even in a short window.

With reduced motion

No smooth scrolling and no springs: the hour follows the scroll to the letter, the water in the glass stays flat and only changes level, words and rows change without motion.

Pitfalls

  • Harbour, date, times and heights are made up: the formula looks like a real tide but is not a forecast. A real site takes its harbour’s harmonic constants or the data of a tide service.
  • High and low waters are not typed by hand: they are found in the same formula that draws the curve, or changing one value would leave rows and chart telling different stories.
  • The lit part of the curve is a clipPath as wide as the hour, not a dash that advances: the path’s length does not grow linearly with the hours and the dot would lag behind.
  • The rows’ entrance clears its inline properties at the end (clearProps): if GSAP’s opacity: 1 stayed, the waters gone by would never dim.
  • The stage is 100lvh tall where the browser knows it: on iPhone, Safari’s bar sliding back does not make the page jump.

Libraries

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

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

Testing

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