forked from jeycaarce/lyrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
36 lines (26 loc) · 994 Bytes
/
script.js
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
document.addEventListener("DOMContentLoaded", function () {
const lyrics = [
"Kissing, I hope they caught us",
"Whether they like or not",
"I wanna show you off",
"I wanna show you off",
"I wanna brag about it",
"I wanna tie the knot",
"I wanna show you off"
];
const delay = 33;
const lyricsElement = document.getElementById("lyrics");
async function displayLyrics() {
for (const line of lyrics) {
for (const char of line) {
lyricsElement.textContent += char;
await new Promise((resolve) => setTimeout(resolve, delay));
}
lyricsElement.innerHTML += "<br>";
await new Promise((resolve) => setTimeout(resolve, delay * 10));
lyricsElement.innerHTML = "";
await new Promise((resolve) => setTimeout(resolve, delay * 10));
}
}
displayLyrics();
});