Depth wallpaper with spatial clock occlusion

I wanted to know if one ElementGL WebGL 2 canvas can composite a live editable clock behind a foreground HTML and SVG cutout with 3-plane parallax while keeping controls clickable via updateElementGeometry(). Drag across the wallpaper, edit the date pill or toggle depth occlusion.

09:41
starting...

Show the code ElementGL two-layer slots, premultiplied depth shader, 3-plane parallax and 2D/plain fallbacks
  1. Two drawable layers in one canvas. #dw-clock-layer holds the editable date pill, quick widgets and giant <output> clock, while #dw-subject-layer holds the inline SVG peak and HTML foreground badge inside one <canvas content="drawable" layoutsubtree>.
  2. Premultiplied uploads into ELEMENT_COUNT slots. Sets UNPACK_PREMULTIPLY_ALPHA_WEBGL = true on creation and restore, gates uploads on hasPainted inside paint, and calls stage.begin() before stage.upload(layerEl).
  3. Twilight sky shader and premultiplied occlusion composite. Draws the sky and distant hills at 0.35x, samples #dw-clock-layer at 0.70x and #dw-subject-layer at 1.35x, and blends premultiplied foreground alpha with fg.rgb + col * (1.0 - fg.a).
  4. Parallax motion and calibrated hit geometry. Updates updateElementGeometry() for #dw-clock-layer using geometryUnit() and flips dataset.hitTick so the date input and widgets stay clickable as the clock shifts.
  5. Five-argument 2D and plain-HTML fallbacks. Composites both layers with 5-argument drawElementImage() without WebGL 2, or moves them into #plain-host when context loss occurs.

How it works

Live checks

Each check builds an isolated fixture on testStage() so the live wallpaper above isn't disturbed.

ResultExperimentDetail

Findings

Measured in headless Google Chrome 160.0.8188.0 canary on 2026-11-27 at 412x915 and 2.625 DPR (SwiftShader WebGL). Headless Chromium 157, npm run check:jank and Chrome 159 on Android stay not verified.