T7block
K

Text Scramble

Text Scramble

Documentation

Setup: External Scripts

Step 1: TextScramble.tsx

TextScramble.tsx
"use client";

import { useEffect, useState } from "react";

const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";

export default function TextScramble({ text, speed = 50 }: { text: string; speed?: number }) {
  const [display, setDisplay] = useState("");

  useEffect(() => {
    let iteration = 0;
    const interval = setInterval(() => {
      setDisplay(
        text.split("").map((char, i) => {
          if (i < iteration) return char;
          return chars[Math.floor(Math.random() * chars.length)];
        }).join("")
      );
      iteration += 1 / 3;
      if (iteration >= text.length) clearInterval(interval);
    }, speed);
    return () => clearInterval(interval);
  }, [text, speed]);

  return <color: #79c0ff;">style="color: #ff7b72;">span color: #79c0ff;">className="font-mono">{display}</color: #79c0ff;">style="color: #ff7b72;">span>;
}

Hacker-style text reveal animation. Characters randomly cycle through before settling on the final value. This textscramble.tsx implementation provides a robust foundation for building interactive and high-performance user interfaces.

Resource details

PublishedJanuary 5, 2026
CategoryFree
textanimationscrambledecode
Ashirwad Singh
Ashirwad Singh