<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kar Yağışı</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
font-family: Arial, sans-serif;
}
.snowflake {
position: fixed;
top: -10px;
color: white;
font-size: 1em;
user-select: none;
pointer-events: none;
animation: fall linear infinite;
opacity: 0.8;
z-index: 9999;
}
@keyframes fall {
to {
transform: translateY(100vh) rotate(360deg);
}
}
</style>
</head>
<body>
<script>
function createSnowflake() {
const snowflake = document.createElement('div');
snowflake.classList.add('snowflake');
snowflake.innerHTML = '❄';
const startX = Math.random() * window.innerWidth;
const size = Math.random() * 1.5 + 0.5;
const duration = Math.random() * 10 + 15;
const delay = Math.random() * 5;
snowflake.style.left = startX + 'px';
snowflake.style.fontSize = size + 'em';
snowflake.style.animationDuration = duration + 's';
snowflake.style.animationDelay = delay + 's';
snowflake.style.opacity = Math.random() * 0.6 + 0.4;
document.body.appendChild(snowflake);
setTimeout(() => {
snowflake.remove();
}, (duration + delay) * 1000);
}
// Düzenli aralıklarla kar tanesi oluştur
setInterval(createSnowflake, 150);
// Başlangıçta daha yoğun kar tanesi oluştur
for (let i = 0; i < 60; i++) {
setTimeout(createSnowflake, i * 50);
}
</script>
</body>
</html>Demo:
https://deffdemo.xyz/paylasimlar/