.night
.window
- for (i = 0; i < 2; i++)
.stars
- for (j = 0; j < 30; j++)
.shooting
- for (j = 0; j < 250; j++)
.star
View Compiled
$moonColor: #ffe645;
$moonSize: 300px;
body {
background: $moonColor;
height: 100vh;
overflow: hidden;
display: flex;
font-family: 'Anton', sans-serif;
justify-content: center;
align-items: center;
}
.night {
position: relative;
width: $moonSize;
height: $moonSize;
&::after {
content: '';
position: absolute;
left: 35%;
width: 100%;
height: 100%;
background: $moonColor;
border-radius: 100%;
transform: scale(1.1);
}
&::before {
content: '';
position: absolute;
bottom: -3%;
left: -10%;
width: 70%;
height: 6%;
background: #edcd2b;
border-radius: 100%;
}
}
.window {
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient(-45deg, #0a1433 0%,#222b3f 100%);
border-radius: 100%;
overflow: hidden;
}
.star {
position: absolute;
width: 1px;
height: 1px;
@for $i from 1 through 250 {
$light: random(255);
&:nth-child(#{$i}) {
top: random(100) + 0%;
left: random(100) + 0%;
background: rgb($light, $light, $light);
}
}
}
.stars {
position: absolute;
width: 100%;
height: 100%;
animation: slide 30000ms linear infinite;
&:nth-child(2) {
left: 100%;
}
}
.shooting {
position: absolute;
width: 50px;
height: 1px;
background: linear-gradient(90deg, rgba(#fff, 1), rgba(#fff, 0));
background: linear-gradient(90deg, rgba(#0093E9, 1) 0%, rgba(#80D0C7, 0) 100%);
opacity: 0;
animation: shooting 5000ms linear infinite;
@for $i from 1 through 50 {
&:nth-child(#{$i}) {
top: random(100) + 0%;
left: random(100) + 0%;
animation-delay: random(9999) * 1ms;
}
}
}
@keyframes shooting {
0% {
opacity: 0;
transform: rotateZ(-30deg) translateX(0) scaleX(0);
}
25% {
opacity: 1;
transform: rotateZ(-30deg) transalteX(-200%) scaleX(1);
}
50% {
opacity: 0;
transform: rotateZ(-30deg) translateX(-400%) scaleX(2);
}
100% {
opacity: 0;
transform: rotateZ(-30deg) translateX(-400%) scaleX(2);
}
}
@keyframes slide {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-100%);
}
}
View Compiled
This Pen doesn't use any external JavaScript resources.