Skip to content
animorio
IT
Back to the library

Compass 404 page

SVG, HoverGSAPMediumCompressed weight: Demo 7.0 KBGSAP 28 KBFreeDownload the zip

The 404 page of Wayfern, a made-up travel journal, on warm paper: in the middle a compass drawn in hairlines. On arrival the needle spins fast looking for the lost page, slows down and trembles on a real damped spring without finding north; then it follows the pointer with a little lag and, over the «Take me home» button, points at it for good while the bezel clicks and the pill swells. Minimal style, a single vermilion accent.

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>
<!--
  "Compass 404 page" 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>Compass 404 page</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/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the 404 page of an invented travel journal, Wayfern, on warm paper. A compass drawn in hairlines spins on arrival
       looking for the page, slows down, trembles on a real damped spring and never finds north. The needle then follows
       the pointer with a little lag, always the short way round; over «Take me home» it points at the button for good,
       the bezel clicks and the pill swells -->
  <main class="stage" data-stage>
    <span class="grain" aria-hidden="true"></span>

    <div class="compass" data-compass aria-hidden="true">
      <svg class="compass__svg" viewBox="-110 -110 220 220">
        <defs>
          <filter id="ombra" x="-50%" y="-50%" width="200%" height="200%">
            <feGaussianBlur stdDeviation="2.4" />
          </filter>
          <radialGradient id="quadrante" cx="0" cy="0" r="100" gradientUnits="userSpaceOnUse">
            <stop offset="0" stop-color="#fbf9f4" />
            <stop offset="0.78" stop-color="#f6f3ec" />
            <stop offset="1" stop-color="#ebe6dc" />
          </radialGradient>
          <linearGradient id="vetro" x1="-60" y1="-90" x2="40" y2="20" gradientUnits="userSpaceOnUse">
            <stop offset="0" stop-color="#ffffff" stop-opacity="0.75" />
            <stop offset="1" stop-color="#ffffff" stop-opacity="0" />
          </linearGradient>
        </defs>

        <circle class="compass__case" r="104" />
        <g data-bezel>
          <circle class="compass__ring" r="98" />
          <g data-ticks></g>
          <text class="compass__card compass__card--n" x="0" y="-70">N</text>
          <text class="compass__card" x="72" y="0">E</text>
          <text class="compass__card" x="0" y="72">S</text>
          <text class="compass__card" x="-72" y="0">W</text>
        </g>
        <circle class="compass__face" r="60" fill="url(#quadrante)" />
        <circle class="compass__inner" r="60" />
        <circle class="compass__inner compass__inner--soft" r="36" />

        <g data-shadow transform="translate(2.4 3.4)">
          <polygon class="needle__shadow" points="0,-56 6,0 0,56 -6,0" filter="url(#ombra)" />
        </g>
        <g data-needle>
          <polygon class="needle__north" points="0,-56 6,0 -6,0" />
          <polygon class="needle__south" points="0,56 6,0 -6,0" />
          <line class="needle__ridge" x1="0" y1="-54" x2="0" y2="54" />
        </g>
        <circle class="compass__pivot" r="4.2" />
        <circle class="compass__pivot-hole" r="1.4" />

        <path class="compass__glass" d="M -78 -38 A 86 86 0 0 1 22 -84 A 96 96 0 0 0 -70 -22 Z" fill="url(#vetro)" />
      </svg>
    </div>

    <section class="copy">
      <p class="code" data-in>Error 404 <span class="code__soft">Wayfern Journal</span></p>
      <h1 class="title" data-in>This page drifted off the map</h1>
      <p class="lede" data-in>The link may be old, or the trail has moved. The needle knows the way back.</p>
      <a class="pill" href="#home" data-home data-in><span class="pill__bg" aria-hidden="true"></span><span class="pill__label">Take me home</span>
        <svg class="pill__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.2 12.3 8l-3.8 3.8" /></svg></a>
    </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.

23 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 “Compass 404 page” 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 warm paper, a compass drawn in hairlines with a ticked bezel and the cardinal letters, north in vermilion. As soon as the page opens the needle spins three times, slows down and trembles: it is looking for the lost page and cannot find north, swaying this way and that. Below, «Error 404», the headline «This page drifted off the map», a line and the «Take me home» button. Moving the mouse, the needle follows with a little lag, like a real needle, always the short way round; the ticks near its tip light up and while the needle runs the bezel turns a few degrees the other way. Over the button the needle points at it for good, stops trembling, the bezel clicks and the pill swells and turns vermilion.

How it works

The compass

A single SVG with the viewBox centred on zero: the case, the bezel with 72 ticks generated by the script (longer every 30 degrees), the letters N E S W, the dial with a radial gradient, the needle in two triangles, its blurred shadow and a glass highlight. Everything is drawn around (0, 0), so the needle turns with svgOrigin «0 0».

The needle spring

The needle has an angle, an angular velocity and a target. Every frame, in the GSAP ticker, the difference from the target taken the short way round (between −180 and 180 degrees) pulls the needle with stiffness STIFFNESS and damping DAMPING: a real spring that overshoots and swings before it settles.

The search

On arrival the target turns SEARCH_TURNS times in SEARCH_TIME seconds with power3.out: the needle chases it, slows down and swings. Then the needle is lost: every 0.75 seconds the target jumps randomly by ±80 degrees and a tremor made of two sines (TREMOR degrees) shakes it.

The pointer and the button

With the mouse or a finger the target is the angle from the compass centre to the pointer, and the tremor drops. Over the button the target is its centre, the spring gets stiffer and more damped and the tremor disappears; the bezel clicks by −5 degrees and springs back, the pill swells with elastic.out and the label widens on the wdth axis.

Ticks and bezel

The bezel turns the other way in proportion to the needle speed (BEZEL_SWAY, at most 6 degrees) and straightens when the needle stops. The ticks within 16 degrees of the tip take the vermilion and full opacity in proportion to how close they are; they are only updated when they really change.

The idle loop

After AUTO_PILOT seconds of stillness, a timeline moves a ghost pointer to three points on the page and then onto the button, stays there two and a half seconds and starts again. A real movement stops it.

Values to change

NameFileDefaultWhat it changes
STIFFNESSscript.js70Stiffness of the needle spring.
DAMPINGscript.js0.3Damping of the needle spring.
SEARCH_TURNSscript.js3How many turns the needle makes searching, on arrival.
SEARCH_TIMEscript.js2.6Seconds of the opening search.
TREMORscript.js1.4Needle tremor when lost, in degrees.
BEZEL_SWAYscript.js0.012How much the bezel turns back while the needle runs.
AUTO_PILOTscript.js3After how many still seconds the idle loop starts (0 never).

Try them in the Playground

When to use it

As the 404 page of a travel site, a journal, an agency, a maps or hiking app, a portfolio or a blog; more generally for any error page that should bring people home with a smile.

On phones

The compass is sized on both the width and the height of the page and sits above the words; the needle follows a dragged finger, and when nobody touches the idle loop makes it point at the button.

With reduced motion

No search, no tremor and no idle loop: the needle already points at the button and stays there, words and compass fade in and on hover the button only changes colour.

Pitfalls

  • The needle must be drawn around the viewBox zero and turned with svgOrigin «0 0»: with a percentage transformOrigin the pivot lands on the centre of its own box, which is not the centre of the dial, and the needle turns off-centre.
  • The difference between target and needle has to be taken the short way round, between −180 and 180 degrees: otherwise going from 179 to −179 the needle makes a full turn.
  • The shadow lives in an offset group: it is turned with its polygon’s rotate() attribute, not with svgOrigin, which works in the svg’s coordinates and not the group’s.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

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