Two-sided 3D hardcover book with live HTML pages

I wanted to know if one WebGL 2 canvas could curl both sides of a live HTML leaf across a shaded book spine, while links, checkboxes, notes and text selection still work on the open spread. Drag any outer page corner to turn a leaf, hold a turn mid-air with the slider, or drag the silk ribbon in the gutter.

Field Guide, Vol. IV

Field Notes on Drawn Paper

Six live HTML leaves bound across one WebGL 2 canvas.

Drag the bottom-right corner to open.

II. Field notesVerso

Binding live DOM to a cylinder

Each leaf in this book pairs two ordinary HTML sections as front and back textures on one 28 by 18 mesh. When a corner lifts, the vertex shader rolls the sheet round a cylinder anchored to the spine.

Select any sentence here on the open spread, or toggle the note below. The change repaints this page and shows through on the curled underside of the cover leaf.

2Live typography
III. Bench checklistRecto

Things to test on the spread

Tick items as you try them. The count updates the colophon on page 6.

1 of 5 ticked
Interactive form3
IV. Compass plateVerso

Inline SVG figure

N S E W
4Inline SVG
V. Margin notesRecto

Editable notebook

Write a note here, then drag the corner to see your text curl over the spine.

16 words, 102 characters
Live textarea5
VI. ColophonVerso

Credits and progress

Bound for P. Kinlan.

Builds on the single-corner HTML page-peel shader in /view-source/, classic page-curl UIs such as Apple Books and Turn.js, and the cylindrical page-curl geometry described by W. David MacDonald and Calin-Andrei Burloiu.
Spread 1 of 4 visited
6Colophon

Starting book canvas…

Show the code the six pages, the cylindrical curl shader, the mesh, hit testing and drag
  1. The six drawable pages. Each page sits directly inside one <canvas content="drawable" layoutsubtree> as a drawable section.
  2. The cylindrical curl shader. One WebGL 2 program bends the leaf round a rolling cylinder, picks front or horizontally mirrored back via gl_FrontFacing, and shades the spine gutter and roll crest.
  3. The 28 by 18 mesh on ElementGL. The page opens one WebGL 2 context through new ElementGL() and builds the subdivided leaf mesh and flat spread quad on stage.gl.
  4. Uploading, drawing and syncing hit boxes. Every paint event uploads changed pages with stage.upload(), draws the spread and curling leaf, and updates updateElementGeometry() plus inert and dataset.hitTick. If WebGL 2 isn't available, a 2D folded-slice route draws with 5-argument and 9-argument drawElementImage().
  5. Corner drag and silk ribbon. Dragging past 40% completes the page turn; releasing earlier springs back. Dragging the ribbon snaps the bookmark to the open spread.

How it works

Live checks

Each check builds its own small fixture on the hidden test stage and retires its canvas when done. The visible book above isn't touched.

ResultExperimentDetail

Findings

Live browser runs in Chromium 157 and Chrome 159 on Android are not verified yet. Press "Run these 7 checks" above to measure your browser.

On this device: turn a page or drag the curl slider to record canvas size, paint count and active route here.