Premier projet fonctionnel
This commit is contained in:
parent
7ad04babd4
commit
7fe9c2afe2
|
@ -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;
|
||||
}
|
Binary file not shown.
|
@ -1 +1,2 @@
|
|||
# testMatrix
|
||||
Parce que je viens d'enchainer les 4 films et que ça fait longtemps que j'ai pas codé du 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);
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<script src="Scripts/script.js" defer></script>
|
||||
<link rel="stylesheet" href="CSS/style.css">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>testMatrix</title>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canv" width="500" height="200"></canvas>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue