-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (22 loc) · 792 Bytes
/
script.js
File metadata and controls
23 lines (22 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function ZTF(selector) {
const self = {
el: document.querySelector(selector),
matrix: (speed, width, height) => {
// let s = window.screen
let letters = Array(256).join(1).split("");
let draw = function () {
self.el.getContext("2d").fillStyle = "rgba(0,0,0,.05)";
self.el.getContext("2d").fillRect(0, 0, width, height);
self.el.getContext("2d").fillStyle = "#0F0";
letters.map(function (y_pos, index) {
let text = String.fromCharCode(3e4 + Math.random() * 50);
let x_pos = index * 10;
self.el.getContext("2d").fillText(text, x_pos, y_pos);
letters[index] = y_pos > 758 + Math.random() * 1e4 ? 0 : y_pos + 10;
});
};
setInterval(draw, speed);
},
};
return self;
}