-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathscript.js
58 lines (51 loc) · 1.89 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
(function () {
const second = 1000,
minute = second * 60,
hour = minute * 60,
day = hour * 24;
const eventday = "May 14, 2024 00:00:00";
const countDown = new Date(eventday).getTime(),
x = setInterval(function () {
const now = new Date().getTime(),
distance = countDown - now;
(document.getElementById("days").innerText = Math.floor(
distance / day
)),
(document.getElementById("hours").innerText = Math.floor(
(distance % day) / hour
)),
(document.getElementById("minutes").innerText = Math.floor(
(distance % hour) / minute
)),
(document.getElementById("seconds").innerText = Math.floor(
(distance % minute) / second
));
//do something later when date is reached
if (distance < 0) {
document.getElementById("headline").innerText =
"DEADLINE HAS PASSED!!";
document.getElementById("countdown").style.display = "none";
document.getElementById("content").style.display = "block";
clearInterval(x);
}
//seconds
}, 0);
})();
const ball1 = document.querySelector(".ball1");
const ball2 = document.querySelector(".ball2");
const ball3 = document.querySelector(".ball3");
const ball4 = document.querySelector(".ball4");
const ball5 = document.querySelector(".ball5");
function moveBall(ball) {
const xPosition = Math.random() * window.innerWidth;
const yPosition = Math.random() * window.innerHeight;
ball.style.left = `${xPosition}px`;
ball.style.top = `${yPosition}px`;
}
setInterval(() => {
moveBall(ball1);
moveBall(ball2);
moveBall(ball3);
moveBall(ball4);
moveBall(ball5);
}, 5000);