Back to library
INTERACTION_020

Text Scramble.

On hover or reveal, each character is temporarily replaced with random glyphs that resolve left to right, reading as a terminal decoding text.

CATEGORY
Typography
COMPLEXITY
Intermediate
TECH
CSS + JS
PLATFORM
Both
PERFORMANCE
Light
LIVE PLAYGROUND
SCRAMBLE
JavaScript / JS
const CHARS = "!<>-_\\/[]{}=+*^?#";

function scramble(el, text, duration = 700) {
  const start = performance.now();
  (function tick(now) {
    const p = Math.min((now - start) / duration, 1);
    const solid = Math.floor(p * text.length);
    el.textContent = text
      .split("")
      .map((c, i) => (i < solid ? c : CHARS[Math.floor(Math.random() * CHARS.length)]))
      .join("");
    if (p < 1) requestAnimationFrame(tick);
  })(start);
}

IF YOU LIKE THIS, STEAL THESE TOO.

DISCOVEREFFECTSPROMPTS
INTERACTION_027CSS

Navigation Underline

Underline grows from the origin side on hover.

Navigation / LightView
PROCESSING
INTERACTION_025CSS

Scanning Line

A thin light passes down a panel while processing.

Loading / LightView
0COPY ACTIONS
INTERACTION_021CSS + JS

Count-Up Number

Metrics animate from zero when scrolled into view.

Typography / LightView
SPOTLIGHT

Move the cursor across this surface.

INTERACTION_007CSS + JS

Mouse Spotlight Card

A soft radial light follows the cursor across the surface.

Cards / LightView