Thumb-scrubbed page peel back navigation
I wanted to know if I could pair an inset 28 px swipe gutter with a 3D cylinder page-peel shader over two live drawable screens inside one WebGL 2 canvas. Drag right from the orange-tinted left rail to peel the detail screen away, inspect the shaded cream underside and parallax inbox underneath, and release mid-swipe to commit or spring back.
Starting canvas…
Show the code two drawable screens, 3D cylinder curl shader, gutter spring, geometry sync and 2D fallback
- Two live drawable screens in one canvas. Both
#view-listand#view-detailsit inside<canvas content="drawable" layoutsubtree>, withinertdisabling whichever screen sits underneath. - Analytic 3D cylinder page-peel shader. Renders
#view-listat-24%to0%parallax with a soft cast shadow, wraps#view-detailround the cylinder arc, and paints the shaded cream underside flap with faint bleed-through. - Safe inset gutter threshold and spring settle. Restricts swipe starts to
x <= 32(unless Any-x swipe is enabled) and solves a damped spring on release to commit past 42% or cancel back to the detail screen. - Hit-box calibration with
geometryUnit(). Applies parallax translation to#view-list, flipsinertandpointer-eventscleanly, callsupdateElementGeometry()and togglesdataset.hitTick. - Five-argument 2D and plain-HTML fallbacks. Draws sliding parallax and a clipped peel lip using 5-argument and 9-argument
drawElementImage()without WebGL 2, or extracts both views into plain HTML on context loss.
How it works
- Both
#view-listand#view-detaillive inside one<canvas content="drawable" layoutsubtree>as directdrawablechildren. BecauseElementGLholds one WebGL 2 context for the whole canvas, a singlepaintlistener uploads changed views viagl.texElementSubImage2D()while active scrubs redraw the shader at display refresh rate without re-uploading unchanged DOM textures. - Browser back gestures on Android often trigger right on the physical screen edge. Here the phone viewport itself sits inside the page padding, and
#view-detailshifts its buttons and inputs 38 px right of its left edge, leaving a 28 px inset rail insidex <= 32where a dedicatedtouch-action: nonestrip captures horizontal drags cleanly without blocking central taps or vertical page scrolling. - The fragment shader divides the phone viewport at a rolling cylinder of radius
Ralong the drag direction. Left of the cylinder roll,#view-listslides rightward from-24%to0%parallax underneath a soft exponential cast shadow. Around the roll, the near face curves smoothly into a lit 3D cream paper underside with faint mirrored ink bleed-through over flat#view-detail. - Releasing a thumb drag evaluates both progress (
> 0.42) and rightward flick velocity (> 420 px/s). A damped spring carries the curl smoothly to 100% or snaps it back to 0%, except whenprefers-reduced-motion: reduce(or the Reduced motion checkbox) is active, where release jumps straight to the final screen. - WebGL texture draws don't update Chromium's hit boxes automatically. Once a transition settles,
syncViewGeometry()scales transforms bygeometryUnit(), callscanvas.updateElementGeometry(), togglesdataset.hitTickto clear the hit-test cache, and flipsinertpluspointer-eventsso controls on whichever screen sits on top answer clicks, typing and keyboard Tab order. - If WebGL 2
texElementSubImage2D()isn't available, the canvas swaps to a 2D context drawing sliding parallax and a vertical curl lip with 5-argument and 9-argumentdrawElementImage(). If HTML-in-canvas isn't enabled or the GPU context is lost, both views move into plain HTML until restored.
Live checks
Each check builds its own small fixture on the hidden test stage and retires its canvas when done. The visible demo above isn't altered.
| Result | Experiment | Detail |
|---|
Findings
Not verified yet in headless Chromium 157 or Chrome 159 on Android. Tap "Run these 5 checks" above to measure this browser.
- Not verified yet: real rendering, two-view
texElementSubImage2D()uploads, cylindrical fold shading,updateElementGeometry()click routing, 2D fallback and touch drag behaviour at 412 px wide and scale 2.625. - Inset gutter vs OS edge swipe: placing the 28 px drag rail inside a 38 px left margin keeps central buttons and text fields safe from accidental drags while staying inward from the physical viewport edge.
- State continuity across views: toggling "Mark as read" or "Pin thread" inside
#view-detailupdates#view-list's DOM immediately, so peeling back reveals the updated dot and badge gliding into place underneath.