<div class="stars">
<div class="cluster__1"></div>
<div class="cluster__2"></div>
<div class="cluster__3"></div>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #191919;
color: rgb(255, 255, 255);
width: 100vw;
height: 100vh;
display: grid;
justify-content: center;
align-items: center;
overflow-y: hidden;
overflow-x: hidden;
}
@function create-stars() {
$result: '';
@for $i from 1 through 100 {
$result: $result + (random(200) - 100) + 'vw ' + (random(200) - 100) + 'vh ' + '0.75px 0.75px ' + rgb(255, 255, 255) ;
@if $i < 100 { $result: $result + ','; }
}
@return unquote($result);
}
@mixin place-stars {
position: absolute;
left: 50%;
top: 50%;
width: 3px;
height: 3px;
border-radius: 100%;
box-shadow: create-stars();
filter: drop-shadow(0 0 10px white);
}
.stars {
position: fixed;
width: 100%;
height: 100%;
.cluster__1 {
@include place-stars;
animation: star-movement 9s cubic-bezier(0.75, 0, 1, 0.45) infinite;
}
.cluster__2 {
@include place-stars;
animation: star-movement 9s - 3s cubic-bezier(0.75, 0, 1, 0.45) infinite;
}
.cluster__3 {
@include place-stars;
animation: star-movement 9s - 5s cubic-bezier(0.75, 0, 1, 0.45) infinite;
}
}
@keyframes star-movement {
0% {
transform: scale(0.5);
opacity: 0;
}
20% { opacity: 1; }
100% {
transform: scale(2);
opacity: 0;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.