diff --git a/CSS/style.css b/CSS/style.css new file mode 100644 index 0000000..4bebf81 --- /dev/null +++ b/CSS/style.css @@ -0,0 +1,10 @@ +@font-face { + font-family: 'matrixCodeNFI'; + src: url('/Fonts/matrix-code-nfi/matrixCodeNFI.ttf') format('truetype') +} + +body { + margin: 0; + height: 100vh; + width: 100vw; +} \ No newline at end of file diff --git a/Fonts/matrix-code-nfi/matrixCodeNFI.ttf b/Fonts/matrix-code-nfi/matrixCodeNFI.ttf new file mode 100644 index 0000000..3d232ae Binary files /dev/null and b/Fonts/matrix-code-nfi/matrixCodeNFI.ttf differ diff --git a/README.md b/README.md index 7a1c9e6..4e54a8a 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# testMatrix \ No newline at end of file +# testMatrix +Parce que je viens d'enchainer les 4 films et que ça fait longtemps que j'ai pas codé du Js \ No newline at end of file diff --git a/Scripts/script.js b/Scripts/script.js new file mode 100644 index 0000000..8a61ab0 --- /dev/null +++ b/Scripts/script.js @@ -0,0 +1,28 @@ +const canvas = document.getElementById('canv'); +const ctx = canvas.getContext('2d'); + +const w = canvas.width = document.body.offsetWidth; +const h = canvas.height = document.body.offsetHeight; +const cols = Math.floor(w / 20) + 1; +const ypos = Array(cols).fill(0); + +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, w, h); + +function matrix () { + ctx.fillStyle = '#0001'; + ctx.fillRect(0, 0, w, h); + + ctx.fillStyle = '#0f0'; + ctx.font = '15pt matrixCodeNFI'; + + ypos.forEach((y, ind) => { + const text = String.fromCharCode(Math.random() * 128); + const x = ind * 20; + ctx.fillText(text, x, y); + if (y > 100 + Math.random() * 10000) ypos[ind] = 0; + else ypos[ind] = y + 20; + }); +} + +setInterval(matrix, 50); diff --git a/index.html b/index.html new file mode 100644 index 0000000..e728c6d --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + + testMatrix + + + + + \ No newline at end of file