Lenticular and scanimation

I wanted to know if one WebGL 2 canvas could interlace three live HTML cards behind simulated cylindrical lenticules or a sliding Scanimation barrier grid, flip cleanly between them as you tilt or drag, and switch updateElementGeometry() plus inert so only the visible layer takes clicks, typing and Tab focus.

Layer A / Day front Open

Daylight front sheet

Type a note or tap the counter, then tilt right toward 0° to cross behind the ridges into Layer B.

0 taps
Angle peak -25° LIVE LAYER A
Layer B / Night spec ACCENT: CYAN

OPTICAL SPEC // 00-DEG

Angle peak 0° LIVE LAYER B
Layer C / Translate alt EN

Optical print poster

Switch language or edit the print tag while tilted at +25°.

Angle peak +25° LIVE LAYER C
starting...
Layer A · Day100%
Layer B · Night0%
Layer C · Alt0%

Drag left or right across the sheet to tilt the lenticules or slide the Scanimation acetate, or tap the angle presets above. Controls inside whichever card faces you remain clickable and typeable. Turn on Magnify loupe and drag the circular ring to inspect the interlaced strips up close.

Show the code Three drawable cards, ElementGL multi-texture upload, lenticular and Scanimation shader, authority handoff and phone tilt
  1. Three live drawable cards inside one canvas. Layers A, B and C sit inside one <canvas content="drawable" layoutsubtree>; hidden layers carry inert so Tab focus skips them.
  2. One WebGL 2 context through ElementGL. On each paint event, the changed cards upload via stage.upload() (gl.texElementSubImage2D()) into three textures, then one quad pass binds all three texture units.
  3. Lenticular micro-prism and Scanimation barrier-grid fragment shader. Lenticular mode refracts through vertical cylindrical ridges with Fresnel highlights, cross-talk ghosting and slight RGB dispersion. Scanimation mode interlaces vertical strips of A, B and C beneath a sliding 1/3-slit black acetate sheet, and both modes share the 4.5x magnify loupe.
  4. Hit-test and focus handoff via updateElementGeometry() and inert. Whichever card exceeds 50% optical weight gets inert = false and a DOMMatrix scaled by geometryUnit(); hidden layers move off-canvas and turn inert = true.
  5. Opt-in phone tilt through DeviceOrientationEvent. Nothing prompts on load. Pressing Use phone tilt requests permission only where iOS requires it, zeroes on your first gamma angle, and falls back with a note if no orientation events arrive.

How it works

A physical lenticular print laminates an array of vertical cylindrical lenses over an interlaced image so your left-to-right viewing angle selects a different strip behind each rib. A Scanimation sheet produces the same flip without refraction: it prints vertical strips of three frames side by side and slides a black striped acetate grid (1/3 clear slits, 2/3 opaque bars) across them by a couple of pixels.

Here all three interactive HTML cards live as drawable children inside one <canvas content="drawable" layoutsubtree> backed by one ElementGL WebGL 2 context (/lib/element-gl.js). Whenever you type in Layer A's note field, drag Layer B's exposure slider or flip Layer C into Japanese, Chromium fires a paint event and I re-upload the changed card with gl.texElementSubImage2D(). Tilting or sliding doesn't mutate the DOM, so dragging runs purely in the fragment shader with zero texture re-uploads.

Three stacked drawable elements would fight over pointer events and keyboard Tab stops if all three stayed active at once. After every angle or acetate change, I calculate the optical weights for A, B and C. If one layer crosses 50%, that card gets inert = false and its exact card transform (scaled by geometryUnit() from /lib/surface.js) passed to canvas.updateElementGeometry(), followed by toggling dataset.hitTick to clear Chromium's hit-test cache. The other two layers get inert = true and move to (-100000, -100000) so clicks, focus and text selection always stay on the facing interface. Right on a 50/50 transition seam, all three layers turn inert until one wins.

Live checks

These checks build isolated fixtures on testStage() and never touch the visible sheet or request sensor permissions.

Findings