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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Interactive Greeting</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
8 |
+
<style>
|
9 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
|
10 |
+
|
11 |
+
* {
|
12 |
+
margin: 0;
|
13 |
+
padding: 0;
|
14 |
+
box-sizing: border-box;
|
15 |
+
font-family: 'Poppins', sans-serif;
|
16 |
+
}
|
17 |
+
|
18 |
+
body {
|
19 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
20 |
+
min-height: 100vh;
|
21 |
+
display: flex;
|
22 |
+
justify-content: center;
|
23 |
+
align-items: center;
|
24 |
+
overflow: hidden;
|
25 |
+
}
|
26 |
+
|
27 |
+
.greeting-card {
|
28 |
+
position: relative;
|
29 |
+
width: 90%;
|
30 |
+
max-width: 500px;
|
31 |
+
background: white;
|
32 |
+
border-radius: 20px;
|
33 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
|
34 |
+
padding: 40px;
|
35 |
+
text-align: center;
|
36 |
+
transform-style: preserve-3d;
|
37 |
+
transition: transform 0.5s;
|
38 |
+
overflow: hidden;
|
39 |
+
cursor: pointer;
|
40 |
+
}
|
41 |
+
|
42 |
+
.greeting-card::before {
|
43 |
+
content: '';
|
44 |
+
position: absolute;
|
45 |
+
top: -50%;
|
46 |
+
left: -50%;
|
47 |
+
width: 200%;
|
48 |
+
height: 200%;
|
49 |
+
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
50 |
+
transform: rotate(45deg);
|
51 |
+
transition: 0.5s;
|
52 |
+
}
|
53 |
+
|
54 |
+
.greeting-card:hover::before {
|
55 |
+
left: 100%;
|
56 |
+
}
|
57 |
+
|
58 |
+
.card-content {
|
59 |
+
position: relative;
|
60 |
+
z-index: 1;
|
61 |
+
}
|
62 |
+
|
63 |
+
h1 {
|
64 |
+
color: #444;
|
65 |
+
margin-bottom: 20px;
|
66 |
+
font-weight: 700;
|
67 |
+
font-size: 2.2rem;
|
68 |
+
transition: all 0.3s;
|
69 |
+
}
|
70 |
+
|
71 |
+
p {
|
72 |
+
color: #666;
|
73 |
+
line-height: 1.6;
|
74 |
+
margin-bottom: 30px;
|
75 |
+
font-size: 1.1rem;
|
76 |
+
}
|
77 |
+
|
78 |
+
.btn {
|
79 |
+
display: inline-block;
|
80 |
+
padding: 12px 30px;
|
81 |
+
background: linear-gradient(45deg, #667eea, #764ba2);
|
82 |
+
color: white;
|
83 |
+
border-radius: 30px;
|
84 |
+
text-decoration: none;
|
85 |
+
font-weight: 600;
|
86 |
+
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
|
87 |
+
transition: all 0.3s;
|
88 |
+
border: none;
|
89 |
+
cursor: pointer;
|
90 |
+
}
|
91 |
+
|
92 |
+
.btn:hover {
|
93 |
+
transform: translateY(-3px);
|
94 |
+
box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
|
95 |
+
}
|
96 |
+
|
97 |
+
.bubbles {
|
98 |
+
position: absolute;
|
99 |
+
width: 100%;
|
100 |
+
height: 100%;
|
101 |
+
top: 0;
|
102 |
+
left: 0;
|
103 |
+
z-index: -1;
|
104 |
+
pointer-events: none;
|
105 |
+
}
|
106 |
+
|
107 |
+
.bubble {
|
108 |
+
position: absolute;
|
109 |
+
background: rgba(255, 255, 255, 0.5);
|
110 |
+
border-radius: 50%;
|
111 |
+
animation: float 15s infinite linear;
|
112 |
+
}
|
113 |
+
|
114 |
+
@keyframes float {
|
115 |
+
0% {
|
116 |
+
transform: translateY(0) rotate(0deg);
|
117 |
+
opacity: 1;
|
118 |
+
}
|
119 |
+
100% {
|
120 |
+
transform: translateY(-1000px) rotate(720deg);
|
121 |
+
opacity: 0;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
.emoji-container {
|
126 |
+
font-size: 3rem;
|
127 |
+
margin: 20px 0;
|
128 |
+
height: 80px;
|
129 |
+
position: relative;
|
130 |
+
}
|
131 |
+
|
132 |
+
.emoji {
|
133 |
+
position: absolute;
|
134 |
+
left: 50%;
|
135 |
+
transform: translateX(-50%);
|
136 |
+
transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
137 |
+
}
|
138 |
+
|
139 |
+
.hidden {
|
140 |
+
opacity: 0;
|
141 |
+
transform: translateX(-50%) scale(0.5);
|
142 |
+
}
|
143 |
+
|
144 |
+
.stars {
|
145 |
+
position: absolute;
|
146 |
+
width: 100%;
|
147 |
+
height: 100%;
|
148 |
+
top: 0;
|
149 |
+
left: 0;
|
150 |
+
z-index: -1;
|
151 |
+
}
|
152 |
+
|
153 |
+
.star {
|
154 |
+
position: absolute;
|
155 |
+
background: white;
|
156 |
+
width: 3px;
|
157 |
+
height: 3px;
|
158 |
+
border-radius: 50%;
|
159 |
+
animation: twinkle 4s infinite;
|
160 |
+
}
|
161 |
+
|
162 |
+
@keyframes twinkle {
|
163 |
+
0% { opacity: 0.2; }
|
164 |
+
50% { opacity: 1; }
|
165 |
+
100% { opacity: 0.2; }
|
166 |
+
}
|
167 |
+
</style>
|
168 |
+
</head>
|
169 |
+
<body>
|
170 |
+
<div class="greeting-card" id="card">
|
171 |
+
<div class="bubbles"></div>
|
172 |
+
<div class="stars"></div>
|
173 |
+
<div class="card-content">
|
174 |
+
<div class="emoji-container">
|
175 |
+
<div class="emoji" id="hello-emoji">👋</div>
|
176 |
+
<div class="emoji hidden" id="smile-emoji">😊</div>
|
177 |
+
<div class="emoji hidden" id="heart-emoji">❤️</div>
|
178 |
+
</div>
|
179 |
+
<h1 id="greeting-text">Hello!</h1>
|
180 |
+
<p id="message-text">Thanks for stopping by! Click me to see some magic happen.</p>
|
181 |
+
<button class="btn" id="action-btn">Surprise Me!</button>
|
182 |
+
</div>
|
183 |
+
</div>
|
184 |
+
|
185 |
+
<script>
|
186 |
+
document.addEventListener('DOMContentLoaded', function() {
|
187 |
+
const card = document.getElementById('card');
|
188 |
+
const greetingText = document.getElementById('greeting-text');
|
189 |
+
const messageText = document.getElementById('message-text');
|
190 |
+
const actionBtn = document.getElementById('action-btn');
|
191 |
+
const helloEmoji = document.getElementById('hello-emoji');
|
192 |
+
const smileEmoji = document.getElementById('smile-emoji');
|
193 |
+
const heartEmoji = document.getElementById('heart-emoji');
|
194 |
+
const bubblesContainer = document.querySelector('.bubbles');
|
195 |
+
const starsContainer = document.querySelector('.stars');
|
196 |
+
|
197 |
+
// Create bubbles
|
198 |
+
for (let i = 0; i < 20; i++) {
|
199 |
+
createBubble();
|
200 |
+
}
|
201 |
+
|
202 |
+
// Create stars
|
203 |
+
for (let i = 0; i < 50; i++) {
|
204 |
+
createStar();
|
205 |
+
}
|
206 |
+
|
207 |
+
// Current state
|
208 |
+
let state = 0;
|
209 |
+
const messages = [
|
210 |
+
{ greeting: "Hello!", message: "Thanks for stopping by! Click me to see some magic happen.", emoji: "👋" },
|
211 |
+
{ greeting: "Have a wonderful day!", message: "I hope your day is filled with joy and happiness.", emoji: "😊" },
|
212 |
+
{ greeting: "You're awesome!", message: "Just wanted to remind you how amazing you are!", emoji: "❤️" },
|
213 |
+
{ greeting: "Hello again!", message: "The magic continues! Click the button for another surprise.", emoji: "✨" }
|
214 |
+
];
|
215 |
+
|
216 |
+
// Card click event
|
217 |
+
card.addEventListener('click', function() {
|
218 |
+
state = (state + 1) % 4;
|
219 |
+
updateCard();
|
220 |
+
animateCard();
|
221 |
+
});
|
222 |
+
|
223 |
+
// Button click event
|
224 |
+
actionBtn.addEventListener('click', function(e) {
|
225 |
+
e.stopPropagation();
|
226 |
+
createConfetti();
|
227 |
+
});
|
228 |
+
|
229 |
+
function updateCard() {
|
230 |
+
const currentMessage = messages[state];
|
231 |
+
greetingText.textContent = currentMessage.greeting;
|
232 |
+
messageText.textContent = currentMessage.message;
|
233 |
+
|
234 |
+
// Hide all emojis
|
235 |
+
[helloEmoji, smileEmoji, heartEmoji].forEach(emoji => {
|
236 |
+
emoji.classList.add('hidden');
|
237 |
+
});
|
238 |
+
|
239 |
+
// Show the appropriate emoji
|
240 |
+
switch(state) {
|
241 |
+
case 0:
|
242 |
+
helloEmoji.classList.remove('hidden');
|
243 |
+
break;
|
244 |
+
case 1:
|
245 |
+
smileEmoji.classList.remove('hidden');
|
246 |
+
break;
|
247 |
+
case 2:
|
248 |
+
heartEmoji.classList.remove('hidden');
|
249 |
+
break;
|
250 |
+
case 3:
|
251 |
+
// For the 4th state, show all briefly
|
252 |
+
[helloEmoji, smileEmoji, heartEmoji].forEach((emoji, index) => {
|
253 |
+
setTimeout(() => {
|
254 |
+
emoji.classList.remove('hidden');
|
255 |
+
setTimeout(() => {
|
256 |
+
emoji.classList.add('hidden');
|
257 |
+
}, 500);
|
258 |
+
}, index * 300);
|
259 |
+
});
|
260 |
+
break;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
function animateCard() {
|
265 |
+
card.style.transform = 'rotateY(10deg)';
|
266 |
+
setTimeout(() => {
|
267 |
+
card.style.transform = 'rotateY(-10deg)';
|
268 |
+
setTimeout(() => {
|
269 |
+
card.style.transform = 'rotateY(0)';
|
270 |
+
}, 150);
|
271 |
+
}, 150);
|
272 |
+
}
|
273 |
+
|
274 |
+
function createBubble() {
|
275 |
+
const bubble = document.createElement('div');
|
276 |
+
bubble.classList.add('bubble');
|
277 |
+
|
278 |
+
const size = Math.random() * 40 + 10;
|
279 |
+
const posX = Math.random() * 100;
|
280 |
+
const delay = Math.random() * 15;
|
281 |
+
const duration = Math.random() * 10 + 10;
|
282 |
+
|
283 |
+
bubble.style.width = `${size}px`;
|
284 |
+
bubble.style.height = `${size}px`;
|
285 |
+
bubble.style.left = `${posX}%`;
|
286 |
+
bubble.style.bottom = `-${size}px`;
|
287 |
+
bubble.style.animationDuration = `${duration}s`;
|
288 |
+
bubble.style.animationDelay = `${delay}s`;
|
289 |
+
|
290 |
+
bubblesContainer.appendChild(bubble);
|
291 |
+
|
292 |
+
// Remove bubble after animation completes
|
293 |
+
setTimeout(() => {
|
294 |
+
bubble.remove();
|
295 |
+
createBubble(); // Create new bubble
|
296 |
+
}, (duration + delay) * 1000);
|
297 |
+
}
|
298 |
+
|
299 |
+
function createStar() {
|
300 |
+
const star = document.createElement('div');
|
301 |
+
star.classList.add('star');
|
302 |
+
|
303 |
+
const posX = Math.random() * 100;
|
304 |
+
const posY = Math.random() * 100;
|
305 |
+
const delay = Math.random() * 4;
|
306 |
+
const size = Math.random() * 2 + 1;
|
307 |
+
|
308 |
+
star.style.left = `${posX}%`;
|
309 |
+
star.style.top = `${posY}%`;
|
310 |
+
star.style.width = `${size}px`;
|
311 |
+
star.style.height = `${size}px`;
|
312 |
+
star.style.animationDelay = `${delay}s`;
|
313 |
+
|
314 |
+
starsContainer.appendChild(star);
|
315 |
+
}
|
316 |
+
|
317 |
+
function createConfetti() {
|
318 |
+
// Clear any existing confetti
|
319 |
+
const existingConfetti = document.querySelectorAll('.confetti');
|
320 |
+
existingConfetti.forEach(el => el.remove());
|
321 |
+
|
322 |
+
// Create 50 confetti pieces
|
323 |
+
for (let i = 0; i < 50; i++) {
|
324 |
+
const confetti = document.createElement('div');
|
325 |
+
confetti.classList.add('confetti');
|
326 |
+
|
327 |
+
// Random properties
|
328 |
+
const colors = ['#ff9ff3', '#feca57', '#ff6b6b', '#48dbfb', '#1dd1a1', '#f368e0'];
|
329 |
+
const color = colors[Math.floor(Math.random() * colors.length)];
|
330 |
+
const size = Math.random() * 10 + 5;
|
331 |
+
const posX = Math.random() * 100;
|
332 |
+
const rotation = Math.random() * 360;
|
333 |
+
const animationDuration = Math.random() * 3 + 2;
|
334 |
+
|
335 |
+
// Position absolutely within the card
|
336 |
+
confetti.style.position = 'absolute';
|
337 |
+
confetti.style.width = `${size}px`;
|
338 |
+
confetti.style.height = `${size}px`;
|
339 |
+
confetti.style.backgroundColor = color;
|
340 |
+
confetti.style.left = `${posX}%`;
|
341 |
+
confetti.style.top = '20%';
|
342 |
+
confetti.style.borderRadius = '50%';
|
343 |
+
confetti.style.transform = `rotate(${rotation}deg)`;
|
344 |
+
confetti.style.zIndex = '10';
|
345 |
+
|
346 |
+
// Animation - falls down with varying timing
|
347 |
+
confetti.style.animation = `confetti-fall ${animationDuration}s forwards`;
|
348 |
+
|
349 |
+
card.appendChild(confetti);
|
350 |
+
|
351 |
+
// Remove after animation
|
352 |
+
setTimeout(() => {
|
353 |
+
confetti.remove();
|
354 |
+
}, animationDuration * 1000);
|
355 |
+
}
|
356 |
+
|
357 |
+
// Add CSS for animation
|
358 |
+
const style = document.createElement('style');
|
359 |
+
style.innerHTML = `
|
360 |
+
@keyframes confetti-fall {
|
361 |
+
0% {
|
362 |
+
transform: translateY(0) rotate(0deg);
|
363 |
+
opacity: 1;
|
364 |
+
}
|
365 |
+
100% {
|
366 |
+
transform: translateY(300px) rotate(720deg);
|
367 |
+
opacity: 0;
|
368 |
+
}
|
369 |
+
}
|
370 |
+
`;
|
371 |
+
document.head.appendChild(style);
|
372 |
+
}
|
373 |
+
|
374 |
+
// Automatic greeting change every 8 seconds
|
375 |
+
setInterval(() => {
|
376 |
+
state = (state + 1) % 4;
|
377 |
+
updateCard();
|
378 |
+
animateCard();
|
379 |
+
}, 8000);
|
380 |
+
});
|
381 |
+
</script>
|
382 |
+
</body>
|
383 |
</html>
|