Skip to content
animorio
IT
Back to the library

Robot vacuum map

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

The live map in a robot vacuum’s app: the floor plan of a home with four rooms, the robot leaving its dock and cleaning one room after the other back and forth, leaving the cleaned stripes behind it. Each room counts its own percentage, below the square metres and the minutes climb and the battery drops; touching a room the robot leaves what it is doing and goes there first.

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>
<!--
  "Robot vacuum 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>Robot vacuum cleaning map with the rooms cleaned in stripes</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 live map of a robot vacuum's app: the robot leaves its dock and cleans one room after the other in
         stripes; every room counts its own percentage, and touching a room sends the robot there first -->
    <section class="bot" data-bot aria-label="Robot vacuum, cleaning map">
      <header class="bot__head">
        <div class="bot__title"><span>Juno S2</span><p class="roll"><span data-status>Ready on the dock</span></p></div>
        <p class="bot__batt" aria-label="Battery"><svg viewBox="0 0 22 12" aria-hidden="true"><rect class="batt__case" x="0.75" y="0.75" width="18" height="10.5" rx="3"></rect><path class="batt__tip" d="M20.6 4v4"></path><rect class="batt__fill" data-battfill x="2.6" y="2.6" width="14.3" height="6.8" rx="1.6"></rect></svg><span data-batt>86%</span></p>
      </header>

      <svg class="bot__map" data-map viewBox="-4 -4 328 212" role="group" aria-label="Floor plan">
        <defs><filter id="botShadow" x="-60%" y="-60%" width="220%" height="220%"><feDropShadow dx="0" dy="1.5" stdDeviation="1.8" flood-color="#16181d" flood-opacity="0.35"></feDropShadow></filter></defs>
        <g data-rooms></g>
        <rect class="dock" x="6" y="178" width="20" height="20" rx="6"></rect>
        <path class="way" data-way d=""></path>
        <g class="robot" data-robot filter="url(#botShadow)"><circle r="9"></circle><circle class="robot__ring" r="5.2"></circle><path class="robot__eye" d="M5.4 -3.4A6.4 6.4 0 0 1 5.4 3.4"></path></g>
      </svg>

      <div class="bot__chips" data-chips></div>
      <p class="bot__foot"><span><strong data-area>0</strong> m² cleaned</span><span><strong data-min>0</strong> min</span></p>
    </section>
    <p class="sr" data-live aria-live="polite"></p>

    <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>
  </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.

18 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 “Robot vacuum 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

On a light warm background, a white card: at the top the robot’s name, the rolling state (“Cleaning the living”, “Docked and charging”) and the battery. In the middle the floor plan, four rooms with rounded corners and their names; bottom left, the dock. The robot, a dark disc with a blue arc at its front, leaves the dock, turns towards the room, gets there along a dashed line and cleans it back and forth: behind it the light blue stripes remain, the percentage climbs next to the name and a fill advances in the room’s button below the map. With one room done it moves to the next; at the bottom the cleaned square metres and the minutes grow, and the battery drops. Moving over a room its edge lights up; touching it, the robot leaves the current one half done, goes there, and later comes back to finish the others from where it stopped. When the home is clean it returns to the dock, and after a couple of seconds the stripes fade and it starts again.

How it works

The path is the stripe

For each room the script builds a serpentine path, one pass every LANE units. The same path is drawn 14 wide and semi-transparent: its stroke-dashoffset uncovers the part already cleaned, and getPointAtLength at the same fraction gives the robot’s position. Robot and stripes cannot drift apart.

One number per room

Each room has a progress from 0 to 1, moved by a linear tween as long as the path divided by SPEED. From those four numbers one function rewrites percentages, button fills, square metres, minutes and battery.

Changing room

Touching a room the running tween is stopped (its number stays where it is), the robot travels in a straight line to the point of the new path where it must begin, turning with atan2, and starts again. When that is done, it resumes the first unfinished room from the exact point where it left it.

Values to change

NameFileDefaultWhat it changes
SPEEDscript.js330How fast the robot runs while cleaning, in map units per second.
LANEscript.js16The distance between one pass and the next.
TRAVELscript.js0.55How many seconds to move from one room to another.
RESTscript.js1.8How many seconds it stays on the dock after cleaning before starting again.
ACCENTscript.js#3b6cffThe colour of the cleaned stripes.
LOOPscript.jstrueLeft alone, it starts again and a pointer picks a room.

Try them in the Playground

When to use it

For the app or the landing page of a robot vacuum, a robot mower or a cleaning company, and for any map showing work that advances room by room: a paint job, an inspection, a delivery by floors. In a real product the plan and the position come from the robot.

On phones

The same card, as wide as the screen minus the margins and measured on the height too; rooms and buttons are touched with a finger, and there is no edge lighting up on hover.

With reduced motion

No running robot: the home is shown already cleaned, with the stripes in place, the percentages at 100% and the robot still on its dock.

Pitfalls

  • The dash length is the path’s real length (getTotalLength) plus a margin: with round caps, a dash exactly as long as the path lets its end show too early.
  • The robot’s heading is computed only once it has moved at least 0.4 units: between two nearly equal points atan2 gives random angles and the disc jitters.
  • The pointer that tries the demo restarts with each cleaning round instead of on its own clock: two separate clocks, after a few rounds, no longer agree.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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