Repository navigation
Expand file tree
/
Copy pathmatrix.js
More file actions
127 lines (93 loc) · 2.27 KB
/
Copy pathmatrix.js
File metadata and controls
127 lines (93 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const username = "Ghost0Mod3";
fetch(`https://api.github.com/users/${username}/repos`)
.then(response => response.json())
.then(repos => {
const container =
document.getElementById("repo-container");
repos
.filter(repo => !repo.name.includes(".github.io"))
.sort(
(a,b) =>
new Date(b.updated_at) -
new Date(a.updated_at)
)
.forEach(repo => {
const card =
document.createElement("div");
card.className = "repo-card";
card.innerHTML = `
<h3>${repo.name}</h3>
<p>
${repo.description || "No description"}
</p>
${repo.html_url}
View Repository →
</a>
`;
container.appendChild(card);
});
})
.catch(error => console.error(error));
/* MATRIX RAIN */
const canvas =
document.getElementById("matrix");
const ctx =
canvas.getContext("2d");
canvas.width =
window.innerWidth;
canvas.height =
window.innerHeight;
const chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*";
const fontSize = 16;
const columns =
Math.floor(canvas.width / fontSize);
const drops = [];
for(let i = 0; i < columns; i++){
drops[i] = 1;
}
function draw(){
ctx.fillStyle =
"rgba(0,0,0,0.05)";
ctx.fillRect(
0,
0,
canvas.width,
canvas.height
);
ctx.fillStyle = "#00ff41";
ctx.font =
fontSize + "px monospace";
for(let i = 0; i < drops.length; i++){
const text =
chars[
Math.floor(
Math.random() *
chars.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(draw, 35);
window.addEventListener(
"resize",
() => {
canvas.width =
window.innerWidth;
canvas.height =
window.innerHeight;
}
);