-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptForHomePage.js
More file actions
35 lines (30 loc) · 863 Bytes
/
Copy pathscriptForHomePage.js
File metadata and controls
35 lines (30 loc) · 863 Bytes
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
let bgMusic = new Audio("bgmusicMainPage.mp3");
bgMusic.play();
bgMusic.addEventListener(
"ended",
function () {
this.currentTime = 0;
this.play();
},
false
);
const rainEffect = () => {
let dropCount = 180;
let bg = document.querySelector(".background-container");
console.log("worings");
let rainCount = 0;
while (rainCount < dropCount) {
let drop = document.createElement("i");
let size = Math.random() * 5;
let posX = Math.floor(Math.random() * window.innerWidth);
let delay = Math.random() * -20;
let duration = Math.random() * 5;
drop.style.width = `${0.5 + size}px`;
drop.style.left = `${posX}px`;
drop.style.animationDelay = `${delay}s`;
drop.style.animationDuration = `${1 + duration}s`;
bg.appendChild(drop);
rainCount++;
}
};
rainEffect();