Skip to content
animorio
IT
Back to the library

Price breakdown

ScrollGSAPMediumCompressed weight: Demo 8.6 KBGSAP + ScrollTrigger 45 KBLenis 5.3 KBFreeDownload the zip

Scroll inside the preview

A scroll story for a brand’s transparent pricing section: a premium product card with a fabric swatch, layered shadows, an edge that catches the light and a fine grain, and under the price a segmented bar. Scrolling cuts the bar where each cost ends (materials, labour, duties, transport, our margin): the piece takes its colour among olive, sand and clay, lifts with its shadow and a glint runs across it, while its row lights up and the digits roll. At the end the bar shrinks next to the shop price, hatched and struck through.

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>
<!--
  "Price breakdown" 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 price that breaks into its costs</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>
  <!-- the transparent pricing card of a clothing brand's product page. The price sits over one segmented bar, the
       price drawn as a length. Scrolling cuts the bar where each cost ends: the cut opens on a spring, the piece fills
       with its colour, lifts, and a glint runs across it, while its row below lights up and its amount rolls in.
       At the end the bar shrinks to make room for what the same shirt costs in a shop, and that price is struck
       through. Hover a row or a piece of the bar to light it again; a soft light follows the pointer on the card -->
  <main class="pagina">
    <section class="corsa" data-corsa aria-label="Where the price goes">
      <div class="palco">
        <article class="card" data-card>
          <div class="card__luce" aria-hidden="true"></div>
          <header class="testa">
            <div class="campione" aria-hidden="true"><span class="campione__trama"></span></div>
            <div class="testa__testi">
              <p class="testa__nome">Field overshirt</p>
              <p class="testa__sotto">Organic cotton, olive</p>
            </div>
            <p class="chip" data-chip><span class="chip__a">Transparent pricing</span><span class="chip__b">Half of retail</span></p>
          </header>
          <p class="prezzo" data-prezzo><span class="prezzo__valuta">€</span><span data-totale>148</span></p>
          <div class="barra" data-barra aria-hidden="true">
            <div class="barra__binario" data-binario></div>
          </div>
          <ul class="righe" data-righe></ul>
        </article>
        <p class="scendi" data-scendi>Scroll</p>
      </div>
    </section>
  </main>

  <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 “Price breakdown” 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 an oat-coloured page with a soft light in the middle and a fine grain, a light card rises with round corners, a wide layered shadow and a one-pixel edge that catches the light at the top. In its head an olive fabric swatch with a diagonal twill, the name “Field overshirt”, below it “Organic cotton, olive”, and on the right the chip “Transparent pricing”. Then the price, large, €148, and under it a sunken bar that fills from the left in warm grey: the price drawn as a length. Further down the names of the five costs, still dim. Scrolling the page, which stays pinned, cuts the bar where the first cost ends: the cut opens a few pixels on a spring, one pixel past and back, the piece turns dark olive, lifts three pixels with its shadow and a glint runs across it from left to right. The “Materials” row lights up with a veil of the same colour, gains weight, its share of the price appears, 26%, and the amount rolls in digit by digit to €38. At the next cut the piece before settles and the same happens to labour in sage, duties and transport in sand and our margin in clay. At the last step the bar shrinks on a spring to half and from its end a fine hatching reaches the edge: what the same shirt costs in a shop. Over the two ends €148 and €295 appear, the chip at the top turns to “Half of retail”, the “Typical retail” row rises and a clay hairline strikes its price. Pointing at a row or a piece of the bar lifts the piece again and the glint passes once more; on the card a soft light follows the pointer. Scrolling back undoes it all.

How it works

The price as a length

Every cost is a piece of the line as wide as its share of the price. The cuts are taken out of the pieces’ room, so the line keeps its length while it opens.

Scroll in stages

ScrollTrigger only gives the progress; the stage is the progress times the number of stages (the whole line, one cost per stage, the shop). Changing stage only changes the targets of the springs.

A spring for everything that moves

The cut, the accent, the line shrinking, the shop and the strike each have their own spring, integrated in steps of 1/120 of a second in the GSAP ticker: that is where the pixel past comes from.

Rolling digits

Every digit is a column from 0 to 9 behind a one-line window: the column rises by digit times the value of the cut’s spring, the tens a little behind the units. The glint is a soft-light gradient moved by a GSAP tween at every cut.

The shop

At the last stage the line narrows to the ratio between our price and the shop’s; the dashes run from its end to the edge, and the strike starts when the shop has nearly arrived.

Values to change

NameFileDefaultWhat it changes
RETAILscript.js295What the same shirt costs in a shop: the hatched stretch at the end.
GAPscript.js4How wide each cut opens, in pixels.
LIFTscript.js3How far the piece being explained lifts, in pixels.
SHEENscript.js1How bright the glint that runs across a piece when it is cut (0 = none).
STIFFNESSscript.js260The springs of the cuts and the pieces: higher is quicker.
BOUNCEscript.js0.32How far the springs go past before they settle (0 = not at all).
SMOOTHscript.js1.1Seconds of the smooth scroll; 0 for the browser’s own.

Try them in the Playground

When to use it

For the transparent pricing section of a clothing brand or a product sold direct, to tell where the money of a purchase goes; also for a service page that wants to show what is inside a subscription.

On phones

The same animation with adapted sizes: the card, the price and the rows are sized on the height too and fit the phone box up to the last step; the light that follows the pointer and the hovers only exist where there is a pointer.

With reduced motion

No movement: the card appears in a fade with the bar already cut in five colours and shrunk next to the shop, the whole list, “Half of retail” and the shop price struck through.

Pitfalls

  • The cuts must be taken out of the pieces’ room, not added: otherwise the line grows while it opens and its ratio to the shop price no longer holds.
  • The counting amount must be clamped between 0 and 1 of the spring: with the pixel past it would briefly count beyond the real value.
  • Until a cut opens the two neighbouring pieces keep square corners: with round ones the whole bar would show notches where no cost is explained yet.

Libraries

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

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

Testing

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