scrollDrawTimeline · independent tracks

Independent scroll timelines

Sometimes elements should not share a timeline at all: axes belong at the very start of the scroll range, bars across the middle, a trend line at the end. scrollDrawTimeline gives each track its own window expressed in percentages of the scroll range, which is closer to authoring keyframes than to wiring up triggers — and it is the closest thing here to GSAP’s timeline model.

The code

Four quarterly bars and a trend line — each animated on its own independent scroll window using scrollDrawTimeline. Axes draw first (0→28%), then Q1–Q4 bars stagger across (10→88%), and the trend line traces last (75→100%) once all bars are fully visible.

Hero.tsx
import { scrollDrawTimeline } from 'svg-scroll-draw/timeline';

// Each track owns its own from/to slice of the scroll range.
// Unlike stagger (time offset), windows can overlap freely.
scrollDrawTimeline('#chart', {
  trigger: { start: 'top 88%', end: 'top 25%' },
  tracks: [
    { selector: '.axis',  from: 0,    to: 0.28, easing: 'ease-out' },
    { selector: '.bar-1', from: 0.1,  to: 0.42, easing: 'ease-out' },
    { selector: '.bar-2', from: 0.26, to: 0.56, easing: 'ease-out' },
    { selector: '.bar-3', from: 0.42, to: 0.72, easing: 'ease-out' },
    { selector: '.bar-4', from: 0.58, to: 0.88, easing: 'ease-out' },
    // Trend line draws only after all bars are visible
    { selector: '.trend', from: 0.75, to: 1.0,  easing: 'spring'   },
  ],
});

Live — scroll it

$0k$40k$80k$120kQ1$92kQ2$122kQ3$77kQ4$111kEach bar is an independent track
Axes
0%
Q1
0%
Q2
0%
Q3
0%
Q4
0%
Trend
0%
scroll
0%

Install

terminal
npm i svg-scroll-draw

MIT licensed, zero runtime dependencies. Every API is a separate entry point, so you only ship what you import. Full API reference →