-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (26 loc) · 1023 Bytes
/
script.js
File metadata and controls
31 lines (26 loc) · 1023 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
document.addEventListener("DOMContentLoaded", () => {
const flower = document.querySelector("#animation-flower");
const word = document.querySelector("h1");
const rainDrop = document.querySelector(".rain-drop");
setTimeout(() => {
flower.style.display = "inherit";
word.style.display = "none";
}, 2000);
});
function createRaindrop() {
const body = document.querySelector("body");
const xPosition = Math.random() * window.innerWidth;
const delay = Math.random() * 5;
const duration = Math.random() * 2 + 2;
const rainDrop = document.createElement("div");
rainDrop.className = "rain";
rainDrop.style.left = `${xPosition}px`;
rainDrop.style.animationDelay = `${delay}s`;
rainDrop.style.animationDuration = `${duration}s`;
rainDrop.style.display = "none";
body.appendChild(rainDrop);
setTimeout(() => {
rainDrop.style.display = "inherit";
}, 800);
}
setInterval(createRaindrop, 100);