VHS tape tracking and head-switching noise

I wanted to know if an ElementGL WebGL 2 shader can put analog helical-scan VHS artefacts across a live VCR deck (tracking shear, bottom 7% head-switching jitter, YIQ chroma smear, dropout snow and fast-forward scan streaks) while the transport buttons, channel switcher and tape label input stay clickable. Type into the tape label, switch channels or turn the tracking slider toward zero to lock the signal.

PLAY ▶ SP · PAL
00:14:22:08
CH 03 · UHF TEST TRK -0.38
CAMCORDER TAPE 04
479.25 MHz · RF MODULATOR · COLOUR-UNDER 629 kHz

Starting canvas…

Show the code drawable VCR deck markup, YIQ chroma smear shader, upload gating and hit-box sync
  1. One live VCR deck inside one canvas. The tape counter, editable label input, channel buttons, transport row and bottom head-switching strip live inside a single <canvas content="drawable" layoutsubtree>.
  2. Helical-scan VHS fragment shader. Separates luminance (Y) from horizontally delayed and low-pass smeared chrominance (I/Q), shifts the tracking tear band from uTracking, adds FF/REW and Pause streaks, and shreds the bottom 7% head-switching band.
  3. Upload gating and draw order. Waits for hasPainted = true inside 'paint', calls stage.begin() before stage.upload(deckEl), and reuses the cached GPU texture on pure shader frames.
  4. Hit-box calibration. Measures geometryUnit() and toggles dataset.hitTick after updateElementGeometry() so clicks and typing stay aligned over the degraded deck.
  5. 2D and plain-HTML fallbacks. Falls back to five-argument drawElementImage() with light scanlines when WebGL 2 is absent, or moves #vhs-deck into plain HTML on context loss.

How it works

Real VHS decks split luminance (Y) at around 3 MHz from colour-under chrominance (I/Q) downconverted to 629 kHz, so bright text stays sharp while saturated colours lag and smear sideways. I placed the full VCR player card inside one <canvas content="drawable" layoutsubtree> and drove it with a single ElementGL WebGL 2 context from /lib/element-gl.js, with UNPACK_PREMULTIPLY_ALPHA_WEBGL turned on at context creation and on restore.

Inside the paint handler, the script waits for the first paint record (hasPainted = true), calls stage.begin() before stage.upload(deckEl) so the backing store is sized past 300 by 150 first, and skips re-uploading with gl.texElementSubImage2D() unless a DOM node inside the deck changed. The fragment shader (VHS_FRAG) converts the uploaded pixels to YIQ, leaves luminance sharp along each displaced scanline, smears I and Q horizontally leftward in source space so colours bleed right across the SMPTE bars and buttons, moves a white-noise tracking tear bar according to uTracking (clearing it within ±0.04 of zero), and tears the bottom 7% (vUv.y > 0.928) for rotary head-switching jitter.

All clickable controls (the tape label <input>, channel buttons and transport row) sit above the bottom 7% switching band and stay aligned via canvas.updateElementGeometry() scaled by geometryUnit() plus a toggled dataset.hitTick attribute. An IntersectionObserver and document.hidden check stop the animation loop when the deck is off screen or in a background tab, and enabling Reduced motion freezes jitter, pause tremble and dropout snow into a static calibration frame.

Live checks

These checks wait for a tap so the page opens with only one WebGL context running. Each check builds its own isolated fixture on testStage() and retires it afterwards.

ResultExperimentDetail

Findings

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