forked from dzired/labilityrip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
156 lines (141 loc) · 4.95 KB
/
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
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
//Clock
function getTime() {
var date = new Date();
var h = (date.getHours() <= 9) ? "0"+date.getHours() : date.getHours();
var m = (date.getMinutes() <= 9) ? "0"+date.getMinutes() : date.getMinutes();
var s = (date.getSeconds() <= 9) ? "0"+date.getSeconds() : date.getSeconds();
$("#time").text(`${h}:${m}:${s}`);
}
setInterval(getTime, 1000);
getTime();
//Colored Text
let colorsArr = [
"red",
"cyan",
"purple",
"orange"
]
let colori = 0;
setInterval(() => {
document.documentElement.style.setProperty('--color', colorsArr[colori]);
if (colori == colorsArr.length-1) {colori = 0} else {colori++};
}, 2000);
//Video volume
document.getElementById("vid").volume = 0.6;
//Main Function
mainActive = false;
setTimeout(() => {if (document.getElementById("vid").paused) {$("#clickToPlay").css("opacity", "1");} else {main()}}, 1000);
function main() {
if (mainActive) return;
mainActive = true;
$("#clickToPlay").css("opacity", "0");
$("#main").css("opacity", "1");
$("#widgetContainer").css("opacity", "1");
$(".hitCount").css("opacity", "1");
setTimeout(() => {
$("#clickToPlay").css("display", "none");
}, 1050);
document.getElementById("vid").play();
//Border
borderTop = 0;
borderRight = 0;
borderBottom = 0;
borderLeft = 0;
function topBorder() {
let int = setInterval(() => {
borderTop++;
if (borderTop <= 100) {
$("#borderTop").css("width", borderTop+"%");
} else {
rightBorder();
clearInterval(int);
$("#borderTop").css({"left": "", "right": "0"});
setTimeout(() => {
let int = setInterval(() => {
borderTop--;
if (borderTop >= 0) {
$("#borderTop").css("width", borderTop+"%");
} else {
$("#borderTop").css({"right": "", "left": "0"});
clearInterval(int);
}
}, 7);
}, 250);
}
}, 7);
}
function rightBorder() {
let int = setInterval(() => {
borderRight++;
if (borderRight <= 100) {
$("#borderRight").css("height", borderRight+"%");
} else {
bottomBorder();
clearInterval(int);
$("#borderRight").css({"top": "", "bottom": "0"});
setTimeout(() => {
let int = setInterval(() => {
borderRight--;
if (borderRight >= 0) {
$("#borderRight").css("height", borderRight+"%");
} else {
$("#borderRight").css({"bottom": "", "top": "0"});
clearInterval(int);
}
}, 5);
}, 450);
}
}, 5);
}
function bottomBorder() {
let int = setInterval(() => {
borderBottom++;
if (borderBottom <= 100) {
$("#borderBottom").css("width", borderBottom+"%");
} else {
leftBorder();
clearInterval(int);
$("#borderBottom").css({"right": "", "left": "0"});
setTimeout(() => {
let int = setInterval(() => {
borderBottom--;
if (borderBottom >= 0) {
$("#borderBottom").css("width", borderBottom+"%");
} else {
$("#borderBottom").css({"left": "", "right": "0"});
clearInterval(int);
}
}, 7);
}, 250);
}
}, 7);
}
function leftBorder() {
let int = setInterval(() => {
borderLeft++;
if (borderLeft <= 100) {
$("#borderLeft").css("height", borderLeft+"%");
} else {
topBorder();
clearInterval(int);
$("#borderLeft").css({"bottom": "", "top": "0"});
setTimeout(() => {
let int = setInterval(() => {
borderLeft--;
if (borderLeft >= 0) {
$("#borderLeft").css("height", borderLeft+"%");
} else {
$("#borderLeft").css({"top": "", "bottom": "0"});
clearInterval(int);
}
}, 5);
}, 450);
}
}, 5);
}
topBorder();
}
//Start Main Function
$("#clickToPlay").click(() => {
main();
});