# Text Scramble Decode

> Cipher-style text animation that scrambles characters and decodes to reveal content. Scroll-triggered, hover, and auto-play modes with custom timing.

Canonical: https://gsapvault.com/effects/text-decode
Live demo: https://gsapvault.com/demos/text-decode/index.html

| Property | Value |
|----------|-------|
| Type | effect |
| Tier | paid |
| Price | £5 |
| Difficulty | intermediate |
| Plugins | ScrollTrigger |
| Techniques | text-animation, scramble, scroll-reveal, hover-effect |
| Uses Lenis | No |

## Overview

A cipher-style text animation that scrambles characters through random glyphs before revealing the final content. Inspired by sci-fi terminal interfaces and hacker movie aesthetics, this effect supports multiple trigger modes including scroll-triggered reveals, hover interactions, click events, and auto-play sequences. Each character resolves independently with configurable timing and direction.

## Features

- Four trigger modes: scroll, hover, click, and auto-play
- Five decode directions: left-to-right, right-to-left, center-out, edges-in, and random
- Configurable scramble speed with fast, normal, and slow presets
- Custom character sets for the scramble animation
- ScrollTrigger integration with automatic viewport detection
- Group mode for staggered multi-element reveals
- Global replay control and start/complete custom events
- Lightweight requestAnimationFrame implementation
- Accessible — respects prefers-reduced-motion

## Use Cases

- Hero headline reveals and landing page intros
- Section titles that decode as users scroll
- Interactive hover effects on navigation or menu items
- Loading states and transition screens
- Cyberpunk or tech-themed website headers

## Vibe-Code Ready Setup

This effect includes `START-HERE-AI.md`, a product-specific copy-paste setup prompt for Cursor, Claude Code, ChatGPT, GitHub Copilot, Windsurf, and other coding assistants. It tells the assistant to inspect the existing stack, integrate the supplied files, preserve the design, scope selectors, retain accessibility and responsive behaviour, add framework-appropriate GSAP cleanup, and report what it tested.

[How AI-assisted setup works](https://gsapvault.com/vibe-coding)

## How It Works

The effect captures each element's original text and builds a per-character queue with randomized start and completion thresholds. requestAnimationFrame cycles unresolved positions through the configured glyph set until each threshold resolves to the final character. Direction options change how thresholds are distributed, while GSAP coordinates delayed sequences, repeating playback, and optional ScrollTrigger activation.

## Integration Preview

How this effect integrates into a page. The full documentation (examples, events, programmatic API, customization guide) ships with the download.

### Quick Start

**1. Add to your HTML `<head>`:**

```html
<link rel="stylesheet" href="path/to/style.css">
```

**2. Add data attributes to text in your `<body>`:**

```html
<h1 data-scramble data-scramble-auto data-scramble-direction="edges">
  SIGNAL UNLOCKED
</h1>
```

**3. Add before the closing `</body>` tag:**

```html
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/ScrollTrigger.min.js"></script>
<script src="path/to/script.js"></script>
```

### Triggers

| Attribute | Behavior |
|---|---|
| `data-scramble-auto` | Decodes after load |
| `data-scramble-scroll` | Decodes on viewport entry and resets above the trigger |
| `data-scramble-hover` | Replays on pointer hover, keyboard focus, or touch |
| `data-scramble-click` | Replays when the element is clicked |
| `data-scramble-replay` | Button that replays every initialized scramble instance |

### Options

| Attribute | Values | Default | Description |
|---|---|---|---|
| `data-scramble-speed` | `fast`, `normal`, `slow` | `normal` | Frame ranges used during decoding |
| `data-scramble-direction` | `left`, `right`, `center`, `edges`, `random` | `random` | Character-resolution order |
| `data-scramble-chars` | Any string | Symbols | Glyph set used while scrambling |
| `data-scramble-delay` | Milliseconds | `0` | Initial auto-play or group delay |
| `data-scramble-repeat` | Milliseconds | `0` | Delay after completion before auto replay |

### Accessibility

- Hover triggers also respond to keyboard focus and touch.
- Reduced motion leaves the original text visible and skips decoding.
- For large animated headings, put the readable phrase in an `aria-label` on the parent and set the changing glyph span to `aria-hidden="true"`. This prevents every random character from being announced.
- Use a real `<button>` for click and replay controls.

### Dependencies

- GSAP 3.14.2+
- ScrollTrigger when using scroll triggers

## What You Get

- `index.html`: working demo page
- `assets/script.js`: commented, readable source
- `assets/style.css`: effect styles
- `README.md`: full documentation with examples and framework integration notes
- `START-HERE-AI.md`: product-specific copy-paste prompt for AI-assisted setup
- `LICENSE.txt`: standard license terms
- Lifetime updates: re-download anytime from your library

## Get the Code

This is a premium effect. The standard license costs £5 one-time and covers unlimited personal and commercial projects with no attribution required. The only restrictions: no redistribution of the code itself and no competing effect libraries.

- [Buy Text Scramble Decode](https://gsapvault.com/effects/text-decode)
- [Effects & Templates Vault (£39 one-time, best value): every current and future effect and template](https://gsapvault.com/effects)

## Judge the Code Quality First

These related effects are free with complete source published, written to the same production standard (cleanup functions, reduced-motion support, framework-agnostic):

- [Typewriter Text](https://gsapvault.com/effects/typewriter-text.md): A sharp terminal-style typewriter that types, holds, accelerates through deletion, and cycles to the next phrase in sync with cursor and progress signals.
- [Scroll Text Highlight](https://gsapvault.com/effects/scroll-text-highlight.md): A scrubbed orange-to-lime reading front lifts each active word before completed copy settles to white and unread copy remains ghosted.

---

From [GSAP Vault](https://gsapvault.com): production-ready GSAP animation effects. Full catalog for agents: https://gsapvault.com/llms-full.txt
