Modus UI

Decrypted Text

Web (React)

A hacker-style text decryption matrix effect that scrambles text before revealing it.

A hacker-style text decryption matrix effect that scrambles text before revealing it. Can trigger on hover or when scrolled into view.

Hover over me to decryptI animate automatically on view.

Installation

CLI

npx @modus-ui/cli add decrypted-text

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/decrypted-text.tsx.
  3. Paste the code.

Usage

tsx
import { DecryptedText } from "@/components/ui/decrypted-text";

export default function Example() {
  return (
    <DecryptedText
      text="Hover over me to decrypt"
      animateOn="hover"
      speed={40}
      className="font-mono text-4xl"
    />
  );
}

Props

PropTypeDefaultDescription
textstring-The text to reveal.
speednumber50Milliseconds between scramble frames.
maxIterationsnumber10Scramble frames before revealing when not sequential.
sequentialbooleanfalseReveals one character at a time.
revealDirection"start" | "end" | "center""start"Where sequential reveal starts.
useOriginalCharsOnlybooleanfalseScrambles using only the text's own characters.
charactersstring"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_+"Characters used for scrambling.
parentClassNamestring-Classes for the wrapper.
encryptedClassNamestring-Classes for still-scrambled characters.
animateOn"view" | "hover""hover"Whether to run on hover or when scrolled into view.
delaynumber0Milliseconds to wait before starting.

Comments

  • No comments yet.