-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
18 lines (15 loc) · 801 Bytes
/
script.js
File metadata and controls
18 lines (15 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function createMatrixText() {
const matrixText = document.createElement("div");
matrixText.textContent = getRandomChar(); // Chọn ngẫu nhiên một ký tự
matrixText.style.left = Math.random() * 100 + "vw"; // Vị trí ngang ngẫu nhiên
matrixText.style.animationDuration = Math.random() * 5 + 2 + "s"; // Tốc độ rơi ngẫu nhiên
document.querySelector(".matrix-container").appendChild(matrixText);
setTimeout(() => {
matrixText.remove();
}, 5000); // Xóa ký tự sau khi rơi xong
}
function getRandomChar() {
const characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
return characters[Math.floor(Math.random() * characters.length)];
}
setInterval(createMatrixText, 100); // Tạo ký tự mới liên tục