3D Tilt View DOM layer inspector

I wanted to see if HTML-in-canvas could rebuild Mozilla's old Firefox 3D Tilt View (Victor Porof, Firefox 11 to 46) and Microsoft Edge's 3D View panel, with one extra twist: every tilted plane stays interactive. This experiment builds on /structure-depth/ and /layout-debug/ by lifting five drawable layers of a live mini app into an exploded WebGL 2 stack. Drag the dark background to orbit, slide layer spacing from 0 px to 90 px, and click buttons, edit the title, toggle filters or drag across the article paragraphs right inside the tilted stack.

Harbour Log z=0 · 2 items
Layer 0 · shell 480 × 340
Layer 1 · article newest

North sluice cleared at 08:15 after overnight weed build-up.

Flow rate: 14.2 m3/s · head difference 1.9 m · likes 3.

Select text above
Layer 2 · filtersz=2

Drag background to orbit · tap any tilted control

Show the code 5 drawable layers, 3D projection, extruded slabs, hit geometry and 2D fallback
  1. The five layers inside one canvas. Each depth level is its own drawable element aligned to one app footprint.
  2. One 3D matrix per layer. The same DOMMatrix drives WebGL clip space, the inspector's quad bounds and updateElementGeometry().
  3. Coloured side slabs, wireframes and depth connectors. A small colour shader runs on stage.gl from ElementGL with no second WebGL context.
  4. The paint handler. Uploads changed layers with stage.upload(), draws back to front, updates hit boxes and bumps dataset.hitTick.
  5. The 2D isometric fallback. When WebGL 2 isn't available, the same five layers draw with five-argument drawElementImage().

How it works

Firefox's classic 3D Tilt View (written by Victor Porof for Firefox 11 to 46) and Edge's 3D View panel both lift DOM depth into WebGL meshes, though those tools draw snapshots that you inspect rather than use. Here I put five separate drawable elements inside one <canvas content="drawable" layoutsubtree> and align their local coordinates to one shared app footprint. At 0 px spacing and 0° tilt they sit flush as a single interface; as spacing grows they separate along Z.

One ElementGL instance owns the page's single WebGL 2 context. Its built-in textured-quad shader draws each layer from texElementSubImage2D(), and a small companion colour shader on the same stage.gl draws the extruded side-thickness slabs, wireframe outlines and vertical corner connectors from each layer down to z = 0. Because all five planes are parallel in local space, drawing from layer 0 up to layer 4 gives exact painter's order with no depth-buffer fighting.

Every visible layer receives its exact 3D DOMMatrix via canvas.updateElementGeometry(el, { canvasTransform }), followed by updating el.dataset.hitTick whenever the transform changes so Chromium clears its hit-test cache. When you turn on Solo selected layer, the other four layers are marked inert and parked off-stage at a scale of 0.001 so clicks and text selection pass straight through to the soloed plane. If WebGL 2 isn't available, the page falls back to a 2D isometric stack using five-argument drawElementImage(), and if HTML-in-canvas isn't available at all it moves the five elements into a plain HTML stack.

Live checks

These checks wait for a tap so the demo starts with one GPU context. Each check builds its own small fixture on the test stage and retires its canvas when finished.

Findings

Not verified in a live browser yet. Run the live checks above in Chromium with #canvas-draw-element enabled to record results for your device.