// NextXus Federation — Cognitive Circuitry License // Animation: Digital Data Rain // License: Token Bundle (https://keywebster.gumroad.com/l/olhsf) // Own the marrow. (function () { "use strict"; var canvas = document.getElementById("canvas-beta"); var ctx = canvas.getContext("2d"); var stage = canvas.parentElement; var reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches; var FS = 16; var CHARS = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var drops = [], speeds = [], running = false, rafId = null; function pick() { return CHARS.charAt(Math.floor(Math.random() * CHARS.length)); } function resize() { canvas.width = stage.clientWidth; canvas.height = stage.clientHeight; } function seed() { var cols = Math.ceil(canvas.width / FS); drops = []; speeds = []; for (var i = 0; i < cols; i++) { drops.push(Math.random() * (canvas.height / FS)); speeds.push(0.5 + Math.random() * 0.9); } } function frame() { var w = canvas.width, h = canvas.height; ctx.fillStyle = "rgba(10,10,15,0.10)"; ctx.fillRect(0, 0, w, h); ctx.font = FS + "px monospace"; for (var i = 0; i < drops.length; i++) { var x = i * FS, y = drops[i] * FS; ctx.fillStyle = "#06b6d4"; ctx.fillText(pick(), x, y); ctx.fillStyle = "#d6fbff"; ctx.fillText(pick(), x, y + FS); drops[i] += speeds[i]; if (y > h && Math.random() > 0.975) { drops[i] = 0; speeds[i] = 0.5 + Math.random() * 0.9; } } } function drawStatic() { var w = canvas.width, h = canvas.height; ctx.fillStyle = "#0a0a0f"; ctx.fillRect(0, 0, w, h); ctx.font = FS + "px monospace"; for (var i = 0; i < drops.length; i++) { var x = i * FS; var headY = Math.random() * h; for (var t = 0; t < 9; t++) { var y = headY - t * FS; if (y < 0) break; ctx.fillStyle = t === 0 ? "#d6fbff" : "rgba(6,182,212," + (0.85 - t * 0.1).toFixed(2) + ")"; ctx.fillText(pick(), x, y); } } } function loop() { if (!running) return; frame(); rafId = requestAnimationFrame(loop); } function start() { if (running || reduced) return; running = true; rafId = requestAnimationFrame(loop); } function stop() { running = false; if (rafId) cancelAnimationFrame(rafId); } window.addEventListener("resize", function () { resize(); seed(); if (reduced) drawStatic(); }); resize(); seed(); if (reduced) { drawStatic(); } else { ctx.fillStyle = "#0a0a0f"; ctx.fillRect(0, 0, canvas.width, canvas.height); if ("IntersectionObserver" in window) { new IntersectionObserver(function (entries) { entries.forEach(function (e) { if (e.isIntersecting) start(); else stop(); }); }).observe(canvas); } else { start(); } } })();