-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
29 lines (27 loc) · 932 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
document.addEventListener('DOMContentLoaded', function() {
const texts = [
"Hi!",
"ich mag coding, gaming",
"und Server",
"Schau dir doch meine Porjekte an",
];
let textIndex = 0;
let charIndex = 0;
const speed = 100; // Adjust typing speed here
const delayBetweenTexts = 2000; // Delay between switching texts
function typeWriter() {
if (charIndex < texts[textIndex].length) {
document.getElementById("animated-text").innerHTML += texts[textIndex].charAt(charIndex);
charIndex++;
setTimeout(typeWriter, speed);
} else {
setTimeout(() => {
document.getElementById("animated-text").innerHTML = '';
charIndex = 0;
textIndex = (textIndex + 1) % texts.length;
typeWriter();
}, delayBetweenTexts);
}
}
typeWriter();
});