forked from hariom1616/Tech-Inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FlowerShower.html
60 lines (55 loc) · 1.89 KB
/
FlowerShower.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A relaxing animation of flowers gently falling across the screen, providing a calming and visually pleasing experience.">
<title>Relaxing Flower Fall Animation</title>
<style>
body {
margin: 0;
overflow: hidden;
background: linear-gradient(to bottom, #e0f7fa, #f0f8ff); /* Soft gradient background */
font-family: Arial, sans-serif;
}
.flower {
position: absolute;
top: -50px;
width: 30px;
height: 30px;
background-image: url('https://i.pinimg.com/originals/cd/37/fd/cd37fd0136f4f2c2a0395ba231f39f5a.png'); /* Replace with your flower image URL */
background-size: cover;
opacity: 0.8;
animation: fall linear infinite;
pointer-events: none;
}
@keyframes fall {
0% {
transform: translateX(0) translateY(0) rotate(0);
}
100% {
transform: translateX(calc(20vw - 10vw * random())) translateY(100vh) rotate(720deg);
}
}
</style>
</head>
<body>
<script>
function random() {
return Math.random();
}
function createFlower() {
const flower = document.createElement("div");
flower.classList.add("flower");
flower.style.left = `${Math.random() * 100}vw`;
flower.style.animationDuration = `${Math.random() * 3 + 2}s`; // Random fall speed between 2-5s
flower.style.animationDelay = `${Math.random() * 5}s`; // Random start delay up to 5s
document.body.appendChild(flower);
flower.addEventListener("animationend", () => {
flower.remove(); // Remove flower once it reaches the bottom
});
}
setInterval(createFlower, 300); // New flower every 300ms
</script>
</body>
</html>