-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext-animation.js
260 lines (198 loc) · 7.11 KB
/
text-animation.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// this file contains the code for all the animations seen on the website , the logic of the animations has been programmed bellow , linked to the html file as text-animation.js
// the bellow block of code contains an array that holds the skills and a DOM method calling an id from the index.html file
const worksArray = ["WEBSITE DEVELOPMENT" ,"HARDWARE DEVELOPMENT", "SOFTWARE DEVELOPMENT"];
let cursorCount = 0;
const words = document.getElementById("works-text");
// the bellow consts are used to call the classes that associate with the filler for loading array animation (card one under unfinished project)
const fillerOne = document.querySelector(".filler-one");
const fillerTwo = document.querySelector(".filler-two");
const fillerThree = document.querySelector(".filler-three");
const fillerFour = document.querySelector(".filler-four");
const fillerFive = document.querySelector(".filler-five");
const fillerSix = document.querySelector(".filler-six");
const fillerSeven = document.querySelector(".filler-seven");
// the bellow consts are used to call the classes that associate with the filler for loading array animation (card two under unfinished project)
const fillerOneC2 = document.querySelector(".filler-one-c2");
const fillerTwoC2 = document.querySelector(".filler-two-c2");
const fillerThreeC2 = document.querySelector(".filler-three-c2");
const fillerFourC2 = document.querySelector(".filler-four-c2");
const fillerFiveC2 = document.querySelector(".filler-five-c2");
const fillerSixC2 = document.querySelector(".filler-six-c2");
const fillerSevenC2 = document.querySelector(".filler-seven-c2");
// the bellow set of code contains the fcuntion that is responsible for the typing animation
words.innerText = worksArray[cursorCount];
function textanimation(){
cursorCount++;
console.log(cursorCount);
let index = (cursorCount + 1) % worksArray.length;
if (cursorCount % 3 === 1) {
console.log(worksArray[index]);
words.innerText = worksArray[index];
} else if (cursorCount % 3 === 2) {
console.log(worksArray[index]);
words.innerText = worksArray[index];
} else if (cursorCount % 3 === 0) {
console.log(worksArray[index]);
words.innerText = worksArray[index];
}
if (cursorCount === Infinity) {
clearInterval(intervalId);
}
}
textanimation(); //function call for executing animation
setInterval(textanimation , 4700);
//
function loadingAnimationCardOne(){
fillerOne.style.display = "none";
fillerTwo.style.display = "none";
fillerThree.style.display = "none";
fillerFour.style.display = "none";
fillerFive.style.display = "none";
fillerSix.style.display = "none";
fillerSeven.style.display = "none";
setTimeout(() => {
fillerOne.style.display = "block"
}, 500);
setTimeout(() => {
fillerTwo.style.display = "block"
}, 1000);
setTimeout(() => {
fillerThree.style.display = "block"
}, 1500);
setTimeout(() => {
fillerFour.style.display = "block"
}, 2000);
setTimeout(() => {
fillerFive.style.display = "block"
}, 2500);
setTimeout(() => {
fillerSix.style.display = "block"
}, 3000);
setTimeout(() => {
fillerSeven.style.display = "block"
}, 3500);
//
setTimeout(() => {
fillerSeven.style.display = "none"
}, 4000);
setTimeout(() => {
fillerSix.style.display = "none"
}, 4500);
setTimeout(() => {
fillerFive.style.display = "none"
}, 5000);
setTimeout(() => {
fillerFour.style.display = "none"
}, 5500);
setTimeout(() => {
fillerThree.style.display = "none"
}, 6000);
setTimeout(() => {
fillerTwo.style.display = "none"
}, 6500);
setTimeout(() => {
fillerOne.style.display = "none"
}, 7000);
}
loadingAnimationCardOne();
setInterval(loadingAnimationCardOne , 7000);
//
function loadingAnimationCardTwo(){
fillerOneC2.style.display = "none";
fillerTwoC2.style.display = "none";
fillerThreeC2.style.display = "none";
fillerFourC2.style.display = "none";
fillerFiveC2.style.display = "none";
fillerSixC2.style.display = "none";
fillerSevenC2.style.display = "none";
setTimeout(() => {
fillerOneC2.style.display = "block"
}, 500);
setTimeout(() => {
fillerTwoC2.style.display = "block"
}, 1000);
setTimeout(() => {
fillerThreeC2.style.display = "block"
}, 1500);
setTimeout(() => {
fillerFourC2.style.display = "block"
}, 2000);
setTimeout(() => {
fillerFiveC2.style.display = "block"
}, 2500);
setTimeout(() => {
fillerSixC2.style.display = "block"
}, 3000);
setTimeout(() => {
fillerSevenC2.style.display = "block"
}, 3500);
//
setTimeout(() => {
fillerSevenC2.style.display = "none"
}, 4000);
setTimeout(() => {
fillerSixC2.style.display = "none"
}, 4500);
setTimeout(() => {
fillerFiveC2.style.display = "none"
}, 5000);
setTimeout(() => {
fillerFourC2.style.display = "none"
}, 5500);
setTimeout(() => {
fillerThreeC2.style.display = "none"
}, 6000);
setTimeout(() => {
fillerTwoC2.style.display = "none"
}, 6500);
setTimeout(() => {
fillerOneC2.style.display = "none"
}, 7000);
}
loadingAnimationCardTwo();
setInterval(loadingAnimationCardTwo , 7000);
// function for copying the email id from the header.
let copyButton = document.getElementById("copy_button");
function copyToClickBoard(){
console.log(copyButton);
copyButton.innerText = "Copied";
}
// trigger for the project section (will open up the projects detail)
function popupOpen(){
var value = document.getElementById("trig");
var bgBlur = document.getElementById("blur-on-click");
value.style.display = "flex";
value.style.position = "fixed"; // Keeps it in place
value.style.top = "0";
value.style.left = "375px";
value.style.width = "800px";
value.style.height = "800px";
value.style.justifyContent = "center";
value.style.alignItems = "center";
value.style.zIndex = "9999";
bgBlur.style.filter = "blur(10px)";
document.body.style.overflow = "hidden";
}
function popupClose(){
var value = document.getElementById("trig");
var bgBlur = document.getElementById("blur-on-click");
value.style.display = "none";
bgBlur.style.filter = "none";
document.body.style.overflow = "auto";
}
document.addEventListener("keydown" , function(event){
var value = document.getElementById("trig");
var bgBlur = document.getElementById("blur-on-click");
if(event.key === "Escape"){
value.style.display = "none";
bgBlur.style.filter = "none";
}
});
function handleClickOnScreenSize(){ //this will check the screen size and do the redirection
if (window.innerWidth < 640) {
window.location.href = "case_study.html";
} else {
popupOpen();
}
}