AnimationUpdated in v15

Decrypt Text

Text that scrambles, then resolves into the real string.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrDecryptText } from 'ngwr/bits/decrypt-text';

@Component({ imports: [WrDecryptText] })
export class MyComponent {}
Angular adaptation of an effect by David Haz / reactbits.dev.

Playground

Hover to decrypt!
<wr-decrypt-text
  text="Hover to decrypt!"
  [speed]="50"
  [sequential]="false"
  revealDirection="start"
  animateOn="hover"
  [useOriginalCharsOnly]="false"
/>

Customize

Animate On
Speed (ms)
50 ms
Sequential
Reveal Direction
Original Chars Only
Text

API

NameDescriptionTypeDefault
textrequiredText to reveal.string—
speedTick interval in ms.number50
maxIterationsNon-sequential mode only — total scramble ticks before snapping to plain.number10
sequentialReveal one char per tick instead of scrambling all of them.booleanfalse
revealDirectionOrder in which chars are revealed in sequential mode.'start' | 'end' | 'center''start'
useOriginalCharsOnlyScramble using only glyphs present in text (minus spaces).booleanfalse
charactersPool of glyphs to scramble through.string'ABC…!@#$…'
animateOnWhen to start the animation. 'click' rests scrambled and makes the text a button: Tab reaches it, Enter or Space decrypts it.'hover' | 'click' | 'view' | 'inViewHover''hover'
clickModeClick behaviour: 'once' decrypts then stops; 'toggle' flips state on each click.'once' | 'toggle''once'

See also