Skip to content
animorio
IT
All components

Roof quote slider

Sliders, SVG, PhysicsGSAP, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The quote slider of Tilewright, a made-up roofing company, in a white card from a premium shot. At the top sits a roof plane drawn in thin lines, and as you drag the area slider, from 40 to 240 m², the tiles settle row by row from the eave to the ridge with a small staggered bounce, the last row half full. The price estimate rolls like a counter and settles by a pixel, a Clay, Slate, Metal switch changes the colour and shape of the tiles in a wave, a light passes over the roof and the Get a quote button 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>
<!--
  "Roof quote slider" 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>Roof quote slider</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 roof estimate of Tilewright, an invented roofing company: a roof plane drawn in thin lines that fills with
         tiles row by row while the area slider moves, a material switch, a rolling price and the Get a quote button -->
    <section class="quote" aria-labelledby="q-title" data-card>
      <header class="quote__head">
        <div>
          <h2 class="quote__title" id="q-title">Roof estimate</h2>
          <p class="quote__sub">Tilewright · Full re-roof, fitted</p>
        </div>
        <span class="rate" aria-label="Price per square metre">$<span class="roll" data-roll-rate></span><span class="rate__unit">/m²</span></span>
      </header>

      <div class="roof" data-roof>
        <svg class="roof__svg" viewBox="0 0 300 134" preserveAspectRatio="xMidYMid meet" aria-hidden="true" data-svg>
          <defs>
            <clipPath id="roof-clip"><path d="M14 118 L70 18 L230 18 L286 118 Z"/></clipPath>
            <linearGradient id="roof-light" x1="0" x2="1" y1="0" y2="0">
              <stop offset="0" stop-color="#fff" stop-opacity="0"/>
              <stop offset="0.5" stop-color="#fff" stop-opacity="0.55"/>
              <stop offset="1" stop-color="#fff" stop-opacity="0"/>
            </linearGradient>
            <linearGradient id="roof-shade" x1="0" x2="0" y1="0" y2="1">
              <stop offset="0" stop-color="#000" stop-opacity="0"/>
              <stop offset="1" stop-color="#000" stop-opacity="0.12"/>
            </linearGradient>
          </defs>
          <path class="roof__plane" d="M14 118 L70 18 L230 18 L286 118 Z"/>
          <g class="roof__guides" data-guides></g>
          <g clip-path="url(#roof-clip)">
            <g class="roof__tiles" data-tiles></g>
            <rect x="0" y="0" width="300" height="120" fill="url(#roof-shade)" class="roof__shade" data-shade/>
            <g data-light><path d="M-40 0 L-6 0 L-46 120 L-80 120 Z" fill="url(#roof-light)"/></g>
          </g>
          <path class="roof__edge" d="M14 118 L70 18 L230 18 L286 118 Z"/>
          <line class="roof__ridge" x1="70" y1="18" x2="230" y2="18" data-ridge/>
          <g class="roof__chimney"><rect x="196" y="2" width="17" height="30" rx="1.5"/><rect class="cap" x="193.5" y="0.5" width="22" height="4" rx="1.2"/></g>
          <path class="roof__gutter" d="M8 121.5 H292" />
          <path class="roof__wall" d="M30 124 V134 M270 124 V134" />
        </svg>
        <span class="roof__fill" aria-hidden="true"><span data-roll-pct class="roll"></span>% tiled</span>
      </div>

      <div class="row">
        <div class="price" data-price>
          <span class="price__key">Estimate</span>
          <span class="price__val" data-price-val>$<span class="roll" data-roll-price></span></span>
        </div>
        <div class="mats" role="radiogroup" aria-label="Material" data-mats>
          <span class="mats__pill" aria-hidden="true" data-pill></span>
          <button type="button" role="radio" class="mat" data-mat="clay" aria-checked="true">Clay</button>
          <button type="button" role="radio" class="mat" data-mat="slate" aria-checked="false" tabindex="-1">Slate</button>
          <button type="button" role="radio" class="mat" data-mat="metal" aria-checked="false" tabindex="-1">Metal</button>
        </div>
      </div>

      <div class="area">
        <div class="area__head">
          <span class="area__key">Roof area</span>
          <span class="area__val"><span class="roll" data-roll-area></span>&nbsp;m²</span>
        </div>
        <div class="slide" data-slide>
          <div class="slide__track" aria-hidden="true"><span class="slide__fill" data-fill></span></div>
          <div class="ticks" aria-hidden="true" data-ticks></div>
          <span class="thumb" role="slider" tabindex="0" aria-label="Roof area in square metres" data-thumb>
            <span class="thumb__body" data-body><span class="thumb__core" data-core></span></span>
          </span>
        </div>
      </div>

      <button class="cta" type="button" data-cta>
        <span class="cta__face" data-cta-face>
          <span class="cta__glow" aria-hidden="true" data-glow></span>
          <span class="cta__sweep" aria-hidden="true" data-sweep></span>
          <span class="cta__words" data-cta-words>Get a quote</span>
          <svg class="cta__icon" viewBox="0 0 16 16" aria-hidden="true" data-cta-icon><path class="arr" d="M3.5 8h8.2M8.4 4.4 12 8l-3.6 3.6"/><path class="chk" d="M3.6 8.4 6.6 11.2 12.4 4.8"/></svg>
        </span>
      </button>
      <p class="sr" aria-live="polite" data-live></p>
    </section>

    <svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer>
      <path d="M5 3.2l13.6 8.3-6 1.2-3.1 5.6z"/>
    </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.

39 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 “Roof quote slider” 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 white ground there is a single white card with wide corners, its one pixel edge catching the light at the top, a soft layered shadow with a thread of brick and a very fine grain. At the top Roof estimate, under it Tilewright · Full re-roof, fitted, and on the right the small price per square metre tag. In the light panel below sits a roof plane seen from the front, a trapezoid in thin lines with the guide lines of the rows, the ridge, a chimney, the gutter and the tops of the walls; in a corner the share that is tiled. When it opens the thumb starts at the minimum and runs on a spring to 120 m², and the tiles fall from above and settle one after another from the eave upwards, each with a small squash and a bounce, until the last row is half full; then a slanted light crosses the roof. Below, on the left the estimate in dollars, on the right the Clay, Slate, Metal switch with the white pill sliding with a small overshoot. The slider has a thin track filling with brick, ticks every 20 m² that light up and snap as the thumb passes them, and a white thumb with a diamond that swells when grabbed and stretches as it runs. Dragging fills or empties the rows (the tiles leaving lift and vanish), and the area, the price and the percentage roll digit by digit. Let go, the value settles on a multiple of five, the price rises two pixels and comes back with a settle, the light passes over the roof again and the black Get a quote button lights up in brick with a swell and a sheen running across it. Changing the material changes the colour and shape of the tiles (round clay tiles, slate slabs, metal panels with a rib) in a wave that turns them from the eave to the ridge, and the price changes. Pressed, the button becomes Quote requested with a check that draws itself, then comes back. Until someone touches it, a drawn pointer takes the slider to the end, picks Slate, brings it down, picks Metal, asks for the quote and goes back to Clay.

How it works

The roof plane and its tiles

The roof plane is an SVG trapezoid: for each row the edges at that height are worked out and the tiles are laid offset by half a tile every other row, cut by the trapezoid’s clipPath. The rows are added from the eave up and each tile reaches a little down over the row below, so every course laps over the top of the lower one as on a real roof; they are laid in the same order, left to right.

How many tiles for the area

The drawn area (the spring’s one) becomes the share of tiles laid: area over the maximum times the number of tiles. When the number goes up, the new tiles fall with a small staggered timeline (drop, squash, elastic bounce); when it goes down they lift and vanish from the last one. The last row stays half full on its own.

The thumb’s spring

The finger’s value and the drawn one: on every frame of GSAP’s ticker a damped spring pulls the second towards the first, with the step capped at 1/30 of a second. The diamond inside the thumb stretches with the speed, and the ticks light up and snap as the drawn value passes them.

Rolling digits and the material

Price, area, rate and percentage are columns from 0 to 9 moved by yPercent, with a fixed thousands comma. The material changes a CSS colour variable and the path of every tile (round clay tile, bevelled slate, ribbed metal panel), and the laid tiles turn over in a wave with scaleY.

Values to change

NameFileDefaultWhat it changes
MIN_AREAscript.js40The smallest area, in square metres.
MAX_AREAscript.js240The largest area: at this the roof is fully tiled.
START_AREAscript.js120Where the slider sits when it opens.
STEPscript.js5How many square metres the slider moves by and the multiple it settles on.
BASE_PRICEscript.js1450The fixed part of the quote, in dollars.
RATE_CLAYscript.js86Dollars per square metre for clay.
RATE_SLATEscript.js124Dollars per square metre for slate.
RATE_METALscript.js68Dollars per square metre for metal.
ROWSscript.js8How many rows of tiles the roof has.
STIFFNESSscript.js380The spring pulling the thumb to the finger.
DAMPINGscript.js22Lower lets it pass the mark and come back.
SWELLscript.js1.24How much the grabbed thumb swells.
DROPscript.js9How high a tile falls from.
SPEEDscript.js1The speed of the round on its own.
AUTOscript.jstrueThe drawn pointer that plays with the slider until someone touches it.
--accentstyle.css#c2512aThe brick of the track, the ticks and the lit button.
--claystyle.css#c8643bThe colour of the clay tiles.
--slatestyle.css#4b5563The colour of the slate.
--metalstyle.css#9aa4adThe colour of the metal.

Try them in the Playground

When to use it

On the quote page of a roofing company, a builder or anyone selling panels and roofs: the visitor sees at once what they would spend and what they get, and the button to ask for the real quote is right there.

On phones

The card narrows to 90% of the screen and the roof gets shorter with the height of the box; the finger grabs the thumb like the mouse and a tap on the track brings it there. Nothing scrolls sideways while dragging.

With reduced motion

No springs, drops or self-moving pointer: the card fades in with the tiles already laid, the thumb follows the finger, the tiles fade in and out and the digits change without rolling.

Pitfalls

  • On a real roof every course laps over the top of the one below: the first version drew the rows the other way round, the low row over the high one, and the clay tiles looked like bricks because their round edge was hidden. The rows go into the SVG from the eave up, each tile stretched down over the row below.
  • The ticker writes the thumb’s transform on every frame: the press swell goes on the child (thumb__body) and the stretch on the diamond, or GSAP and the ticker cancel each other.
  • The tiles follow the spring’s value, not the finger’s: so on opening they settle while the thumb runs, and the spring’s bounce takes away and puts back the last tile like a settle.
  • The material pill is measured with offsetLeft and must be measured again on resize and when the font arrives, because the width of the three names changes with the wdth axis.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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