Skip to content
animorio
IT
All components

Offline map button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 11 KBGSAP 28 KBFreeDownload the zip

The «Download offline map» button in the map card of an invented hotel, Casa Vela, on black: above the button the map of the neighbourhood waits blurred and split into tiles. Pressed, the pill darkens and an amber light fills it from the left with a bright edge, the label turns from light to dark where the light reaches it, the folded map icon fills panel by panel and the megabytes count up; meanwhile the sharp tiles settle one after another on a spring, in a wave from the hotel pin. At the end a glint crosses the map, the pin hops, «Available offline» comes in with its check and the button says «Saved for offline».

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>
<!--
  "Offline map button" 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>The Download offline map button with the tiles that settle</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" data-stage>
    <!-- the offline map card of a hotel app: pressed, the button fills with light and the map of the neighbourhood
         downloads tile by tile, each tile settling on a spring outward from the hotel pin; then the map catches a glint,
         the pin hops and the button says it is saved -->
    <section class="om" data-card aria-label="Casa Vela offline map">
      <header class="om__head">
        <span class="om__mark" aria-hidden="true">
          <svg viewBox="0 0 24 24"><path d="M12 3.6c-3.4 0-6 2.6-6 5.9 0 4.4 6 10.9 6 10.9s6-6.5 6-10.9c0-3.3-2.6-5.9-6-5.9Z"></path><path d="M9.4 9.6c.9-1.3 4.3-1.3 5.2 0"></path></svg>
        </span>
        <div class="om__title">
          <p class="om__name">Harbour Quarter</p>
          <p class="om__sub">Around Casa Vela hotel</p>
        </div>
        <p class="om__chip" data-chip><span data-chip-text>48 MB</span></p>
      </header>

      <div class="map" data-map>
        <svg class="map__low" viewBox="0 0 480 280" preserveAspectRatio="none" aria-hidden="true"><use href="#mapart"></use></svg>
        <div class="map__grid" data-grid aria-hidden="true"></div>
        <div class="map__tiles" data-tiles aria-hidden="true"></div>
        <span class="map__glint" data-glint aria-hidden="true"></span>
        <span class="map__pin" data-pin aria-hidden="true">
          <i class="pin__shadow" data-pin-shadow></i>
          <svg class="pin__body" data-pin-body viewBox="0 0 28 34"><path d="M14 1.5C7.4 1.5 2.5 6.4 2.5 12.7 2.5 21 14 32.5 14 32.5S25.5 21 25.5 12.7C25.5 6.4 20.6 1.5 14 1.5Z"></path><path class="pin__bed" d="M8.6 15.6v-4.2M8.6 13.8h10.8v1.8M11.2 11.6h5.6c1.4 0 2.6 1 2.6 2.2"></path></svg>
        </span>
        <p class="map__badge" data-badge>
          <svg viewBox="0 0 16 16" aria-hidden="true"><path data-badge-check d="M3.6 8.4l2.8 2.8 6-6.2"></path></svg>
          <span>Available offline</span>
        </p>
      </div>

      <button class="dl" type="button" data-btn data-autoclic>
        <span class="dl__light" aria-hidden="true"></span>
        <span class="dl__face" data-face>
          <span class="dl__icon" aria-hidden="true">
            <svg viewBox="0 0 24 24">
              <path class="ic__panel" data-panel d="M3.6 6.6 8.4 4.8v13.4l-4.8 1.8Z"></path>
              <path class="ic__panel" data-panel d="M8.4 4.8l7.2 2.2v13.4l-7.2-2.2Z"></path>
              <path class="ic__panel" data-panel d="M15.6 7l4.8-1.8v13.4l-4.8 1.8Z"></path>
              <path class="ic__map" d="M3.6 6.6 8.4 4.8l7.2 2.2 4.8-1.8v13.4l-4.8 1.8-7.2-2.2L3.6 20Z"></path>
              <g class="ic__arrow" data-arrow><path d="M12 1.6v7.2"></path><path d="M9.2 6.2 12 9l2.8-2.8"></path></g>
              <path class="ic__check" data-check d="M6.4 12.6l3.6 3.4 7.6-7.8"></path>
            </svg>
          </span>
          <span class="dl__label" data-label>Download offline map</span>
          <span class="dl__meta" data-meta>48 MB</span>
        </span>
        <span class="dl__fill" data-fill aria-hidden="true"><span class="dl__edge"></span></span>
      </button>
      <p class="sr" aria-live="polite" data-live></p>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
    <svg class="defs" aria-hidden="true" width="0" height="0"><defs><symbol id="mapart" viewBox="0 0 480 280" data-art></symbol></defs></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.

24 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 “Offline map button” 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 black page sits the dark offline map card of Casa Vela, an invented hotel, with a one pixel edge that catches the light and a light grain: at the top the pin icon, «Harbour Quarter», «Around Casa Vela hotel» and the «48 MB» tag. Below, the map of the neighbourhood (blocks, main roads, a river, two parks, the harbour with the sea, the pier and the dashed amber walk from the hotel to the pier) is still blurred and dim, under the thin grid of the tiles to download; the amber hotel pin sits on top. At the bottom the light «Download offline map» pill with the folded map icon and its arrow, and «48 MB» on the right. On hover a soft light follows the pointer over the pill and the arrow dips two pixels into the map and springs back. Pressed, the button gives and returns, the arrow drops into the map, the pill turns dark and the label becomes «Downloading map»; from the left an amber light fills it with a bright white edge, and where the light passes the label turns dark. On the right the percentage rises, the tag at the top counts the megabytes up to 48, the icon's three panels fill one after another. Meanwhile on the map the sharp tiles arrive one after another, in a wave from the pin: each drops a breath, passes the mark by a hair and settles, its edge lighting amber for an instant; the grid fades. Done, the all amber pill gives under the last tile and settles, the icon gives way to a drawn check and the label becomes «Saved for offline»; a glint crosses the map, the pin hops and squashes as it lands, «Available offline» comes in at the top left with its check, and the tag becomes «Offline». Pressing again lifts the tiles from the edges back to the pin and everything returns as it was.

How it works

One map, forty windows

The map is drawn once into a 480 by 280 SVG symbol: blocks as rounded rectangles on a slightly turned grid, skipped where they fall into the sea, the river, the roads or the parks (distance to a segment and point in polygon), then the river, roads, shore and names. Each tile is a small svg with a viewBox framing its part and a use pointing at the symbol: no pixels to recompute on resize, and the tiles meet without seams because each one spills a pixel onto its neighbour.

The blurred preview underneath

Under the tiles the same symbol is drawn whole with blur, saturate and brightness filters, a little larger than the map so the blur does not uncover the edges; over it a grid of thin inset shadows marks the seams of the tiles still to download and fades when the map is nearly complete.

The light filling the pill

The button has its face twice: light underneath, dark ink on top inside the amber fill, which is cut by a clip-path inset from the right. One tween on an object (p from 0 to 1) drives the cut, the bright edge, the percentage, the megabytes and the opacity of the icon's three panels: everything moves as one thing.

The tiles in a wave, in step with the light

The tiles are queued by distance from the pin, with a little disorder (SCATTER). So that the last one lands as the light ends even on a power1.inOut curve, the time of each one is found by inverting the curve with a binary search; each one comes in with back.out (BOUNCE) from 3 pixels above at scale 0.86, and its amber edge fades in 0.6 seconds.

The ending

At the end the pill gives with scaleY and an elastic.out, the label changes with the wdth axis tightening from 114 to 100, the check draws with strokeDashoffset, a glint in screen blend crosses the map, and the pin rises, drops and squashes from its bottom origin on an elastic while its shadow shrinks and grows back.

Values to change

NameFileDefaultWhat it changes
MAP_SIZEscript.js48The megabytes of the map, written on the button and counted during the download.
DOWNLOAD_TIMEscript.js3.4The seconds of the download: the light fills the button and all the tiles arrive.
COLSscript.js8How many columns of tiles the map has.
ROWSscript.js5How many rows of tiles the map has.
BOUNCEscript.js2.2How far each tile passes the mark as it settles: 1 barely, 4 more.
SCATTERscript.js0.35How disordered the tiles' order is: 0 a perfect wave from the pin, 1 almost random.
PAUSEscript.js2.2The seconds the autopilot waits on the saved map before starting again.

Try them in the Playground

When to use it

For the app or site of a hotel, a holiday home, a resort or a travel guide: the neighbourhood map to keep on the phone without a connection, before leaving or on arrival. It also suits a hiking app, a city app or an outdoor event, and works as a model for any download that has something to show while it arrives.

On phones

The same animation with adapted sizes: the card is 92% of the screen wide and also shrinks with the height, the map keeps its proportions, the button stays 60 pixels tall, easy for a finger, and under 360 pixels the label tightens a little with the wdth axis. A tap does what a click does; the hover light follows the finger while it rests on the pill.

With reduced motion

Nothing moves: the tiles fade in one after another with no scale or spring, the percentage and the megabytes rise, the pill turns amber with a fade instead of filling from the left, the check appears already drawn, no glint and no hop of the pin, the drawn pointer stays hidden.

Pitfalls

  • With the tiles placed in percentages a one pixel seam remained between them, showing the blurred preview: each tile spills a pixel onto its neighbour and its viewBox takes a sixtieth more, so the seams disappear.
  • The preview's blur uncovered a dark frame along the map's edges: the blurred svg is 6 pixels larger on each side and the map clips it.
  • With a power1.inOut curve on the light, tiles spread evenly in time landed before the light at the start and after it at the end: each tile's time comes from inverting the curve.
  • With Mona Sans tabular-nums gives a slashed zero: the percentage sits in a space 3.4 em wide aligned right, without tnum.
  • The button's two faces must change together: labels, percentages, arrows and checks are taken with querySelectorAll inside the button and animated as one list.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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