integration / lenissmooth scroll + scroll animation

Lenis + svg-scroll-draw, not a competition

Lenis is the smooth-scroll library everyone reaches for, and it comes up constantly as an “alternative” to scroll animation libraries. It is not one. Lenis eases the scroll itself; this library animates things against scroll position. They are complementary, they need nothing to join them, and that is why there is no /vs-lenis page here.

Short versionOn Lenis it just works, no adapter. Lenis 1.x scrolls the real page, so window.scrollY is always right.

Lenis 1.3.26
5.3 KB
svg-scroll-draw
11.9 KB
Adapter for Lenis
None
Native CSS path
Kept
lenis 1.xvirtual scrollerinput
wheel · touch
wheel · touch
smooth
lenis.raf(time)Eases the real scroll
scroller tickEases a virtual value
native
window.scrollYmoved by Lenis’s scrollTo()
window.scrollYnever updated — stale
adapter
noneNothing to add
createLenisAdapter(scroller)patches scrollY, restores on destroy
engine
scrollDraw()Reads the real value
scrollDraw()Reads the patched value
result
the path drawsIn step with the eased scroll
the path drawsIn step, once the adapter is in
Fig. 1 — where the scroll position travels, wheel to path
01lenis 1.x

Lenis 1.x: no adapter

Nothing special required. Every Lenis release so far is 1.x (2.0 exists only as development prereleases), and on every frame Lenis moves the real scroll position: its setScroll() calls scrollTo() with behavior: 'instant'. So window.scrollY follows the eased scroll, and every engine here reads it with no adapter and no configuration.

main.js13 lines
import Lenis from 'lenis';
import { scrollDraw } from 'svg-scroll-draw';

const lenis = new Lenis();

function raf(time) {
  lenis.raf(time);
  requestAnimationFrame(raf);
}
requestAnimationFrame(raf);

// No adapter: Lenis scrolls the real page, so window.scrollY is already right.
scrollDraw('#hero-svg', { easing: 'ease-out', speed: 1.2 });
02custom wrapper

A custom wrapper

Give Lenis a wrapper element and it scrolls that element instead of the window. Point the animation at the same element with scrollContainer. A custom scroll container is one of the options the CSS path cannot express, so those animations run on the JavaScript engine.

main.js9 lines
import Lenis from 'lenis';
import { scrollDraw } from 'svg-scroll-draw';

const wrapper = document.querySelector('#scroller');
const lenis = new Lenis({ wrapper, content: wrapper.firstElementChild });
// …the same rAF loop as above

// Lenis scrolls #scroller, not the window: point the draw at it.
scrollDraw('#hero-svg', { scrollContainer: wrapper });
03adapter

What the adapter is for

svg-scroll-draw/lenis is for a scroller that keeps its position in a virtual value and never moves the page, so window.scrollY goes stale and animations look frozen. It takes anything with Lenis’s on('scroll') shape, patches window.scrollY and window.pageYOffset to report that value, and puts the browser’s own properties back on destroy. CSS still reads the real position, which does not move, so pass native: false.

main.js12 lines
import { createLenisAdapter } from 'svg-scroll-draw/lenis';
import { scrollDraw } from 'svg-scroll-draw';

// `scroller` keeps a virtual position and emits
// 'scroll' with { scroll, velocity, direction, progress }.
const adapter = createLenisAdapter(scroller);

// CSS reads the real scroll position, which never moves here.
scrollDraw('#hero-svg', { native: false });

// On teardown: puts the browser's own window.scrollY back.
// adapter.destroy();
04the cost

What the pair costs

Nothing in speed: because Lenis moves the real scroll position, a CSS view-timeline follows it, and where the browser supports animation-timeline the draw still runs as a native CSS scroll animation with no per-frame JavaScript. Elsewhere the JavaScript engine reads window.scrollY on each frame, as it would without Lenis. What you pay is bytes:

Lenis1.3.26 · MIT5.3 KB
svg-scroll-draw2.31.0 · MIT11.9 KB
Both, togethersmooth scroll + animation17.2 KB
fig. 2 — what the pair costs, minified + gzipped, to one scale

Lenis 1.3.26 is 5.3 KB gzipped, MIT, last published 2026-08-05. svg-scroll-draw 2.31.0 is 11.9 KB. Measured 2026-08-14 at gzip level 9.

05questions

Questions

Q1

Does svg-scroll-draw work with Lenis?

Yes, with no adapter. Every Lenis release so far is 1.x, and on every frame Lenis moves the real scroll position: its setScroll() calls scrollTo() on the window with behavior "instant". So window.scrollY follows the eased scroll and every engine here reads the right value. Run Lenis’s rAF loop and call scrollDraw as usual.

Q2

Is Lenis an alternative to svg-scroll-draw?

No — they do different jobs and are designed to be used together. Lenis eases the scroll itself; svg-scroll-draw animates elements against scroll position. Neither replaces the other, which is why there is no versus page for Lenis on this site.

Q3

Then what is svg-scroll-draw/lenis for?

A scroller that keeps its position in a virtual value and never moves the page, so window.scrollY goes stale. createLenisAdapter takes anything with Lenis’s on("scroll") / off("scroll") shape, patches window.scrollY and window.pageYOffset to report its value, and puts the browser’s own properties back on destroy. Lenis 1.x does not need it.

Q4

What about Lenis v2?

There is no Lenis v2 release yet: 2.0 exists only as development prereleases, and lenis on npm is 1.x. Advice that splits Lenis into a v1 that needs an adapter and a v2 that patches scrollY matches no release: the 1.x line already scrolls the real page.

Q5

Does smooth scrolling hurt scroll animation performance?

Not with Lenis. Because it moves the real scroll position, a CSS view-timeline follows it, so where the browser supports animation-timeline the draw still runs as a native CSS scroll animation with no per-frame JavaScript. The exception is a virtual scroller patched by the adapter: CSS reads the real position, which does not move, so pass native: false there and let the JS engine draw.

06comparisons

Comparisons

Lenis adapter in the docs →