AI CSS Animations

Synthwave Sun Loader

The striped 80s sunset: a gradient sun whose lower half is cut into bands that keep sliding down. Two mask layers do it, a solid top half plus repeating stripes with an animated position.

Also known as: retro sunset animation, outrun sun css, vaporwave loader.

HTML

<div class="ldr-synthwave-sun" role="status" aria-label="Loading"><span></span></div>

CSS

.ldr-synthwave-sun {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  width: var(--s);
  height: var(--s);
  filter: drop-shadow(0 0 calc(var(--s) / 8) color-mix(in srgb, var(--ldr-color, #3b82f6) 55%, transparent));
}
.ldr-synthwave-sun span {
  --band: calc(var(--s) / 8);
  --stripes: repeating-linear-gradient(#000 0 calc(var(--band) * 0.62), transparent calc(var(--band) * 0.62) var(--band));
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(oklch(from var(--c) calc(l + 0.2) c calc(h + 190)), oklch(from var(--c) l c calc(h + 80)) 50%, var(--c));
  -webkit-mask: linear-gradient(#000 0 0) 0 0 / 100% 48% no-repeat, var(--stripes) 0 0 / 100% var(--band);
  mask: linear-gradient(#000 0 0) 0 0 / 100% 48% no-repeat, var(--stripes) 0 0 / 100% var(--band);
  animation: ldr-synthwave-sun-sink 0.9s linear infinite;
}
@keyframes ldr-synthwave-sun-sink {
  from { -webkit-mask-position: 0 0, 0 0; mask-position: 0 0, 0 0; }
  to   { -webkit-mask-position: 0 0, 0 var(--band); mask-position: 0 0, 0 var(--band); }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-synthwave-sun, .ldr-synthwave-sun *, .ldr-synthwave-sun::before, .ldr-synthwave-sun::after, .ldr-synthwave-sun *::before, .ldr-synthwave-sun *::after {
    animation-duration: 3s;
  }
}

Customizing this loader

  • Color: set --ldr-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --ldr-size. Every dimension in the snippet is derived from it. Currently previewing 64px.
  • Speed: change the duration on the animation shorthand. Delays on the children are relative, so they keep their rhythm.
  • Accessibility: the root carries role="status" and an aria-label so screen readers announce the wait. The reduced-motion rule at the end slows the animation for users who asked for less motion.

Similar loaders