24 lines
783 B
Text
24 lines
783 B
Text
|
<script>
|
||
|
window.addEventListener("resize", paint);
|
||
|
paint();
|
||
|
|
||
|
function paint() {
|
||
|
var canvas = document.getElementById("matrix");
|
||
|
var ctx = canvas.getContext("2d");
|
||
|
ctx.reset();
|
||
|
canvas.width = window.innerWidth;
|
||
|
canvas.height = window.innerHeight;
|
||
|
var characters = "01".split("");
|
||
|
var font_size = 10;
|
||
|
var font_spacing = 5;
|
||
|
var colums = canvas.width/font_size;
|
||
|
var rows = canvas.height/(font_size+font_spacing);
|
||
|
ctx.fillStyle = "rgba(255,255,255,0.1)";
|
||
|
for(var x = 0; x < colums; x++) {
|
||
|
for(var y = 0; y < rows; y++) {
|
||
|
ctx.fillText(characters[Math.round(Math.random())], x*font_size+5,y*(font_size+font_spacing));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|