Skip to content

Sunrise Sunset Sweep

A copy-paste weather & ambient component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Weather & AmbientHTMLCSSany framework

Copy into your project

HTML
<!-- Sunrise Sunset Sweep (background-position drives the sky's color shift) -->
<div class="nuda-wa2-sunset-sweep" role="img" aria-label="Sky sweeping through sunrise and sunset colors">
  <span class="nuda-wa2-sunset-sweep__sun"></span>
  <span class="nuda-wa2-sunset-sweep__horizon"></span>
</div>
CSS
.nuda-wa2-sunset-sweep {
  position: relative;
  width: 100%;
  max-width: 220px;
  height: 130px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg,#1a1030,#3a1d4a 25%,#a83e3e 50%,#e4823f 70%,#f4c95d 85%,#1a1030 100%);
  background-size: 100% 300%;
  will-change: background-position;
  animation: _nuda-wa2sunsetSweepSky 16s ease-in-out infinite alternate;
}

.nuda-wa2-sunset-sweep__horizon {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  background: #09090b;
}

.nuda-wa2-sunset-sweep__sun {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle,#fff8dc,#e4ff54 60%,rgba(228,255,84,.2) 78%,transparent 82%);
  will-change: transform;
  animation: _nuda-wa2sunsetSweepSun 16s ease-in-out infinite alternate;
}

@keyframes _nuda-wa2sunsetSweepSky {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 100%;
  }
}

@keyframes _nuda-wa2sunsetSweepSun {
  0% {
    transform: translate(-50%,40px);
  }
  100% {
    transform: translate(-50%,-30px);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-wa2-sunset-sweep {
    animation: none;
    background-position: 0 40%;
  }
  .nuda-wa2-sunset-sweep__sun {
    animation: none;
    transform: translate(-50%,0);
  }
}

How to use Sunrise Sunset Sweep

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More weather & ambient components

← Browse all NudaUI components