Hi everyone! Over the weekend I put together LeafThrough, a reusable TypeScript/three.js library for page-turning magazines.
The starting point was the magazine interaction on Paper Mono. I liked how its pages deform and respond to dragging, so I reverse-engineered that behavior and built a reusable implementation in three.js.
In LeafThrough, each page is a shader-deformed mesh. There’s an open-spread layout and a single-page layout where turned pages roll up behind the magazine. I also packaged it with vanilla JS, React, Vue, Svelte, and Web Component entry points.
I’d be interested in feedback on the library side: would this be useful in a real project? Is anything awkward about the API or the page-turn interaction on your device?
This is really nice. Doing the bend in the vertex shader instead of a cloth sim makes a lot of sense for something people will drag around on phones, and the roll-up behind the magazine in single-page mode is a clever way to save screen space.
To answer the “would this be useful” question: yes, I could see it in a real project. Digital catalogues, lookbooks and event programmes are the obvious ones, and I’d honestly consider it for a small “featured this week” booklet on a video site I work on.
A few things I’d look for as a user of the library:
Lazy loading of page textures, so a 60-page catalogue doesn’t have to fetch every image up front. A hook like onPageNeeded(index) would cover it.
Keyboard and accessibility support: arrow keys to turn pages, plus a way to expose the page text to screen readers, since it all lives on a canvas.
A programmatic goToPage(n, { animate }) together with events for turn start and turn end, so it can be synced with a URL hash or a table of contents.
A clear dispose() that frees the geometries, materials and textures, because in SPA routing it’s easy to leak those when the component unmounts.
Having React, Vue, Svelte and a Web Component entry point out of the box is a big plus too.