Skip to content
animorio
IT
Back to the library

Homes scatter chart

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

The listings card of an invented home search app, Mosswell: every home for sale in the neighbourhood is a point, size across and price up, with the dashed trend line through them. Hovering a point, it swells with a ring, dashed guides drop to both axes with their tags and a glass card opens with the address, the size, the price and the price per square metre against the area. Dragging draws a box: the homes inside turn blue one after the other with a small pop, the others fade back, the counter at the top rolls to ‘12 of 48’ and the averages below roll to their new values. Clear lets them all go. Clean, like a product shot.

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>
<!--
  "Homes scatter 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>The homes scatter chart with a box selection that lights up the points</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>
    <!-- one gesture: drag a box. The listings card of a made-up home search app, Mosswell: every home on sale in a
         neighbourhood is a point (size across, price up). Hovering a point shows its card and the dashed guides to the
         axes; dragging draws a box that lights up the homes inside, fades the others and rolls the summary below -->
    <section class="card" data-card aria-label="Mosswell listings in Northfield">
      <header class="card__head">
        <span class="card__brand">
          <svg class="card__mark" viewBox="0 0 20 20" aria-hidden="true">
            <path d="M3.5 9.2 10 3.8l6.5 5.4V16a.8.8 0 0 1-.8.8H4.3a.8.8 0 0 1-.8-.8Z"></path>
            <path d="M8 16.8v-4.6h4v4.6"></path>
          </svg>
          <span class="card__name">Mosswell</span>
          <span class="card__where">Northfield · for sale</span>
        </span>
        <span class="card__count" data-count><b data-count-n>48</b> <span data-count-of>homes</span></span>
      </header>

      <div class="plot" data-plot>
        <svg class="plot__svg" data-svg aria-hidden="true">
          <g data-grid></g>
          <g data-axes></g>
          <g class="trend" data-trend-g><path class="trend__line" data-trend></path></g>
          <g data-guides>
            <line class="guide" data-guide-x></line>
            <line class="guide" data-guide-y></line>
          </g>
          <g data-dots></g>
          <g class="brush" data-brush>
            <rect class="brush__fill" data-brush-rect></rect>
            <rect class="brush__h" data-h="0" width="7" height="7" rx="2"></rect>
            <rect class="brush__h" data-h="1" width="7" height="7" rx="2"></rect>
            <rect class="brush__h" data-h="2" width="7" height="7" rx="2"></rect>
            <rect class="brush__h" data-h="3" width="7" height="7" rx="2"></rect>
          </g>
        </svg>
        <span class="axis-tag axis-tag--x" data-tag-x></span>
        <span class="axis-tag axis-tag--y" data-tag-y></span>
        <span class="brush-label" data-brush-label></span>
        <div class="tip" data-tip role="status">
          <span class="tip__title" data-tip-title></span>
          <span class="tip__row"><span data-tip-size></span><span class="tip__dot"></span><span data-tip-price></span></span>
          <span class="tip__per" data-tip-per></span>
        </div>
        <span class="plot__unit plot__unit--y">€k</span>
        <span class="plot__unit plot__unit--x">m²</span>
      </div>

      <footer class="sum" data-sum>
        <div class="sum__item"><span class="sum__k">Average</span><span class="sum__v" data-avg>€5,210/m²</span></div>
        <div class="sum__item"><span class="sum__k">Median price</span><span class="sum__v" data-med>€398k</span></div>
        <span class="sum__hint" data-hint>Drag across the chart to compare</span>
        <button class="clear" type="button" data-clear aria-label="Clear selection"><span class="clear__in">
          <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3 3 9"></path></svg>Clear</span></button>
      </footer>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true">
      <path d="M5 3.2 18.6 13l-6 .9 3.4 6.6-2.6 1.3-3.4-6.6L5.6 19Z"></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.

30 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 “Homes scatter 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 paper coloured page a white card rises with a soft shadow. At the head the Mosswell mark with its drawn house, ‘Northfield · for sale’ and the ‘48 homes’ pill. Below it, the chart: the thin price rules, the axis numbers, and the forty-eight homes popping in from left to right, each with a small bounce; then the dashed trend line is uncovered from the left. A drawn pointer rests on a home: the point darkens and swells, a blue ring widens and fades, two dashed guides drop to the size axis and the price axis with their blue tags, and the glass card opens beside it, ‘2 bed flat, 18 Marl Court’, the size, the price and the price per square metre, ‘7% below the area’. Then the pointer presses and drags a box: the blue edges with four handles, the size and price label following the corner, the homes it catches turning blue with a hop while the others fade, and the counter at the top turning blue and following along. Released, the box settles by a hair, the average per square metre and the median price roll to the selection’s values and Clear appears; pressed, all the homes turn grey again and the numbers go back to the whole area.

How it works

A chart in real pixels

The SVG takes the size of its box and is rebuilt on resize: rules, axis numbers, trend line and points are written in pixels, so the points stay round and the selection box matches the pointer at any width.

The homes and the trend

The forty-eight homes come from a pseudo-random generator with a fixed seed: they are always the same. The trend line is the least squares line through all of them, and each home’s price per square metre is compared with the area’s average to write ‘below’ or ‘above’.

The nearest point

On hover the nearest point within eighteen pixels is found: it swells on a spring, a ring widens and fades, the two guides and the axis tags move to it and the glass card follows on a spring, flipping over when it would leave the edge.

The box

Pressing starts the box; on every move the homes inside are checked and only those that change state animate: inside they turn blue with a hop, in order of distance from the starting corner, outside they fade. The counter at the top follows live; on release, the averages roll to their new values.

The drawn pointer

Left alone, a GSAP timeline moves a drawn arrow and calls the same functions as the real mouse: it hovers a home, draws a box, reads it and presses Clear. As soon as a mouse or a finger is used it stops, and starts again after six quiet seconds.

Values to change

NameFileDefaultWhat it changes
HOMESscript.js48How many homes (points) are on the chart.
DOTscript.js4.6The radius of a point, in pixels.
POPscript.js1.55How much a point grows when the box catches it.
FADEscript.js0.28How visible the homes outside the box stay (0 to 1).
ENTRY_STAGGERscript.js0.022Seconds between a point and the next one coming in.
SPRINGscript.js1.6The bounce of the points and of the card (higher bounces more).
ROLLscript.js0.6Seconds for the numbers to roll to their new value.
IDLEscript.js1.6Seconds before the drawn pointer starts.
LOOPscript.jstrueThe drawn pointer plays the card again and again.

Try them in the Playground

When to use it

For a property listings site or app, an agency dashboard, a report on the prices of a neighbourhood or any page comparing many things on two numbers (products by price and rating, runs by distance and time).

On phones

The same animation with adapted sizes: the card is as wide as the box, the chart is measured on the height too, the glass card stays inside and a finger drags the box; the neighbourhood name hides.

With reduced motion

No hops, no springs, no rolling numbers: the homes are already in place, the box lights and dims the points without animation and the numbers change at once; the drawn pointer does not start.

Pitfalls

  • The box is checked in screen pixels, not values: on resize the chart is rebuilt and the points move back into place.
  • Only the homes that change state animate on each move, otherwise forty-eight tweens restart on every pixel.
  • The drawn arrow calls the same functions as the mouse, and real events check isTrusted so it does not stop itself.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.4 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