Polar clock-wipe and bow-tie sweep

I wanted to know if one ElementGL WebGL 2 canvas could sweep radially between two live HTML scenes behind a refracting glass leading arm, while keeping buttons and text inputs in both cards interactive. Drag around the centre dial to scrub from 0° to 360°, pick a blade pattern, or press Sweep.

Daylight Metro 08:14 · Line 4
NW · Next departure

08:14 Bayside

NE · Platform 4

On time (+0m)

Active route

SE · Dispatch gate

Doors clear

Note: Bayside express 0 taps
Midnight Express 02:47 · Telemetry
NW · Event log

0 events

NE · Cruise speed

180 km/h

SW · Headlamp rig

Beam: High

Beacon online

Tag: Sector B7 clear 0 cmds

Starting...

Show the code two drawable scenes, polar wipe shader, explicit tMs timing, sector hit sync and 2D wedge clip
  1. Two full-stage drawable scenes inside one canvas. #cw-scene-a and #cw-scene-b place buttons and editable <input> fields in the four radial quadrants around the stage centre.
  2. Deterministic tMs sweep controller and polar membership. Drives single-hand, bow-tie and quad-iris angles using explicit timestamps so checks can verify midpoint timing and reduced-motion snaps.
  3. Polar atan() split and prism glass arm shader. Computes signed angular pixel distance across 1, 2 or 4 blades, bends UVs along a cylindrical bevel with RGB dispersion, and adds a bright leading-edge spine.
  4. Sector-aware updateElementGeometry() hit sync. Calibrates geometryUnit(), toggles dataset.hitTick, and enables pointer-events only on controls sitting inside the visible polar sectors.
  5. Five-argument drawElementImage() 2D wedge clip fallback. Clips Scene B to 1, 2 or 4 polar wedges over Scene A and draws matching glass leading rays without WebGL 2.

How it works

Both cards (#cw-scene-a and #cw-scene-b) sit inside one <canvas content="drawable" layoutsubtree> driven by a single ElementGL WebGL 2 context from /lib/element-gl.js. I set gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true) when creating the context and again inside onRestored, wait for the first paint event before uploading either card, and always call stage.begin() ahead of stage.upload().

Inside CLOCK_FRAG, each fragment computes its clockwise angle from 12 o'clock with atan(d.x, -d.y) and wraps it into one period (360° for single hand, 180° for bow-tie dual blades, 90° for quad iris). The signed arc distance in pixels gives an anti-aliased boundary between the two textures, while pixels near the moving leading ray shift along the blade normal by a bevel slope and chromatic offset scaled by uRefract.

Because both cards cover the whole stage, I set pointer-events: none on the card containers and let syncGeometry() toggle inert and pointer-events per control based on whether its radial quadrant belongs to Scene A or Scene B at the current sweep angle. At 0° and 360°, the hidden card moves offstage via updateElementGeometry() and dataset.hitTick clears Chromium's hit-test cache. The animation loop pauses whenever IntersectionObserver or document.hidden marks the stage hidden. Without WebGL 2, draw2DFallback() clips Scene B into polar arcs over Scene A using 5-argument drawElementImage() calls, and on webglcontextlost both cards move into #plain-host side by side.

Live checks

Each check builds an isolated fixture on testStage() without touching the demo above. Press Run to test this browser.

Findings