Skip to content

Commit 4998d3f

Browse files
authored
Added Shooting Stars Night Background (#1496)
1 parent 8140535 commit 4998d3f

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="style.css">
7+
<title>Shooting Stars Night Background</title>
8+
</head>
9+
<body>
10+
<script>
11+
function createStar() {
12+
const star = document.createElement("div");
13+
star.classList.add("star");
14+
document.body.appendChild(star);
15+
16+
const size = Math.random() * 3 + "px";
17+
star.style.width = size;
18+
star.style.height = size;
19+
star.style.left = Math.random() * 100 + "vw";
20+
star.style.top = Math.random() * 100 + "vh";
21+
star.style.animationDuration = Math.random() * 3 + 2 + "s";
22+
23+
setTimeout(() => { star.remove(); }, 5000);
24+
}
25+
26+
function createShootingStar() {
27+
const shootingStar = document.createElement("div");
28+
shootingStar.classList.add("shooting-star");
29+
document.body.appendChild(shootingStar);
30+
31+
shootingStar.style.left = Math.random() * 100 + "vw";
32+
shootingStar.style.top = Math.random() * 100 + "vh";
33+
shootingStar.style.animationDuration = Math.random() * 5 + 3 + "s";
34+
35+
setTimeout(() => { shootingStar.remove(); }, 5000);
36+
}
37+
38+
setInterval(createStar, 300);
39+
setInterval(createShootingStar, 4000);
40+
</script>
41+
</body>
42+
</html>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
body {
2+
margin: 0;
3+
height: 100vh;
4+
background: radial-gradient(circle at bottom, #091540, #020c1b);
5+
overflow: hidden;
6+
position: relative;
7+
}
8+
9+
.star {
10+
position: absolute;
11+
background: white;
12+
border-radius: 50%;
13+
opacity: 0.8;
14+
animation: twinkle 2s infinite alternate ease-in-out;
15+
}
16+
17+
@keyframes twinkle {
18+
0% {
19+
opacity: 0.5;
20+
}
21+
22+
100% {
23+
opacity: 1;
24+
}
25+
}
26+
27+
.shooting-star {
28+
position: absolute;
29+
width: 2px;
30+
height: 50px;
31+
background: white;
32+
opacity: 0.8;
33+
transform: rotate(-45deg);
34+
animation: shooting 3s linear infinite;
35+
}
36+
37+
@keyframes shooting {
38+
0% {
39+
top: -10%;
40+
left: 80%;
41+
opacity: 1;
42+
}
43+
44+
100% {
45+
top: 100%;
46+
left: 20%;
47+
opacity: 0;
48+
}
49+
}

assets/json_files/backgrounds.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@
189189
"previewLink": "../../Components/Backgrounds/Shooting-Stars-Background/index.html",
190190
"sourceLink": "https://github.com/Rakesh9100/Beautiify/tree/main/Components/Backgrounds/Shooting-Stars-Background"
191191
},
192+
{
193+
"title": "Shooting Stars Night Background",
194+
"previewLink": "../../Components/Backgrounds/Shooting-Stars-Night-Background/index.html",
195+
"sourceLink": "https://github.com/Rakesh9100/Beautiify/tree/main/Components/Backgrounds/Shooting-Stars-Night-Background"
196+
},
192197
{
193198
"title": "Smoke Background",
194199
"previewLink": "../../Components/Backgrounds/Smoke-Background/index.html",

0 commit comments

Comments
 (0)