Skip to content
animorio
IT
Back to the library

Carbon footprint

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

Scroll inside the preview

A scroll animation for the product page of a sustainable label: the carbon footprint of a recycled wool jacket, 12.4 kg CO2e, which breaks as you scroll into a bar split in five parts (materials, manufacturing, transport, packaging, end of life), each with its own row and a value that rolls in. Then the industry average arrives, a longer, fainter bar, and the saving lights up in moss green.

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>
<!--
  "Carbon footprint" 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>Carbon footprint</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>
    <!-- the product page of a made-up sustainable label: the stage stays still while you scroll and the jacket's
         carbon footprint breaks into its parts, then meets the industry average -->
    <section class="storia" data-storia>
      <div class="palco">
        <article class="card" data-card>
          <header class="card__head" data-entra>
            <p class="marca">Loamline</p>
            <p class="prodotto"><span class="prodotto__nome">Fell Jacket</span><span class="prodotto__mat">Recycled wool</span></p>
          </header>

          <div class="totale">
            <p class="etichetta" data-entra>Carbon footprint, per jacket</p>
            <p class="cifra" data-cifra>
              <span class="num num--grande" data-num="total" data-int="2" data-dec="1"></span>
              <span class="unita">kg CO<sub>2</sub>e</span>
            </p>
            <p class="badge" data-badge>
              <span class="badge__face">
                <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M6 2.2v7.2M2.9 6.5L6 9.6l3.1-3.1"/></svg>
                <span><span class="num" data-num="pct-saved" data-int="2" data-dec="0"></span>% below average</span>
              </span>
            </p>
          </div>

          <div class="grafico" data-grafico>
            <svg class="barre" data-svg aria-hidden="true">
              <defs>
                <pattern id="tratteggio" width="5" height="5" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
                  <rect width="5" height="5" class="tratteggio__fondo"/>
                  <line x1="0" y1="0" x2="0" y2="5" class="tratteggio__riga"/>
                </pattern>
              </defs>
              <rect class="media__fondo" data-media-fondo/>
              <rect class="risparmio__area" data-risparmio fill="url(#tratteggio)"/>
              <path class="media__bordo" data-media-bordo pathLength="1"/>
              <g data-parti-svg></g>
              <path class="media__riga" data-media-riga pathLength="1"/>
              <path class="nostra__riga" data-nostra-riga pathLength="1"/>
            </svg>
            <div class="tip" data-tip role="tooltip">
              <p class="tip__nome" data-tip-nome></p>
              <p class="tip__valore" data-tip-valore></p>
              <p class="tip__nota" data-tip-nota></p>
            </div>
          </div>

          <ul class="parti" data-parti>
            <li class="parte" data-parte><span class="parte__nome">Materials</span><span class="parte__pista"><span class="parte__pieno" data-pieno></span></span><span class="parte__kg"><span class="num" data-num="p0" data-int="1" data-dec="1"></span> kg</span></li>
            <li class="parte" data-parte><span class="parte__nome">Manufacturing</span><span class="parte__pista"><span class="parte__pieno" data-pieno></span></span><span class="parte__kg"><span class="num" data-num="p1" data-int="1" data-dec="1"></span> kg</span></li>
            <li class="parte" data-parte><span class="parte__nome">Transport</span><span class="parte__pista"><span class="parte__pieno" data-pieno></span></span><span class="parte__kg"><span class="num" data-num="p2" data-int="1" data-dec="1"></span> kg</span></li>
            <li class="parte" data-parte><span class="parte__nome">Packaging</span><span class="parte__pista"><span class="parte__pieno" data-pieno></span></span><span class="parte__kg"><span class="num" data-num="p3" data-int="1" data-dec="1"></span> kg</span></li>
            <li class="parte" data-parte><span class="parte__nome">End of life</span><span class="parte__pista"><span class="parte__pieno" data-pieno></span></span><span class="parte__kg"><span class="num" data-num="p4" data-int="1" data-dec="1"></span> kg</span></li>
          </ul>

          <footer class="confronto" data-confronto>
            <p class="confronto__media"><span>Industry average</span><span class="confronto__kg"><span class="num" data-num="avg" data-int="2" data-dec="1"></span> kg</span></p>
            <p class="confronto__salvo" data-salvo><span>You save</span><span class="confronto__kg"><span class="num" data-num="saved" data-int="1" data-dec="1"></span> kg</span></p>
          </footer>
        </article>

        <p class="cenno" data-cenno>
          Scroll to break it down
          <svg viewBox="0 0 12 16" aria-hidden="true"><path d="M6 2v11M2 9.2L6 13.2l4-4"/></svg>
        </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.

49 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 “Carbon footprint” 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 warm white page, in the middle, a light card with a soft shadow: at the top the made-up label Loamline and the product, ‘Fell Jacket’, in recycled wool. On arrival the big number rolls up to 12.4 kg CO2e and underneath a single dark bar fills from the left; the rows of the five parts wait, pale, at 0.0. As you scroll the stage stays still and the bar breaks: first materials, then manufacturing, transport, packaging and end of life come away one after the other on a spring tied to the scroll, each swells by a couple of pixels and settles, takes its warm grey and lights up its row, where a thin line grows and the value rolls digit by digit to its number. Then the bar shrinks to its share of the industry average, which draws itself underneath as a longer, fainter bar with a thin line at its end; the space between the two fills with moss green hatching, the mark of our end draws itself, ‘You save 9.4 kg’ lights up and next to the total the ‘43% below average’ pill springs in. Hovering a part (or tapping it) dims the others, the part lifts by a pixel and a dark tooltip tells its value, share and where it comes from.

How it works

A still stage

The section is SCROLL_LENGTH screens tall and holds a sticky stage 100lvh tall with the card in the middle. A paused GSAP timeline moves a few numbers (how far each part has split, how lit it is, the comparison, the saving) and a ScrollTrigger tween with scrub plays it back and forth.

The bar, drawn every frame

A ticker turns those numbers into SVG: each part is a path with round corners only where there is already a gap, so while the bar is whole no notches show. The gap between parts follows an elastic.out tied to the scroll: it passes the mark and comes back.

The rolling digits

Each number is made of columns holding the digits 0 to 9: the decimal column turns continuously, the others click over only when the one below goes from 9 to 0, like an odometer. The value chases its target on a spring integrated by hand, so it passes the mark by a hair and settles.

The average and the saving

The bar shrinks to 12.4 out of 21.8 while the average's outline draws itself with pathLength and stroke-dashoffset; then the line at the average's end, the green hatching (an SVG pattern) filling the difference and the saving pill on a spring.

The tooltip

The pointer over the bar or over a row looks for the part under it: the others dim, it lifts on a small spring and the tooltip glides above it with gsap.quickTo, kept inside the card.

Values to change

NameFileDefaultWhat it changes
SCROLL_LENGTHscript.js5How many screens of scrolling the whole story takes: more is slower.
MATERIALSscript.js5.2The kg CO2e of the materials.
MANUFACTURINGscript.js3.6The kg CO2e of manufacturing.
TRANSPORTscript.js1.9The kg CO2e of transport.
PACKAGINGscript.js0.6The kg CO2e of packaging.
END_OF_LIFEscript.js1.1The kg CO2e of end of life.
AVERAGEscript.js21.8The industry average, the longer bar.
GAPscript.js5The gap between the parts once they split, in pixels.
SPRINGscript.js0.45How much the parts spring as they split: lower wobbles more.
ROLL_STIFFNESSscript.js210The spring of the rolling digits: higher is quicker.
ROLL_DAMPINGscript.js21Lower lets the digits pass the mark and come back.

Try them in the Playground

When to use it

For the product page of a sustainable fashion or design label, a sustainability report, an app that measures emissions, or any figure to break into its parts and set against an average.

On phones

The same animation with adapted sizes: the card takes almost the whole width, the number and the spaces are measured on the height too, and the tooltip opens by tapping a part or a row.

With reduced motion

No springs, no rolling digits, no smooth scrolling: at each step the card dims and comes back with the step already done, the part split, the value in place, and at the end the average and the saving.

Pitfalls

  • A bar made of fully rounded rectangles shows notches even when whole: corners round only on the side where the gap has already opened.
  • Digit columns padded above and below let a piece of the next digit show: the column is exactly one digit tall (1.2 em) and the fade only covers the edge.
  • An elastic.out tied to a scrubbed scroll bounces on the way back too: that is fine, but the gap must never go negative.

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 10 KB; the libraries: GSAP + ScrollTrigger 45 KB, Lenis 5.3 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 animations