Skip to content
animorio
IT
Back to the library

Floor plan scroll

Scroll, SVGGSAPMediumCompressed weight: Demo 14 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A scroll animation for the page of a holiday flat to rent, Casa Lanterna in Lisbon: on a sheet of drafting paper the floor plan draws itself like by hand, one room at a time, with the thick walls traced by a pencil that follows the tip, then the windows, the doors with their swing and the furniture in thin lines. When a room is closed a warm tone spreads from its door and beside it, in a card, the real photo of that room opens with its name and its square metres rolling up. At the end the dimensions, the 86 m² total and the ‘Check availability’ button that lights up.

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>
<!--
  "Floor plan scroll" 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>Casa Lanterna, Lisbon: the floor plan</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/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- the floor plan section of a made-up holiday flat, Casa Lanterna in Lisbon. A sticky stage with the plan on a
       sheet of paper: as you scroll it draws itself like by hand, one room at a time (the walls, then the doors with
       their swing and the windows, then the furniture in thin lines). When a room is closed it fills with a warm tone
       and the card beside it shows a real photo of that room, with its name and its square metres rolling up. At the
       end the total and the button to check the dates -->
  <section class="corsa" data-corsa>
    <div class="palco" data-palco>
      <header class="testa">
        <span class="marchio">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M10 1.8v2.4M7.2 4.2h5.6l1.2 2.2v8.2l-1.2 2.2H7.2L6 14.6V6.4l1.2-2.2Z"/><path class="fiamma" d="M10 8.2c.9 1 1.5 1.8 1.5 2.7a1.5 1.5 0 0 1-3 0c0-.9.6-1.7 1.5-2.7Z"/></svg>
          Casa Lanterna
        </span>
        <span class="testa-destra"><span class="lungo">Alfama, Lisbon</span> <i class="lungo"></i> <span>2 bedrooms</span> <i></i> <span><b>86</b> m²</span></span>
      </header>

      <div class="scena">
        <!-- the sheet with the plan -->
        <figure class="foglio" data-foglio>
          <div class="foglio-dentro">
            <svg class="pianta" data-pianta viewBox="-6 0 616 414" role="img" aria-label="Floor plan of Casa Lanterna: living room, kitchen, two bedrooms, bathroom and terrace">
              <defs>
                <pattern id="tratteggio" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
                  <path d="M0 0v6" class="tratto"/>
                </pattern>
              </defs>
              <g data-guide class="guide"></g>
              <g data-riempimenti></g>
              <g data-arredi class="arredi"></g>
              <g data-aperture class="aperture"></g>
              <g data-muri class="muri"></g>
              <g data-etichette class="etichette"></g>
              <g data-matita class="matita" aria-hidden="true">
                <path class="matita-legno" d="M0 0 L5 -13 L-5 -13 Z"/>
                <path class="matita-punta" d="M0 0 L1.7 -4.4 L-1.7 -4.4 Z"/>
                <path class="matita-corpo" d="M-5 -13 h10 v-30 h-10 Z"/>
                <path class="matita-riga" d="M-1.6 -13 v-30"/>
              </g>
            </svg>
          </div>
          <figcaption class="cartiglio">
            <span>Floor plan, third floor</span>
            <span class="cartiglio-destra"><span data-totale>0</span> <span class="di">of 86 m²</span></span>
          </figcaption>
          <span class="barra" aria-hidden="true"><b data-barra></b></span>
        </figure>

        <!-- the card with the photo of the room -->
        <article class="carta" data-carta>
          <div class="foto" data-foto>
            <div class="foto-vuota" aria-hidden="true">
              <svg viewBox="0 0 24 24"><path d="M3.5 6.5h17v11h-17z"/><path d="m3.5 15 5-4.5 4 3.5 2.5-2 5.5 4.5"/><circle cx="15.5" cy="9.5" r="1.4"/></svg>
            </div>
          </div>
          <div class="carta-testo">
            <div class="piccolo" data-piccoli></div>
            <div class="nomi" data-nomi></div>
            <div class="riga-mq">
              <span class="mq"><span data-mq>0</span><small> m²</small></span>
              <span class="nota" data-nota></span>
            </div>
            <div class="fine" data-fine>
              <span class="fine-totale"><b>86 m²</b> from €148 a night</span>
              <a class="pillola" href="#" data-pulsante>
                <span class="pillola-fondo" aria-hidden="true"></span>
                <span class="pillola-testo">Check availability</span>
                <svg class="pillola-freccia" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9M8.5 4.5 12 8l-3.5 3.5"/></svg>
              </a>
            </div>
          </div>
        </article>
      </div>
    </div>
  </section>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/ScrollTrigger.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/lenis@1.3.26/dist/lenis.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.

27 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 “Floor plan scroll” 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 cream page with a veil of grain, at the top the ‘Casa Lanterna’ mark with its lantern and terracotta flame, and on the right ‘Alfama, Lisbon’, ‘2 bedrooms’, ‘86 m²’. In the middle a drafting sheet with a grid that fades at the edges, a 1 pixel border, light on its top edge and a soft three-layer shadow; beside it a light glass card with an empty photo slot. As you scroll the pencil starts from the living room: first the thin terracotta construction lines that run a little past the corners, the way an architect draws, then the thick walls one after the other, with the yellow pencil following the tip and swaying slightly; then the windows, the front door with its swing, and the furniture in thin lines: the rug, the coffee table, the sofa with its cushions, the armchair, the round table with four chairs, the plant. Once the room is closed, a warm tone spreads from the door like a water stain, the name and ‘24 m²’ appear, and in the card the real photo of the living room opens from the bottom and settles from its zoom, with the frosted tag ‘South light, two windows’; the name slides up, ‘Shared space’ above, ‘Sofa bed, reading chair’ on the right, and the square metres and the total at the foot of the sheet climb. Then the kitchen with its counter, sink, hob, fridge, island and three stools; the bedroom with the double bed, pillows, turned-down sheet, bedside tables and wardrobe; the bathroom with the tub, basin and toilet; the second bedroom with the two-leaf French doors, single bed and desk; the terrace with its double railing, the hatching, the table for two, the lounger and the planters, and the photo of the Alfama rooftops. Each new room softens the others. At the end all the rooms take the same tone, the dimensions ‘9.55 m’ and ‘7.80 m’ draw themselves, the total reaches 86 and the ‘Check availability’ button, grey until then, lights up in terracotta with a small bounce. The button is an elastic pill: on hover it swells and the arrow steps forward, pressed it squashes, on click the arrow slips out and back and the label becomes ‘12 nights free in Dec’. Scrolling back erases everything in reverse.

How it works

The house written as data

Each room is an object with its name, square metres, photo and its lines in plan units (the sheet is 616 by 414): walls as segments [x1, y1, x2, y2, outer?] with the gaps for doors and windows already left, openings built by three functions (the door from its hinge, closed end and open end, with the arc worked out from the cross product; the window with its two faces and the glass; the double railing) and furniture as SVG paths made by small helpers (rectangle, circle, ellipse, rounded rectangle).

Every line draws with an attribute

Each path measures its length with getTotalLength() and gets stroke-dasharray ‘length length+1’ and stroke-dashoffset equal to the length, as attributes. GSAP takes the attribute to 0 (attr: { 'stroke-dashoffset': 0 }). Walls go at a steady speed (DRAW_SPEED units per second, ease none), one after the other; doors, windows and furniture quicker with sine.inOut.

The pencil follows the tip

Every stroke drawn is logged in a list with its start, end and curve. On every timeline update the active stroke is found, its curve is applied to the elapsed time and getPointAtLength() gives the point where the pencil goes, turned 22 degrees plus a slow sway. Between strokes the pencil fades out with quickTo.

The tone that spreads from the door

Each room's fill is a rectangle inside a clipPath with a circle centred on the door: GSAP grows the r attribute from 0 to the distance of the farthest corner. The terrace also has a 45 degree hatch pattern. Each new room lowers the one before to 55 %, at the end they all go back to 80 %.

The card and the numbers

The photos sit one on top of the other: the new one opens with clip-path from inset(100% 0 0 0) to inset(0) and comes down from 1.14 to 1, the old one shrinks to 0.96. Name, type and note are stacks of lines that slide up with back.out. Square metres and total are two properties of an object the timeline moves; the timeline's onUpdate writes them rounded.

Scroll drives everything

The timeline is paused and ScrollTrigger moves it back and forth (scrub 0.4) while the 100lvh stage stays pinned; the section's height comes from the timeline's length. Lenis smooths the wheel. Thin lines stay one pixel at every width: the script writes into --px how many plan units make a pixel and the CSS multiplies the stroke width.

Values to change

NameFileDefaultWhat it changes
DRAW_SPEEDscript.js520How fast the pencil draws the walls, in plan units per second of the timeline.
RIDEscript.js1How much scroll the plan takes: 2 is twice as long.
SMOOTHscript.js1Seconds the smooth scroll takes to catch up with the wheel.
ROOM_TONEscript.js1How strong the warm tone of a finished room is (0 none).
PHOTO_ZOOMscript.js1.14How zoomed in each photo is when it arrives.
PENCILscript.js11 shows the pencil that follows the line, 0 hides it.
PRICEscript.js148The price a night next to the button, in euros.

Try them in the Playground

When to use it

For the page of a holiday home, a flat to rent, an estate agency or an architecture studio: when you want to show how the home is laid out room by room, tying each room of the plan to its photo, and lead whoever scrolls down to the booking button.

On phones

The same animation with adapted sizes: the sheet goes on top, as wide as the screen and sized on its height too, the card goes underneath sideways, with the photo on the left and the name, square metres and button on the right; on the plan only the square metres stay, and the thin lines stay one pixel. You scroll with your finger.

With reduced motion

The floor plan is already fully drawn, with the rooms coloured, the dimensions and the button lit; as you scroll the card moves from one room to the next with a fade only, no pencil and no movement.

Pitfalls

  • stroke-dasharray must be written as ‘length length+1’: with the length alone, closed paths sometimes keep a dot at the start.
  • pathLength and vector-effect: non-scaling-stroke together with dashes behave differently across browsers: better to measure the real length and set the stroke width with a CSS variable.
  • The photos start with the closed clip-path set by GSAP before the timeline, or on the first frame they all show, one on top of the other.
  • In the timeline, fromTo tweens on the same object (the square metres) need immediateRender: false, or the last one writes its starting value at once.
  • The frosted tag of the photo underneath shows through the one on top: it must be switched off when the new room arrives.

Libraries

GSAP 3.15.0, ScrollTrigger 3.15.0, Lenis 1.3.26, Mona Sans (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 14 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 KB.

Testing

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