Scramble Effect
Text cipher/decode animation. Characters cycle through random glyphs before settling on the correct character.

See Also

All JavaScript Effects Breathe Pulse Scribe Reveal Counter Ripple Shake Twinkle

Domma.effects.scramble()

The scramble() effect wraps text characters and rapidly cycles through random glyphs before resolving each character to its final value. Supports multiple reveal orders and looping.

// Basic usage
Domma.effects.scramble('.hero-title');

// With options
const ctrl = Domma.effects.scramble('.heading', {
  scrambleDuration: 1200,
  revealOrder: 'random',
  loop: true,
  loopDelay: 3000,
  onComplete: () => console.log('Decoded!')
});

// Control
ctrl.pause();
ctrl.resume();
ctrl.restart();
ctrl.destroy();

Demo: Basic Scramble

Click to decode the text left-to-right.

Welcome to Domma

Demo: Reveal Orders

Different orders for character resolution.

Left to Right

Domma Effects

Right to Left

Domma Effects

Random

Domma Effects

Centre Out

Domma Effects
Domma.effects.scramble('#el', { revealOrder: 'left-to-right' });
Domma.effects.scramble('#el', { revealOrder: 'right-to-left' });
Domma.effects.scramble('#el', { revealOrder: 'random' });
Domma.effects.scramble('#el', { revealOrder: 'center-out' });

Demo: Looping Scramble

Infinite loop with configurable delay between cycles.

Build Amazing Apps
Domma.effects.scramble('.headline', {
  loop: true,
  loopDelay: 2000,
  scrambleDuration: 1000,
  revealOrder: 'random'
});

Demo: Custom Character Pool

Use custom characters for the scramble animation.

01100100
Domma.effects.scramble('#binary', {
  characters: '01',
  scrambleDuration: 1500,
  speed: 80
});

Demo: Speed Variations

Adjust scramble duration and resolve speed.

Quick Decode
Slow Reveal

Options Reference

OptionTypeDefaultDescription
speednumber50Ms per character resolve
scrambleSpeednumber30Ms between scramble frame updates
charactersstringA-Z, a-z, 0-9, symbolsCharacter pool for scramble glyphs
revealOrderstring'left-to-right''left-to-right', 'right-to-left', 'random', 'center-out'
scrambleDurationnumber800How long each char scrambles before resolving (ms)
staggernumber0Delay between multiple elements (ms)
loopboolean|numberfalsefalse, true (infinite), or number of loops
loopDelaynumber2000Ms between loops
respectMotionPreferencebooleantrueHonour prefers-reduced-motion
onCompletefunctionnullCallback when animation completes
onCharacterfunctionnullCallback per character resolved (char, index)