-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
78 lines (52 loc) · 1.61 KB
/
index.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
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
const myName = document.getElementById('my-name');
const logoImg = document.getElementById('logo-img');
// Get the first letter of the heading text
const nameList = ['A', 'b', 'd', 'u', 'l', 'l', 'a', 'h', ' ', 'A', 'y', 'y', 'a', 's', 'h']
let timeId = setInterval(frame, 200);
let index = 0;
function frame() {
if (index < nameList.length) {
myName.textContent += nameList[index];
index++;
}
if (index === nameList.length) {
clearInterval(timeId);
clearInterval(timeId2);
myName.style.borderRight = '';
}
}
let timeId2 = setInterval(typingEff, 200);
function typingEff() {
let borderVal = myName.style.borderRight;
if (borderVal === '3px solid springgreen') {
myName.style.borderRight = '';
}
else {
myName.style.borderRight = '3px solid springgreen';
}
}
let menuAniTime = setInterval(menuAni,50);
const listItems = document.getElementsByClassName('list-items');
let count = -70;
function menuAni(){
if(count < 0){
count +=6;
for(let i = 0; i < listItems.length; i++){
listItems[i].style.top = count + 'px'
}
}
else{
clearInterval(menuAniTime);
}
}
let timeId3 = setInterval(rotateImg, 20);
let deg = 0;
function rotateImg() {
if (deg > 360) {
clearInterval(timeId3);
}
else {
logoImg.style.rotate = deg + "deg"
deg += 2;
}
}