<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Colorful Matrix Animation</title>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
}
canvas {
display: block;
position: absolute;
top: 0;
left: 0;
}
</style>
</head>
<body>
<canvas id="matrixCanvas"></canvas>
<script>
const canvas = document.getElementById('matrixCanvas');
const ctx = canvas.getContext('2d');
let width, height, columns, drops;
// Character set - Katakana, but you can use any characters
const characters = 'アァカサタナハマヤャラワガザダバパイィキシチニヒミリヰギジヂビピウゥクスツヌフムユュルグズブプエェケセテネヘメレヱゲゼデベペオォコソトノホモヨョロヲゴゾドボポヴッン0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const fontSize = 18;
function initialize() {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
columns = Math.floor(width / fontSize);
drops = [];
for (let i = 0; i < columns; i++) {
drops[i] = 1;
}
}
function draw() {
// Create the fading trail effect by drawing a semi-transparent black rectangle
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, width, height);
// Set the font style
ctx.font = fontSize + 'px monospace';
// Loop through each column
for (let i = 0; i < drops.length; i++) {
// Get a random character from the set
const text = characters.charAt(Math.floor(Math.random() * characters.length));
// Set a random vibrant color for the character
const hue = Math.floor(Math.random() * 360);
ctx.fillStyle = `hsl(${hue}, 100%, 60%)`;
// Draw the character
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
// Reset the drop to the top if it goes off-screen, with a random chance
if (drops[i] * fontSize > height && Math.random() > 0.975) {
drops[i] = 0;
}
// Move the drop down for the next frame
drops[i]++;
}
}
// Initialize and start the animation
initialize();
const animationInterval = setInterval(draw, 33);
// Handle window resize
window.addEventListener('resize', () => {
initialize();
});
</script>
</body>
</html>
```*
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Colorful Matrix Animation</title>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
}
canvas {
display: block;
position: absolute;
top: 0;
left: 0;
}
</style>
</head>
<body>
<canvas id="matrixCanvas"></canvas>
<script>
const canvas = document.getElementById('matrixCanvas');
const ctx = canvas.getContext('2d');
let width, height, columns, drops;
// Character set - Katakana, but you can use any characters
const characters = 'アァカサタナハマヤャラワガザダバパイィキシチニヒミリヰギジヂビピウゥクスツヌフムユュルグズブプエェケセテネヘメレヱゲゼデベペオォコソトノホモヨョロヲゴゾドボポヴッン0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const fontSize = 18;
function initialize() {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
columns = Math.floor(width / fontSize);
drops = [];
for (let i = 0; i < columns; i++) {
drops[i] = 1;
}
}
function draw() {
// Create the fading trail effect by drawing a semi-transparent black rectangle
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, width, height);
// Set the font style
ctx.font = fontSize + 'px monospace';
// Loop through each column
for (let i = 0; i < drops.length; i++) {
// Get a random character from the set
const text = characters.charAt(Math.floor(Math.random() * characters.length));
// Set a random vibrant color for the character
const hue = Math.floor(Math.random() * 360);
ctx.fillStyle = `hsl(${hue}, 100%, 60%)`;
// Draw the character
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
// Reset the drop to the top if it goes off-screen, with a random chance
if (drops[i] * fontSize > height && Math.random() > 0.975) {
drops[i] = 0;
}
// Move the drop down for the next frame
drops[i]++;
}
}
// Initialize and start the animation
initialize();
const animationInterval = setInterval(draw, 33);
// Handle window resize
window.addEventListener('resize', () => {
initialize();
});
</script>
</body>
</html>
```*