-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcelebrate.html
More file actions
131 lines (106 loc) · 3.18 KB
/
celebrate.html
File metadata and controls
131 lines (106 loc) · 3.18 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Celebration</title>
<style>
html, body {
margin: 0;
padding: 0;
overflow: hidden;
background: radial-gradient(circle at center,
#1a1c2f, #0d0f1c 70%);
height: 100vh;
width: 100vw;
font-family: Arial, sans-serif;
}
.balloon {
position: absolute;
bottom: -150px;
width: 40px;
height: 55px;
border-radius: 50%;
opacity: 0.9;
animation: rise 6s linear infinite;
box-shadow: inset -6px -10px 12px rgba(0,0,0,0.2);
}
.string {
position: absolute;
width: 2px;
height: 70px;
background: rgba(255,255,255,0.6);
bottom: -70px;
left: 50%;
transform: translateX(-50%);
}
@keyframes rise {
0% { transform: translateY(0) rotate(0deg); }
100% { transform: translateY(-120vh) rotate(15deg); }
}
/* Confetti */
.confetti {
position: absolute;
width: 8px;
height: 14px;
opacity: 0.9;
animation: confettiFall 4s linear infinite;
}
@keyframes confettiFall {
0% { transform: translateY(0) rotate(0deg); }
100% { transform: translateY(120vh) rotate(360deg); }
}
</style>
</head>
<body>
<script>
// MULTI-COLOURED REAL BALLOONS
const balloonColors = [
"#ff4d4d", "#ff6ec7", "#ffd93d", "#6ef7ff",
"#7df57d", "#b76aff", "#ff914d"
];
// CONFETTI COLOURS
const confettiColors = [
"#ff4d4d", "#ffcc00", "#4dff4d",
"#4da6ff", "#ff66cc", "#ffffff"
];
function createBalloon() {
const balloon = document.createElement("div");
balloon.className = "balloon";
// Random colour
balloon.style.background = balloonColors[Math.floor(Math.random() * balloonColors.length)];
// Random size
const size = Math.random() * 25 + 35;
balloon.style.width = size + "px";
balloon.style.height = (size * 1.3) + "px";
// Random position
balloon.style.left = Math.random() * 100 + "vw";
// Random animation speed
balloon.style.animationDuration = (Math.random() * 4 + 4) + "s";
// Add string
const string = document.createElement("div");
string.className = "string";
balloon.appendChild(string);
document.body.appendChild(balloon);
// Remove balloon after animation
setTimeout(() => balloon.remove(), 8000);
}
function createConfetti() {
const piece = document.createElement("div");
piece.className = "confetti";
// Color
piece.style.background = confettiColors[Math.floor(Math.random() * confettiColors.length)];
// Random starting point (top)
piece.style.left = Math.random() * 100 + "vw";
piece.style.top = "-20px";
// Random rotation speed
piece.style.animationDuration = (Math.random() * 2 + 2) + "s";
document.body.appendChild(piece);
setTimeout(() => piece.remove(), 5000);
}
// CONSTANT BALLOONS FROM EVERYWHERE
setInterval(createBalloon, 180);
// HEAVY CONFETTI RAIN
setInterval(createConfetti, 60);
</script>
</body>
</html>