Skip to content
animorio
IT
All components

Surf report

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

A beach’s surf report in a card: a sea drawn with a single wave, as tall as the swell and as long as its period, drifting slowly. Pick one of the day’s five hours and the pill slides, the wave grows or drops on a spring, height, period and wind count to the new values, the wind arrow turns and the verdict rolls from “Good” to “Epic”.

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>
<!--
  "Surf report" 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>Surf report</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">
    <!-- the surf report of a beach: pick an hour and the wave takes its height and its period, the numbers roll,
         the wind arrow turns and the verdict changes -->
    <section class="sf" data-sf aria-labelledby="sf-title">
      <header class="sf__head">
        <span class="sf__name"><b id="sf-title">Praia da Areia</b><span>Surf report, today</span></span>
        <span class="sf__rate" aria-live="polite"><span data-rate>Good</span></span>
      </header>

      <div class="sf__sea" aria-hidden="true">
        <svg data-sea preserveAspectRatio="none"><defs><linearGradient id="sf-fill" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="var(--accent)" stop-opacity="0.34"></stop><stop offset="1" stop-color="var(--accent)" stop-opacity="0.04"></stop></linearGradient></defs><path class="sf__back" data-back></path><path class="sf__water" data-water fill="url(#sf-fill)"></path><path class="sf__crest" data-crest></path></svg>
        <span class="sf__rule"><i></i><b><span data-mark>1.2 m</span></b></span>
      </div>

      <dl class="sf__stats">
        <div><dt>Wave</dt><dd><b data-wave>1.2</b><span>m</span></dd></div>
        <div><dt>Period</dt><dd><b data-period>10</b><span>s</span></dd></div>
        <div class="sf__windbox"><dt><span data-windname>Offshore</span></dt><dd><b data-windv>6</b><span>km/h</span><svg class="sf__arrow" data-arrow viewBox="0 0 20 20" aria-hidden="true"><path d="M10 16V4.500M5.500 8.500 10 4l4.500 4.500"></path></svg></dd></div>
      </dl>

      <div class="sf__hours" role="group" aria-label="Hour of the day" data-hours>
        <span class="sf__pill" data-pill aria-hidden="true"></span>
          <button class="sf__hour" type="button" data-hour aria-pressed="true" data-h="1.2" data-t="10" data-w="6" data-wind="Offshore" data-dir="-90" data-rate="Good"><i aria-hidden="true"><b style="height:57%"></b></i><span>6 am</span></button>
          <button class="sf__hour" type="button" data-hour aria-pressed="false" data-h="1.8" data-t="12" data-w="9" data-wind="Offshore" data-dir="-70" data-rate="Epic"><i aria-hidden="true"><b style="height:86%"></b></i><span>9 am</span></button>
          <button class="sf__hour" type="button" data-hour aria-pressed="false" data-h="2.1" data-t="13" data-w="18" data-wind="Cross-shore" data-dir="0" data-rate="Good"><i aria-hidden="true"><b style="height:100%"></b></i><span>12 pm</span></button>
          <button class="sf__hour" type="button" data-hour aria-pressed="false" data-h="1.6" data-t="11" data-w="24" data-wind="Onshore" data-dir="75" data-rate="Fair"><i aria-hidden="true"><b style="height:76%"></b></i><span>3 pm</span></button>
          <button class="sf__hour" type="button" data-hour aria-pressed="false" data-h="1.0" data-t="9" data-w="12" data-wind="Onshore" data-dir="100" data-rate="Poor"><i aria-hidden="true"><b style="height:48%"></b></i><span>6 pm</span></button>
      </div>
    </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.

29 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 “Surf report” 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 white, a light card: “Praia da Areia”, “Surf report, today” and on the right a teal pill with the verdict, “Good”. Below, a panel with the sea: a teal wave with a crisp edge and a fading fill, a lighter one behind it, and at the top left a mark with “1.2 m”; the wave drifts slowly to the left. Then three tiles: “Wave 1.2 m”, “Period 10 s” and the wind, “Offshore 6 km/h”, with an arrow. At the bottom the day’s five hours, each with a small bar saying how big the wave is at that hour, and a white pill under the chosen one. Tap “9 am” and the pill slides with a bounce, the wave rises slightly past its size and settles, stretches with the period, the numbers count to 1.8, 12 and 9, the arrow turns and the verdict rolls to “Epic”. In the afternoon the wind goes “Onshore”, the arrow turns the other way and the verdict drops to “Fair” and “Poor”.

How it works

The wave from two numbers

The SVG path is rewritten on every frame from two numbers: the height in metres becomes the amplitude, the period in seconds the length. It is a sine with a second, smaller one on top, so it does not look like a ruler.

Changing the hour

On picking an hour GSAP takes the two numbers to the new values: the height on an elastic spring, so the wave goes past its size and comes back, the period on a soft curve. The phase moves with time, DRIFT pixels per second.

The wind

The arrow is a whole svg rotated around its centre, taking the shorter turn between the old angle and the new; the wind’s name and the verdict roll.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#0e8f8aThe colour of the sea, of the wind arrow and of the chosen hour.
DRIFTscript.js26How many pixels per second the wave drifts.
COUNTscript.js0.6How long the numbers take to count to the new value.

Try them in the Playground

When to use it

On the site of a surf school, a surf camp, a hotel or a holiday home by the sea, and in weather apps for people going in the water: surfing, sailing, kiting, paddling. The same card works for snow, wind or tide by changing the three numbers.

On phones

The same card, as wide as the screen minus the margins: the sea is redrawn on its real width, the five hours stay in a row with buttons 48 pixels tall. The card is about 300 pixels tall and fits whole in the phone box.

With reduced motion

The sea is still: the wave is drawn once, as tall and as long as the chosen hour says. On changing hour the wave, the numbers, the arrow and the verdict go straight to the new values, with no springs and no counting.

Pitfalls

  • Beach and numbers are made up: on a real site height, period and wind come from a forecast service, and the verdict depends on the beach, not only on the three numbers.
  • The wave is a drawing, not a simulation: it says at a glance whether the sea is big or flat, the real numbers are in the tiles.
  • The path is worked out again on resize from the panel’s real width, and the hour pill is put back in its place.

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 25 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 components