Skip to content
animorio
IT
Back to the library

Charts that draw themselves

Bars, a donut and a dot grid draw along with scrolling, with numbers counting; scrolling back takes them apart.

Scroll, SVGGSAPMediumLifetime

Scroll inside the preview

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN.

The code for this animation is part of lifetime access.

The preview stays open: watch it, slow it down, try it on your phone.

Lifetime access

What it does

A report page with three charts. As you scroll, the bars grow from the bottom one after another, the donut closes its arc up to the value and a hundred dots light up one at a time up to the right number; each number counts along with its drawing. The chart is not an animation that starts and ends: it is tied to scrolling, so it can stop halfway, and scrolling back takes it apart.

How it works

Hand-made SVG charts

No chart library: three rectangles, two circles and a hundred small circles. Values live in data-valore attributes, so the chart can be read in the code too.

Bars from the bottom

Each bar goes from scaleY 0 to its value divided by a hundred. On SVG the origin must be given to GSAP (transformOrigin 50% 100%): a CSS one adds to it and the bar ends up below the baseline.

The donut

A circle with a wide stroke: stroke-dasharray equal to the circumference, and stroke-dashoffset going down to the part to leave empty. Rotated by -90 degrees, it starts at noon.

Numbers and dots tied to the timeline

Numbers count through an object { n } in the same timeline as the drawing. Dots light up with a class: going backwards the class must be removed by hand in onUpdate, because scrub does not remove it.

Values to change

NameFileDefaultWhat it changes
INIZIO / FINEscript.jstop 78% / center 48%When the chart starts and finishes drawing.
PARALLASSEscript.js6How far the card slides while crossing the screen.
data-valoreindex.html72, 64, 41, 68, 37The values: sample numbers, put yours.

When to use it

For reports, annual results, impact pages, project data. Keep the figure written next to the chart: screen reader users find it in the SVG title.

On phones

Text above, chart below, full width. The drawing stays tied to scrolling.

With reduced motion

The charts are already drawn and the numbers already at their value.

Pitfalls

  • On SVG do not set transform-origin in CSS if you animate with GSAP: give it to GSAP. The two add up and the shape moves.
  • Classes added with call() in a scrubbed timeline are not removed when going backwards: manage them in onUpdate from the progress.
  • A scroll-bound chart must finish before the card leaves the screen, or nobody sees it complete: here it finishes when the card’s centre is mid-screen.

Libraries

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

Weight: 16 KB of our own files.

Testing

Tested on 27 September 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