Solid.js scroll animation
Solid’s fine-grained reactivity means an animation library must not force re-renders to move a value, and this one does not — the draw runs outside the reactive graph entirely, driven by scroll position. The example animates a signal feeding two memos into an effect, which is a fitting subject: the diagram explains the model the code is written in.
The code
A payments API's public status page. Each service's 24-hour latency line draws as its row scrolls in — the webhook incident spike included — written here as you would in Solid with useScrollDraw.
import { useScrollDraw } from 'svg-scroll-draw/solid';
import { For } from 'solid-js';
function Sparkline(props) {
const ref = useScrollDraw({
trigger: { start: 'top 92%', end: 'top 55%' },
easing: 'ease-out',
once: true,
});
return (
<div ref={ref} class="spark">
<svg viewBox="0 0 480 60"><path d={props.d} /></svg>
</div>
);
}
<For each={services}>{(s) => <Sparkline d={s.latency} />}</For>
A payments API’s live status page
Paygrid status
Related examples
MIT licensed, zero runtime dependencies. Every API is a separate entry point, so you only ship what you import. Full API reference →