-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
53 lines (50 loc) · 1.33 KB
/
test.html
File metadata and controls
53 lines (50 loc) · 1.33 KB
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.background {
background-color: black;
width: 100vw;
height: 100vh;
}
.stars {
top: 0;
position: relative;
width: 1px;
height: 1px;
background: #ffffff; /* Star color */
box-shadow: 0 0 2px #ffffff; /* Add glow effect */
animation: star-fall 20s linear infinite; /* Adjust the animation speed */
z-index:9999;
}
@keyframes star-fall {
0% {
transform: translateY(-100vh); /* Initial position off-screen at the top */
}
100% {
transform: translateY(100vh); /* Final position off-screen at the bottom */
}
}
@media screen and (max-width: 768px) {
.stars {
opacity: 0.5;
}
}
</style>
</head>
<body>
<div class="background"></div>
<script>
for (let i = 0; i < 400; i++) {
const star = document.createElement('div');
star.className = 'stars';
star.style.left = `${Math.random() * 100}%`;
star.style.top = `${Math.random() * 100}%`;
star.style.animationDelay = `${Math.random() * 20}s`; /* Randomize animation delays */
document.body.appendChild(star);
}
</script>
</body>
</html>