-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmirror-snow.html
89 lines (78 loc) · 2.07 KB
/
mirror-snow.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Chris smells</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="" />
</head>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background: #001f3f; /* Dark background for better visibility of snow */
height: 100vh;
}
.snow-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.snowflake {
position: absolute;
top: -10px;
background: white;
width: 10px;
height: 10px;
border-radius: 50%;
opacity: 0.8;
animation: fall linear infinite;
}
@keyframes fall {
to {
transform: translateY(100vh);
}
}
</style>
<body>
<div class="snow-container">
<div style="padding: 60px 60px 60px 60px; color: white" ;>
<h1>Jingle Bells Chris Hyam Smells</h1>
<p>He smells really bad.</p>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const snowContainer = document.querySelector(".snow-container");
const numberOfSnowflakes = 100;
function createSnowflake() {
const snowflake = document.createElement("div");
snowflake.classList.add("snowflake");
// Random position for each snowflake
snowflake.style.left = Math.random() * 100 + "vw";
// Random animation duration
snowflake.style.animationDuration = Math.random() * 3 + 2 + "s";
// Random size
const size = Math.random() * 5 + 5 + "px";
snowflake.style.width = size;
snowflake.style.height = size;
// Random delay
snowflake.style.animationDelay = Math.random() * 5 + "s";
snowContainer.appendChild(snowflake);
// Remove snowflake after animation ends
snowflake.addEventListener("animationend", () => {
snowflake.remove();
});
}
// Create snowflakes at regular intervals
setInterval(createSnowflake, 200);
});
</script>
</body>
</html>