const fontSize = 18;
const columns = canvas.width / fontSize;
const drops = [];
for (let i = 0; i < columns; i++) {
drops[i] = Math.floor(Math.random() * canvas.height);
}
const characters = '01';
const colors = ['#00FF00', '#00CC00', '#009900', '#006600'];
const splashRadius = 20;
function draw() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (let i = 0; i < drops.length; i++) {
const text = characters.charAt(Math.floor(Math.random() * characters.length));
const x = i * fontSize;
const y = drops[i] * fontSize;
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
ctx.font = `${fontSize}px monospace`;
ctx.fillText(text, x, y);
if (y > canvas.height && Math.random() > 0.975) {
ctx.beginPath();
ctx.arc(x, canvas.height, splashRadius, 0, Math.PI * 2);
ctx.fillStyle = 'rgba(0, 255, 0, 0.3)';
ctx.fill();
ctx.closePath();
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(draw, 50);
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
drops.length = canvas.width / fontSize;
drops.fill(0);
});
const fontSize = 18;
const columns = canvas.width / fontSize;
const drops = [];
for (let i = 0; i < columns; i++) {
drops[i] = Math.floor(Math.random() * canvas.height);
}
const characters = '01';
const colors = ['#00FF00', '#00CC00', '#009900', '#006600'];
const splashRadius = 20;
function draw() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (let i = 0; i < drops.length; i++) {
const text = characters.charAt(Math.floor(Math.random() * characters.length));
const x = i * fontSize;
const y = drops[i] * fontSize;
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
ctx.font = `${fontSize}px monospace`;
ctx.fillText(text, x, y);
if (y > canvas.height && Math.random() > 0.975) {
ctx.beginPath();
ctx.arc(x, canvas.height, splashRadius, 0, Math.PI * 2);
ctx.fillStyle = 'rgba(0, 255, 0, 0.3)';
ctx.fill();
ctx.closePath();
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(draw, 50);
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
drops.length = canvas.width / fontSize;
drops.fill(0);
});