Cyberpunk Neon Matrix Rain Stream

A dynamic HTML5 Canvas Matrix code rain animation with customizable glowing neon colors, character density, drop speeds, and interactive click color toggles.

CSS & Canvas Animations

Cyberpunk Neon Matrix Rain Stream

220 views ‱ 98 downloads

Project Overview

The Cyberpunk Neon Matrix Rain Stream brings the iconic digital rain effect from The Matrix into standard browser canvas elements. Characters continuously cascade down the screen with fading trail effects and glowing leading characters.

✹ Key Features:

  • Katakana & Binary Characters: Mixed Japanese Katakana symbols, numbers, and Latin characters.
  • Trailing Fading Effect: Semi-transparent background fills create realistic glowing motion trails.
  • Color Palette Switcher: Click anywhere on the screen to switch between Neon Green, Cyber Cyan, and Electric Purple.
  • Zero Dependencies: 100% native HTML5 Canvas & Vanilla JS.

🚀 How to Use this Project:

Click Download Code (.ZIP) to get the source package. Use it as a terminal backdrop, gaming stream overlay, or futuristic portfolio hero background!

<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cyberpunk Matrix Rain</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = { darkMode: 'class' };
    </script>
    <style>
        body { margin: 0; padding: 0; overflow: hidden; }
    </style>
</head>
<body class="h-full relative flex items-center justify-center bg-slate-50 dark:bg-slate-950 text-slate-900 dark:text-slate-100 transition-colors duration-300">

    <div class="absolute z-10 text-center space-y-3 p-6 pointer-events-none">
        <h1 class="text-4xl sm:text-6xl font-extrabold text-emerald-600 dark:text-emerald-400 tracking-wider uppercase drop-shadow-md">
            Matrix <span class="text-slate-900 dark:text-white">Rain</span>
        </h1>
        <p class="text-emerald-600/80 dark:text-emerald-500/80 text-xs sm:text-sm font-mono">
            Click anywhere on the screen to toggle Neon Color modes.
        </p>
    </div>

    <canvas id="matrixCanvas" class="w-full h-full absolute inset-0 z-0"></canvas>

    <script>
        const canvas = document.getElementById("matrixCanvas");
        const ctx = canvas.getContext("2d");

        let width = canvas.width = window.innerWidth;
        let height = canvas.height = window.innerHeight;

        const chars = "ă‚ąă‚Ąă‚«ă‚”ă‚żăƒŠăƒăƒžăƒ€ăƒŁăƒ©ăƒŻă‚Źă‚¶ăƒ€ăƒăƒ‘ă‚€ă‚Łă‚­ă‚·ăƒăƒ‹ăƒ’ăƒŸăƒȘăƒ°ă‚źă‚žăƒ‚ăƒ“ăƒ”ă‚Šă‚„ă‚Żă‚čăƒ„ăƒŒăƒ•ăƒ ăƒŠăƒ„ăƒ«ă‚°ă‚șăƒ–ăƒ…ăƒ—ă‚šă‚§ă‚±ă‚»ăƒ†ăƒăƒ˜ăƒĄăƒŹăƒ±ă‚Čă‚Œăƒ‡ăƒ™ăƒšă‚Șă‚©ă‚łă‚œăƒˆăƒŽăƒ›ăƒąăƒšăƒ§ăƒ­ăƒČă‚Žă‚Ÿăƒ‰ăƒœăƒăƒŽăƒƒăƒł0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        const fontSize = 16;
        let columns = Math.floor(width / fontSize);
        let drops = Array(columns).fill(1);

        const darkColors = ["#10b981", "#06b6d4", "#a855f7", "#f43f5e"];
        const lightColors = ["#059669", "#0891b2", "#7c3aed", "#e11d48"];
        let currentColorIndex = 0;

        function drawMatrix() {
            const isDark = document.documentElement.classList.contains('dark');
            ctx.fillStyle = isDark ? "rgba(0, 0, 0, 0.05)" : "rgba(248, 250, 252, 0.08)";
            ctx.fillRect(0, 0, width, height);

            ctx.fillStyle = isDark ? darkColors[currentColorIndex] : lightColors[currentColorIndex];
            ctx.font = fontSize + "px monospace";

            for (let i = 0; i < drops.length; i++) {
                const text = chars.charAt(Math.floor(Math.random() * chars.length));
                ctx.fillText(text, i * fontSize, drops[i] * fontSize);

                if (drops[i] * fontSize > height && Math.random() > 0.975) {
                    drops[i] = 0;
                }
                drops[i]++;
            }
        }

        setInterval(drawMatrix, 33);

        window.addEventListener("resize", () => {
            width = canvas.width = window.innerWidth;
            height = canvas.height = window.innerHeight;
            columns = Math.floor(width / fontSize);
            drops = Array(columns).fill(1);
        });

        window.addEventListener("click", () => {
            currentColorIndex = (currentColorIndex + 1) % darkColors.length;
        });
    </script>
</body>
</html>
/* Supports both Dark and Light mode via Tailwind class variant */
// Interactive scripts included inside demo view file

Related Projects

3D Interactive Glowing Particle Network

Featured

A high-performance 60fps HTML5 Canvas particle constellation animation featuring interactive mouse tracking, vector physics, glowing nodes, and dynamic connecting lines.

CSS & Canvas Animations ‱ 79

3D Solar System & Planetary Orbit Motion

Featured

An interactive 3D CSS transform solar system simulation featuring planetary orbit rotations, lighting shadows, speed controls, and 3D angle tilts.

CSS & Canvas Animations ‱ 83

3D Glassmorphism Parallax Card & Cursor Spotlight

Featured

An interactive 3D perspective card animation that tilts dynamically with cursor movements, featuring glassmorphism frosted borders and a mouse spotlight overlay.

CSS & Canvas Animations ‱ 82