const lines = []; const lineHeight = 35; const framesPerChange = 9; const framesPerOff = 20; function setup() { createCanvas(1000, 1000); background('#0a0a1b'); const lineCount = 40; for (let i = 0; i < lineCount; i++) { const line = { text: randomText(), y: height + i * lineHeight, speed: 21, framesUntilChange: framesPerChange, framesUntilOff: framesPerOff, }; lines.push(line); } } function draw() { background('#0a0a1b'); for (const line of lines) { moveLine(line); displayLine(line); line.framesUntilChange--; line.framesUntilOff--; if (line.framesUntilChange <= 0) { changeRandomCharacter(line); line.framesUntilChange = framesPerChange; } if (line.framesUntilOff <= 0) { turnOffRandomCharacter(line); line.framesUntilOff = framesPerOff; } if (line.y < -lineHeight) { line.y = height; } } } function randomText() { const word = `01110111 01100101 01101100 01100011 01101111 01101101 01100101 00100000 01110100 01101111 00100000 01110011 01110100 01110010 01100001 01101110 01100111 01100101 01110010 00100000 01101101 01100001 01101110 01110011 01101001 01101111 01101110`; return word; } function moveLine(line) { line.y -= line.speed; } function displayLine(line) { textSize(16); fill('#ff3600'); noStroke(); text(line.text, 20, line.y); } function changeRandomCharacter(line) { const index = floor(random(line.text.length)); const newCharacter = '₿'; line.text = line.text.substr(0, index) + newCharacter + line.text.substr(index + 1); } function turnOffRandomCharacter(line) { const index = floor(random(line.text.length)); const offCharacter = ' '; line.text = line.text.substr(0, index) + offCharacter + line.text.substr(index + 1); }