Skip to content

Instantly share code, notes, and snippets.

@CoffeeVampir3
Created June 15, 2023 00:52
Show Gist options
  • Save CoffeeVampir3/fea929160cd626b107d657e29c6c3cca to your computer and use it in GitHub Desktop.
Save CoffeeVampir3/fea929160cd626b107d657e29c6c3cca to your computer and use it in GitHub Desktop.
llm-matrix-theme
<script>
var canvas = document.getElementById('matrixCanvas');
var ctx = canvas.getContext('2d');
canvas.height = window.innerHeight;
canvas.width = window.innerWidth;
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789@$%&";
characters = characters.split("");
var fontSize = 10;
var columns = canvas.width/fontSize;
var drops = [];
for(var x = 0; x < columns; x++)
drops[x] = 1;
function drawMatrix() {
ctx.fillStyle = "rgba(0, 0, 0, 0.1)"; // Increase the transparency of the black rectangles
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "rgba(55, 55, 190, 0.5)"; // Change the color of the text to a semi-transparent blue
ctx.font = fontSize + "px arial";
for(var i = 0; i < drops.length; i++) {
var text = characters[Math.floor(Math.random()*characters.length)];
ctx.fillText(text, i*fontSize, drops[i]*fontSize);
if(drops[i]*fontSize > canvas.height && Math.random() > 0.975)
drops[i] = 0;
drops[i]++;
}
}
setInterval(drawMatrix, 33);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment