Skip to content
animorio
IT
Back to the library

Clustered store map

SVG, HoverGSAP, CSS onlyAdvancedCompressed weight: Demo 13 KBGSAP 28 KBFreeDownload the zip

The store finder of Brume, a made-up coffee roaster, on a city drawn in SVG: streets, a river, parks and the names of the districts. From far away nearby stores gather into a white disc with their number; zooming in (wheel, buttons, a tap on the cluster) the disc opens and the pins fly on a spring each to its own place, zooming out they come back together and the disc pops up again with a bounce. Under the pointer a pin rises and shows the store card with the address, the hours and directions; the scale bar, the street names and the count of stores in view follow the zoom.

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>
<!--
  "Clustered store map" 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 store map with pins that gather into clusters and open as you zoom</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 store finder of Brume, a made-up coffee roaster: from far away nearby stores gather into numbered clusters,
         zooming in they spring apart into single pins -->
    <section class="app" data-app aria-label="Brume store finder">
      <div class="map" data-map>
        <svg class="map__svg" data-svg aria-hidden="true">
          <g data-world></g>
        </svg>
        <div class="labels" data-labels></div>
        <div class="markers" data-markers></div>
      </div>

      <div class="tip" data-tip role="status" aria-live="polite">
        <div class="tip__card">
          <p class="tip__name" data-tip-name>Brume Quay Road</p>
          <p class="tip__addr" data-tip-addr>14 Quay Road · Old Town</p>
          <div class="tip__row">
            <span class="tip__hours" data-tip-hours>Open until 7 PM</span>
            <span class="tip__go">Directions
              <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 9 9 3M4.5 3H9v4.5"/></svg>
            </span>
          </div>
        </div>
        <span class="tip__arrow"></span>
      </div>

      <header class="bar">
        <label class="search">
          <svg class="search__mark" viewBox="0 0 24 24" aria-hidden="true">
            <circle cx="12" cy="13.5" r="6.5"/>
            <path d="M9.5 6.5c0-1.6 1.4-1.6 1.4-3.2M13.4 6.5c0-1.6 1.4-1.6 1.4-3.2"/>
          </svg>
          <input type="text" value="" placeholder="Find a Brume near you" aria-label="Search stores" readonly>
          <svg class="search__glass" viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.6"/><path d="m10.4 10.4 3.2 3.2"/></svg>
        </label>
        <p class="count" aria-live="polite"><span class="count__num" data-count>24</span><span class="count__word"> stores in view</span><span class="count__short"> in view</span></p>
      </header>

      <div class="scale" aria-hidden="true">
        <span class="scale__bar" data-scale-bar></span>
        <span class="scale__text" data-scale-text>1 km</span>
      </div>

      <div class="zoom" role="group" aria-label="Zoom">
        <button class="zoom__btn" type="button" data-zoom-in aria-label="Zoom in">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 3.5v9M3.5 8h9"/></svg>
        </button>
        <span class="zoom__rule"></span>
        <button class="zoom__btn" type="button" data-zoom-out aria-label="Zoom out">
          <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h9"/></svg>
        </button>
      </div>

      <svg class="hand" data-hand viewBox="0 0 24 24" aria-hidden="true">
        <path d="M5 3.2 18.4 12.6l-6.1 1.1-3.3 5.6Z"/>
      </svg>
    </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.

32 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 “Clustered store map” 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

In the middle of a paper-coloured ground sits Brume’s window, with the map of a made-up city: the grid of streets in hairlines, four white roads with their edges, a river, the sea in a corner and three parks with a dotted path. On top, the search field with the logo and the pill with the stores in view; at the bottom the scale bar and the plus and minus buttons. The twenty-four stores sit in five districts: from far away the close ones are gathered into white discs with their number, with a thin terracotta ring that widens under the pointer. Tap a cluster and the map flies to its stores, the disc disappears and the pins, black drops with a drawn cup, leave the centre and scatter on a spring, one after another; going back they fly together again, vanish as they land and the disc pops up with an elastic bounce. The district names fade as you get closer and the street names light up, the scale bar goes from 1 km to 100 m, the number of stores in view rolls. A pin under the pointer rises a few pixels, turns terracotta, its shadow shrinks and the store card opens.

How it works

Clusters are worked out at the arrival zoom

Two stores gather if on screen they are closer than GATHER pixels, and the on-screen distance depends only on the zoom: the clusters are worked out once, when the arrival zoom changes, not on every frame. So while the map flies nothing flickers, and every pin already knows where to go.

Every pin flies from where it is now

When a store changes cluster, the starting point is where it is drawn at that moment, even halfway through a flight, and the end point is the centre of the new cluster or its own place. A value from 0 to 1 animated with back.out joins them: the spring is all in the curve, and the position is projected on screen on every frame, so it follows the moving map too.

The disc waits for its pins

The cluster disc is born small and transparent and swells with elastic.out only near the end of the flight, as the pins are landing in it and vanishing. When a cluster opens the disc does the opposite: it widens and fades in a fifth of a second, and the pins are born small at its centre.

The map is a single transform

The whole drawing of the city is an SVG group with one translation and one scale; the lines have vector-effect: non-scaling-stroke, so they stay thin at every zoom, while roads and the river grow as they should. Pins, discs and names are HTML elements above the map, placed at their point with translate3d.

Values to change

NameFileDefaultWhat it changes
STORESscript.js24How many stores are on the map, from 6 to 24.
GATHERscript.js46How close two pins may get on screen, in pixels, before they gather into a cluster.
ZOOM_TIMEscript.js0.9The seconds of each zoom.
FLY_TIMEscript.js0.7The seconds of the pins flying out of the cluster or back into it.
SPRINGscript.js1.5How far the pins overshoot their place before they settle (0 = not at all).
MAX_ZOOMscript.js6How far the map can be zoomed in.
LIFTscript.js5How many pixels a pin rises under the pointer.
STAGGERscript.js0.025The seconds between one pin and the next as they fly.
AUTOPILOTscript.jstrueLeft alone, the drawn pointer explores the map by itself, again and again.

Try them in the Playground

When to use it

For the store page of a chain, a network of offices or pickup points: when there are many places that would cover each other from far away, and you want people to see where each pin comes from as they zoom in.

On phones

The same animation with adapted sizes: the window takes almost the whole box, the stores pill keeps only the number, the search and the store card get narrower.

With reduced motion

No flights and no springs: the zoom jumps to its spot, the pins fade in and out at their place or in the cluster, the discs fade in. The drawn pointer jumps from one spot to the next without sliding.

Pitfalls

  • Working out the clusters from the current frame, while the zoom animates, makes them merge and split again and again halfway: they are worked out from the arrival zoom only.
  • The pin’s drop is rotated 45 degrees by CSS on the child, and the script moves the parent: on the same element, the position would wipe the rotation.
  • The thin map lines zoomed six times would become thick: vector-effect: non-scaling-stroke keeps them at one pixel.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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