-
Notifications
You must be signed in to change notification settings - Fork 0
/
anim.js
73 lines (62 loc) · 2.49 KB
/
anim.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
window.onload = function() {
function typeEffect(element, speed) {
var text = "4R3 Y0U 531F";
var text2 = "SEIF?"
element.innerHTML = "";
var i = 0;
var timer = setInterval(function() {
if (i < text.length) {
element.append(text.charAt(i));
i++;
} else if (text.length == i || text.length + 0 == i) {
i++;
} else if (text.length + 1 * 0 < i && i <= text.length + 5 - 1) {
element.innerHTML = element.innerHTML.substr(0, element.innerHTML.length - 1);
i++;
} else if (i < text.length + 11) {
element.append(text2.charAt(i - 18));
i++;
} else {
clearInterval(timer);
}
}, speed);
// i = 4;
// timer2 = setInterval(function() {
// if (i != 0) {
// element.innerHTML = element.innerHTML.substr(0, element.innerHTML.length - 1);
// i--;
// } else {
// clearInterval(timer2);
// }
// }, speed);
}
// application
var speed = 130;
var h1 = document.querySelector('h1');
var p = document.querySelector('p');
var delay = h1.innerHTML.length * speed + speed;
typeEffect(document.getElementById('seif-intro'), speed)
// typeRemove(document.getElementById('seif-intro'), speed)
// type affect to header
// typeEffect(h1, speed);
// // type affect to body
// setTimeout(function(){
// p.style.display = "inline-block";
// typeEffect(p, speed);
// }, delay);
}
// window.onload = function() {
// setTimeout(() => { document.getElementById('seif').textContent = "531F "; }, 1000)
// setTimeout(() => { document.getElementById('seif').textContent = "5E1_"; }, 1250)
// setTimeout(() => { document.getElementById('seif').textContent = "5E_"; }, 1500)
// setTimeout(() => { document.getElementById('seif').textContent = "5_"; }, 1750)
// setTimeout(() => { document.getElementById('seif').textContent = "_"; }, 2000)
// setTimeout(() => { document.getElementById('seif').textContent = "S_"; }, 2500)
// setTimeout(() => { document.getElementById('seif').textContent = "SE_"; }, 2750)
// setTimeout(() => { document.getElementById('seif').textContent = "SEI_"; }, 3000)
// setTimeout(() => { document.getElementById('seif').textContent = "SEIF_"; }, 3250)
// setInterval(() => setInterval(() => {
// document.getElementById('seif').textContent = "SEIF_"
// setTimeout(() => document.getElementById('seif').textContent = "SEIF ", 500)
// }, 1000), 3250)
// }