xxxxxxxxxx
let gridSize = 20;
let grid = [];
function setup() {
createCanvas(800, 800);
background(0);
textFont('monospace');
textSize(gridSize);
for (let x = 0; x < width / gridSize; x++) {
grid[x] = [];
for (let y = 0; y < height / gridSize; y++) {
grid[x][y] = {
char: getRandomChar(),
opacity: random(100, 255),
glow: floor(random(1, 4))
};
}
}
}
function draw() {
background(0);
for (let x = 0; x < grid.length; x++) {
for (let y = 0; y < grid[x].length; y++) {
let cell = grid[x][y];
for (let i = 0; i < cell.glow; i++) {
fill(0, 255, 0, cell.opacity / (i + 1));
text(cell.char, x * gridSize + i, y * gridSize);
}
}
}
// Randomly replace characters and change glow
for (let i = 0; i < 50; i++) {
let x = floor(random(grid.length));
let y = floor(random(grid[0].length));
grid[x][y] = {
char: getRandomChar(),
opacity: random(100, 255),
glow: floor(random(1, 4))
};
}
}
function getRandomChar() {
let chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
return chars.charAt(floor(random(chars.length)));
}