HTML
<div class="pixels">
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
<div class="px"></div>
</div>
CSS
.pixels {
display: grid;
grid-template-columns: repeat(4, 12px);
gap: 4px;
}
.px {
width: 12px;
height: 12px;
border-radius: 2px;
background: #7c6cff;
animation: px 1.4s ease-in-out infinite;
}
.px:nth-child(1) {
animation-delay: 0s;
}
.px:nth-child(2) {
animation-delay: 0.1s;
}
.px:nth-child(3) {
animation-delay: 0.2s;
}
.px:nth-child(4) {
animation-delay: 0.3s;
}
.px:nth-child(5) {
animation-delay: 0.4s;
}
.px:nth-child(6) {
animation-delay: 0.5s;
}
.px:nth-child(7) {
animation-delay: 0.6s;
}
.px:nth-child(8) {
animation-delay: 0.7s;
}
.px:nth-child(9) {
animation-delay: 0.8s;
}
.px:nth-child(10) {
animation-delay: 0.9s;
}
.px:nth-child(11) {
animation-delay: 1s;
}
.px:nth-child(12) {
animation-delay: 1.1s;
}
.px:nth-child(13) {
animation-delay: 1.2s;
}
.px:nth-child(14) {
animation-delay: 1.3s;
}
.px:nth-child(15) {
animation-delay: 0.65s;
}
.px:nth-child(16) {
animation-delay: 0.85s;
}
@keyframes px {
0%,
100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0;
transform: scale(0.3);
}
}
@media (prefers-reduced-motion: reduce) {
.pixels,
.pixels * {
animation: none !important;
}
}