html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Happy Birthday Animation</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #dda0dd);
background-size: 400% 400%;
animation: gradientShift 3s ease infinite;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Arial', sans-serif;
overflow: hidden;
}
@keyframes gradientShift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.birthday-container {
text-align: center;
}
.birthday-text {
font-size: 4rem;
font-weight: bold;
color: #fff;
text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
animation: bounce 2s ease-in-out infinite;
}
.word {
display: inline-block;
margin: 0 10px;
}
.word:nth-child(1) {
animation: slideInLeft 1s ease-out, colorChange 3s ease-in-out infinite;
animation-delay: 0s, 1s;
}
.word:nth-child(2) {
animation: slideInRight 1s ease-out, colorChange 3s ease-in-out infinite;
animation-delay: 0.5s, 1.5s;
}
@keyframes slideInLeft {
0% {
transform: translateX(-100px);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slideInRight {
0% {
transform: translateX(100px);
opacity: 0;
}
100% {
transform: translateX(0);
opacity: 1;
}
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-20px);
}
60% {
transform: translateY(-10px);
}
}
@keyframes colorChange {
0% { color: #fff; }
25% { color: #ffff00; }
50% { color: #ff69b4; }
75% { color: #00ff00; }
100% { color: #fff; }
}
.sparkle {
position: absolute;
width: 6px;
height: 6px;
background: #fff;
border-radius: 50%;
animation: sparkleAnimation 2s linear infinite;
}
@keyframes sparkleAnimation {
0% {
opacity: 0;
transform: scale(0);
}
50% {
opacity: 1;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(0);
}
}
.celebration {
margin-top: 2rem;
font-size: 2rem;
animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
@media (max-width: 768px) {
.birthday-text {
font-size: 2.5rem;
}
.celebration {
font-size: 1.5rem;
}
}
</style>
</head>
<body>
<div class="birthday-container">
<div class="birthday-text">
<span class="word">HAPPY</span>
<span class="word">BIRTHDAY</span>
</div>
<div class="celebration">🎉🎂🎈</div>
</div>
<script>
// Create sparkle effects
function createSparkle() {
const sparkle = document.createElement('div');
sparkle.className = 'sparkle';
sparkle.style.left = Math.random() * 100 + 'vw';
sparkle.style.top = Math.random() * 100 + 'vh';
sparkle.style.animationDelay = Math.random() * 2 + 's';
document.body.appendChild(sparkle);
setTimeout(() => {
sparkle.remove();
}, 2000);
}
// Generate sparkles continuously
setInterval(createSparkle, 300);
// Add click effect
document.addEventListener('click', function(e) {
for(let i = 0; i < 5; i++) {
setTimeout(() => {
const sparkle = document.createElement('div');
sparkle.className = 'sparkle';
sparkle.style.left = e.clientX + Math.random() * 40 - 20 + 'px';
sparkle.style.top = e.clientY + Math.random() * 40 - 20 + 'px';
sparkle.style.position = 'fixed';
document.body.appendChild(sparkle);
setTimeout(() => sparkle.remove(), 2000);
}, i * 100);
}
});
</script>
</body>
</html>