added new themes and the 'ION Lang' card

This commit is contained in:
2024-05-25 21:09:35 -04:00
parent b3e8d31459
commit 63e65b1f64
3 changed files with 36 additions and 9 deletions
+22 -5
View File
@@ -1,4 +1,21 @@
function getRandomColorScheme() {
const schemes = [
() => `rgb(${Math.floor(Math.random() * 205) + 50}, 0, ${Math.floor(Math.random() * 205) + 50})`, // Pink and purple shades
() => `rgb(${Math.floor(Math.random() * 256)}, ${Math.floor(Math.random() * 256)}, 0)`, // Yellow
() => `rgb(0, ${Math.floor(Math.random() * 256)}, 0)`, // Green
() => `rgb(0, 0, ${Math.floor(Math.random() * 256)})`, // Blue
() => `rgb(${Math.floor(Math.random() * 256)}, ${Math.floor(Math.random() * 256)}, ${Math.floor(Math.random() * 256)})`, // White (grayscale)
() => 'rgb(0,0,0)' //`rgb(${Math.floor(Math.random() * 56)}, ${Math.floor(Math.random() * 56)}, ${Math.floor(Math.random() * 56)})` // Black (dark grayscale)
];
const ind = Math.floor(Math.random() * schemes.length);
return { ind, scheme: schemes[ind] };
}
document.addEventListener('DOMContentLoaded', (e) => {
const {ind, scheme} = getRandomColorScheme();
console.log(ind);
const canvas = document.getElementById('matrixCanvas');
const context = canvas.getContext('2d');
@@ -26,10 +43,10 @@ document.addEventListener('DOMContentLoaded', (e) => {
const matrixChars = katakana + latin + nums;
function draw() {
context.fillStyle = 'rgba(0, 0, 0, 0.05)';
context.fillStyle = (ind === 5) ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.05)';
context.fillRect(0, 0, canvas.width, canvas.height);
context.fillStyle = '#ff00ff'; // Bright pink color
context.fillStyle = scheme(); //'#ff00ff'; // Bright pink color
context.font = fontSize + 'px monospace';
for (let i = 0; i < drops.length; i++) {
@@ -43,11 +60,11 @@ document.addEventListener('DOMContentLoaded', (e) => {
// Move the drop down
drops[i]++;
// Change color over time
context.fillStyle = `rgb(${Math.floor(Math.random() * 205) + 50}, 0, ${Math.floor(Math.random() * 205) + 50})`; // Pink and purple shades
// Assign a random color from the color schemes
context.fillStyle = scheme();
}
}
setup(); // Call setup initially to set up canvas and drops
setInterval(draw, 33);
});
});