StealThis .dev

Canvas Scramble Text

A DPR-aware HTML canvas headline that resolves out of random glyphs with an RGB channel-split fringe and rolling scanline glitch, retriggering on hover or click and cycling through a set of phrases.

Open in Lab
canvas vanilla-js
Targets: JS HTML

Code

Canvas Scramble Text

A headline rendered entirely on an HTML <canvas> that decodes out of a storm of random glyphs. Each character position runs its own countdown: while unresolved it flickers through a symbol pool, then snaps to its final letter. On top of the decode, the effect draws the text three times — offset in red, cyan, and white — for an RGB channel-split fringe, and sweeps a translucent scanline band down the frame to sell the glitch.

The demo is genuinely interactive: it auto-plays on load, re-triggers when you hover or click the canvas, and cycles through several phrases on a timer. A small control row lets you scrub the glitch intensity, toggle the channel split, and step to the next phrase. Progress and the active phrase are announced in an aria-live region so the effect is legible to assistive tech even though the visible text lives in pixels.

Under the hood it demonstrates the Canvas 2D API with device-pixel-ratio scaling: the backing store is sized to width * devicePixelRatio and the context is scaled so text stays crisp on retina displays. Animation is driven by requestAnimationFrame with delta-timed per-glyph resolution, and everything is vanilla JS with zero dependencies.