Skip to content
animorio
IT
Back to the library

Bundle size

Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.4 KBGSAP 28 KBFreeDownload the zip

The weight of a JavaScript bundle, in a card on warm white, minimal style: a bar made of its five modules, the kB written large and a mark where the budget stands. Switching on “Minify”, “Tree-shake” and “Gzip” the modules shrink one after the other on a spring, each by its own amount, the kB count down and, when the bar passes under the mark, the budget gets its tick. Pointing at a module shows its name, weight and share.

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>
<!--
  "Bundle size" 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>Bundle size</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 weight of a JavaScript bundle: a bar made of its modules, three optimisations to switch on, the
         segments shrinking, the kilobytes counting down and the budget mark being met or missed -->
    <section class="bs" data-bs aria-label="Bundle size">
      <header class="bs__head">
        <div class="bs__file"><strong>app.js</strong><span>What ships to the browser</span></div>
        <p class="bs__total"><b data-outtotal>412</b><i>kB</i></p>
      </header>

      <div class="bs__meter">
        <div class="bs__track" data-track role="list" aria-label="Modules"></div>
        <i class="bs__mark" data-mark aria-hidden="true"></i>
        <span class="bs__budget" data-budget aria-hidden="true"><svg viewBox="0 0 12 12"><path pathLength="1" d="M2.400 6.300 4.900 8.700 9.700 3.500"></path></svg><span data-outbudget>Budget 170 kB</span></span>
      </div>
      <p class="bs__info"><span class="bs__clip"><span data-outinfo>Over budget by 242 kB</span></span></p>

      <div class="bs__opts" data-opts>
        <button type="button" aria-pressed="false" data-opt="minify"><i aria-hidden="true"><svg viewBox="0 0 12 12"><path pathLength="1" d="M2.400 6.300 4.900 8.700 9.700 3.500"></path></svg></i>Minify</button>
        <button type="button" aria-pressed="false" data-opt="shake"><i aria-hidden="true"><svg viewBox="0 0 12 12"><path pathLength="1" d="M2.400 6.300 4.900 8.700 9.700 3.500"></path></svg></i>Tree-shake</button>
        <button type="button" aria-pressed="false" data-opt="gzip"><i aria-hidden="true"><svg viewBox="0 0 12 12"><path pathLength="1" d="M2.400 6.300 4.900 8.700 9.700 3.500"></path></svg></i>Gzip</button>
      </div>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Bundle size” 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 warm white, a white rounded card: “app.js” and under it “What ships to the browser”; on the right, large, “412 kB”. Below, a bar as wide as the card made of five purple segments, from the darkest to the lightest: the modules. A little short of halfway a dark vertical mark, with “Budget 170 kB” above it; under the bar, “Over budget by 242 kB”. At the bottom three buttons with their checkbox: “Minify”, “Tree-shake” and “Gzip”. Pointing at a segment lifts it and the line says “charts: 96 kB, 23% of the bundle”. Tapping “Minify” fills the checkbox with its tick, the five segments shrink one after the other with a slight bounce and the number counts to “255”. With “Tree-shake” it is mostly the half-used libraries that shrink, the icons become a thin strip, and the bar passes under the mark: the mark gives a start, the label becomes “Within 170 kB” with a tick and below you read “Under budget by 23 kB”. “Gzip” takes it all to “48”.

How it works

The bar is the bundle as written

Its full width is the starting weight: each segment is a fraction of that, written as a percentage calculation, so it holds at any width.

Each optimisation has its own effect

Minifying and compressing take about the same from everything; tree-shaking takes a lot from partly used libraries and nothing from your own code.

The staggered spring

On changing a switch every segment goes to its new fraction on a spring, one after the other.

The mark

The budget is a position on the same bar: when the total goes under or over it, the label changes and the mark gives a start.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#6a4cffThe colour of the modules.
BUDGETscript.js170The maximum weight you set yourself, in kB.
STAGGERscript.js0.05How many seconds pass between one module and the next as they shrink.
SPRINGscript.js1How much the modules bounce when they change size.
LOOPscript.jstrueLeft alone, the demo’s pointer points at a module and switches on the three optimisations.

Try them in the Playground

When to use it

On the page of a build tool, a hosting service or a performance monitor; in the documentation of a library that wants to say how much it weighs; and in a developer’s portfolio, to tell the story of an optimisation. The same bar with its mark carries a spending budget, disk space or a meal’s calories.

On phones

The card is at most 348 pixels wide and about 255 tall. The three buttons sit on one row, 40 pixels tall; the thinnest segments keep at least 3 pixels, and with a finger a tap on a segment shows its text.

With reduced motion

No springs and no counting: segments, number, mark and texts are at the new value at once. The demo’s pointer does not start.

Pitfalls

  • The modules are told apart by position and by the text that appears when you point at them, not only by tint: they are five steps of one colour.
  • Every segment takes keyboard focus and says its name; the three buttons are real toggles (aria-pressed) and every change is announced with the total.
  • The verdict on the budget changes when the bar has got there, not at the tap: otherwise the label runs ahead of what you see.
  • The percentages each optimisation removes are plausible but invented: in a real project they depend on the code.
  • Module names and weights are invented.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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