forked from mrigaankzoro/Hacktoberfest24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomemojigen.html
44 lines (41 loc) · 1.04 KB
/
randomemojigen.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emoji Rain</title>
<style>
body {
overflow: hidden;
background-color: #000;
margin: 0;
height: 100vh;
}
.emoji {
position: absolute;
font-size: 2rem;
animation: fall linear infinite;
}
@keyframes fall {
to {
transform: translateY(100vh);
}
}
</style>
</head>
<body>
<script>
const emojis = ['🌸', '💧', '🔥', '⭐', '🍀', '🍕', '🎲', '👾'];
function createEmoji() {
const emoji = document.createElement('div');
emoji.textContent = emojis[Math.floor(Math.random() * emojis.length)];
emoji.classList.add('emoji');
emoji.style.left = `${Math.random() * 100}vw`;
emoji.style.animationDuration = `${Math.random() * 3 + 2}s`;
document.body.appendChild(emoji);
emoji.addEventListener('animationend', () => emoji.remove());
}
setInterval(createEmoji, 300);
</script>
</body>
</html>