Back to the library

Night sky — the rare meteor

Variant: Meteor

Designed for the thousandth view. Nothing in the sky moves; three meteor lanes run on clocks of 21s, 34s and 57s, and each spends the same 0.75s of that cycle alive — one meteor every ten seconds or so, at uneven gaps — so most of the time the card is perfectly still and the shower takes many minutes to repeat its pattern. Ambient motion wears out with exposure; the only motion that keeps its charge is motion that is rare, and stillness is what it is spent against. Every lane is aimed back at one radiant above the top-left corner — a shared origin is what makes three streaks a shower instead of three accidents. The tail grows out behind the head as it decelerates and is only at full length as it fades, on a curve that is still moving when the light runs out. The first one arrives 1.4s in, because a gallery card that waits twenty seconds to show its idea has none.

ambientloop

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Night sky — the rare meteor</title>
    <style>
      :root {
        /* Neutrals — fixed, never remixed. */
        --ivory: #faf9f5;
        --paper: #ffffff;
        --oat: #e3dacc;
        --slate: #141413;

        /* Knobs — the remix API. A knob exists iff declared here and used below. */
        --hue: 38.8;
        --lift: 0;
        --chroma: 1;
        --round: 1;
        --speed: 1;

        /* Accents — derived from the knobs with the family's offsets baked in,
           so one hue roll moves them together. Defaults reproduce the original hex. */
        --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
        --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
        --olive: oklch(
          calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
        );
        --rust: oklch(
          calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
        );

        /* Clock — the shortest gap between meteors in one lane. The three
           lanes run at 1, 1.62 and 2.71 of it — one meteor every ten seconds
           or so on average, at uneven gaps — so the shower only repeats
           itself after many minutes, and each meteor is the same 0.75s of
           light however long its lane waits. */
        --cycle: 21s;
        --t: calc(var(--cycle) / var(--speed));

        /* The ground is a band the copy sits on, sized like the copy rather
           than like the panel, so the sky keeps whatever height is left. */
        --_ground: clamp(60px, 19vw, 80px);
        --_dot: 2.4px;
        --_streak: clamp(56px, 20vw, 96px);

        /* Fast off the mark and still moving when it burns out — a meteor is
           decelerating, but the fade ends it before the curve can settle. */
        --ease-accent: cubic-bezier(0.22, 0.6, 0.36, 1);
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: var(--ivory);
        font-family:
          system-ui,
          -apple-system,
          'Segoe UI',
          Roboto,
          sans-serif;
        color: var(--slate);
      }

      /* Lifted off pure slate at the zenith and warmed toward the horizon, so
         the ground — which is pure slate — reads as nearer than the sky. */
      .panel {
        position: relative;
        overflow: hidden;
        width: min(392px, calc(100% - 26px));
        height: clamp(150px, 46vw, 214px);
        border-radius: calc(16px * var(--round));
        background: linear-gradient(
          to bottom,
          color-mix(in oklab, var(--slate) 93%, var(--ivory)) 0%,
          color-mix(in oklab, var(--slate) 84%, var(--clay-d)) 100%
        );
      }

      .sky {
        position: absolute;
        inset: 0 0 var(--_ground) 0;
      }

      .ground {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        display: block;
        width: 100%;
        height: calc(var(--_ground) + 8px);
        fill: var(--slate);
      }

      .copy {
        position: absolute;
        right: clamp(16px, 4.6vw, 24px);
        bottom: clamp(12px, 3.8vw, 20px);
        left: clamp(16px, 4.6vw, 24px);
        color: var(--ivory);
      }

      .head {
        font-size: clamp(15px, 4.4vw, 19px);
        font-weight: 600;
        letter-spacing: -0.01em;
      }

      .sub {
        margin-top: 3px;
        font-size: clamp(11.5px, 3.3vw, 13px);
        color: color-mix(in srgb, var(--ivory) 58%, transparent);
      }

      /* Nothing in the sky moves. The stillness is what the meteor is spent
         against: an ambient piece seen every day for years wears out its
         motion, and the only motion that does not wear out is the motion that
         is rare. */
      .sky > i {
        position: absolute;
        top: var(--_y);
        left: var(--_x);
        width: calc(var(--_dot) * var(--_s));
        height: calc(var(--_dot) * var(--_s));
        border-radius: 50%;
        translate: -50% -50%;
        background: var(--ivory);
        opacity: var(--_b);
      }

      /* Each lane is a point on the panel turned to face away from one radiant
         above the top-left corner. Shared origin is what makes three streaks a
         shower instead of three accidents. */
      .lane {
        position: absolute;
        top: var(--_y);
        left: var(--_x);
        width: 0;
        height: 0;
        rotate: var(--_a);
      }

      /* The head is the right end and the tail grows out behind it, so the
         streak lengthens as it decelerates and is at full length only as it
         fades. */
      .lane > i {
        position: absolute;
        top: -0.75px;
        right: 0;
        width: var(--_streak);
        height: 1.5px;
        border-radius: 999px;
        background: linear-gradient(
          to right,
          transparent,
          color-mix(in srgb, var(--ivory) 55%, transparent) 72%,
          var(--ivory)
        );
        transform-origin: right center;
        opacity: 0;
        animation: var(--_k) calc(var(--t) * var(--_f)) linear infinite;
        animation-delay: calc(var(--t) * var(--_f) * var(--_lag) * -1);
      }

      @keyframes streak-a {
        0% {
          opacity: 0;
          transform: translateX(0) scaleX(0.3);
          animation-timing-function: var(--ease-accent);
        }
        1% {
          opacity: 1;
        }
        3.57%,
        100% {
          opacity: 0;
          transform: translateX(150%) scaleX(1);
        }
      }

      @keyframes streak-b {
        0% {
          opacity: 0;
          transform: translateX(0) scaleX(0.3);
          animation-timing-function: var(--ease-accent);
        }
        0.62% {
          opacity: 1;
        }
        2.2%,
        100% {
          opacity: 0;
          transform: translateX(150%) scaleX(1);
        }
      }

      @keyframes streak-c {
        0% {
          opacity: 0;
          transform: translateX(0) scaleX(0.3);
          animation-timing-function: var(--ease-accent);
        }
        0.37% {
          opacity: 1;
        }
        1.32%,
        100% {
          opacity: 0;
          transform: translateX(150%) scaleX(1);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The streak no longer travels — !important is how a declaration
           outranks a running animation, so the keyframes keep their opacity
           and lose their transform — and its lane clock slows by half again,
           so the meteor is a soft, longer glint in place at the same rare
           cadence. */
        .lane > i {
          transform: translateX(70%) scaleX(0.85) !important;
          animation-duration: calc(var(--t) * var(--_f) * 1.5);
          animation-delay: calc(var(--t) * var(--_f) * 1.5 * var(--_lag) * -1);
        }
      }
    </style>
  </head>
  <body>
    <div class="panel">
      <div class="sky" aria-hidden="true">
        <i style="--_x: 14.9%; --_y: 20.7%; --_s: 1.31; --_b: 0.77"></i>
        <i style="--_x: 40.4%; --_y: 68.4%; --_s: 1.17; --_b: 0.72"></i>
        <i style="--_x: 90.4%; --_y: 64.2%; --_s: 1.21; --_b: 0.73"></i>
        <i style="--_x: 82.2%; --_y: 24.5%; --_s: 0.99; --_b: 0.65"></i>
        <i style="--_x: 37.4%; --_y: 23.7%; --_s: 0.68; --_b: 0.52"></i>
        <i style="--_x: 32.7%; --_y: 87%; --_s: 1.18; --_b: 0.72"></i>
        <i style="--_x: 62.1%; --_y: 25.1%; --_s: 1.26; --_b: 0.75"></i>
        <i style="--_x: 91.1%; --_y: 25.6%; --_s: 0.81; --_b: 0.58"></i>
        <i style="--_x: 94.1%; --_y: 87.3%; --_s: 0.79; --_b: 0.57"></i>
        <i style="--_x: 10.2%; --_y: 69.2%; --_s: 0.67; --_b: 0.52"></i>
        <i style="--_x: 42.7%; --_y: 37.1%; --_s: 1.3; --_b: 0.77"></i>
        <i style="--_x: 18.8%; --_y: 44%; --_s: 0.56; --_b: 0.47"></i>
        <i style="--_x: 53.1%; --_y: 18.8%; --_s: 0.96; --_b: 0.63"></i>
        <i style="--_x: 58.8%; --_y: 91%; --_s: 0.68; --_b: 0.52"></i>
        <i style="--_x: 8.5%; --_y: 30.9%; --_s: 0.59; --_b: 0.49"></i>
        <i style="--_x: 23.1%; --_y: 18.2%; --_s: 1.07; --_b: 0.68"></i>
        <i style="--_x: 41.7%; --_y: 9.8%; --_s: 1.08; --_b: 0.68"></i>
        <i style="--_x: 85.5%; --_y: 45.3%; --_s: 1.31; --_b: 0.77"></i>
        <i style="--_x: 83.2%; --_y: 73.3%; --_s: 0.86; --_b: 0.6"></i>
        <i style="--_x: 63.4%; --_y: 71.5%; --_s: 0.78; --_b: 0.56"></i>
        <i style="--_x: 57.9%; --_y: 47.7%; --_s: 1.13; --_b: 0.7"></i>
        <i style="--_x: 68.5%; --_y: 83.4%; --_s: 1.11; --_b: 0.69"></i>
      </div>
      <div aria-hidden="true">
        <span
          class="lane"
          style="--_x: 34%; --_y: 8%; --_a: 37deg; --_f: 1; --_lag: 0.93; --_k: streak-a"
          ><i></i
        ></span>
        <span
          class="lane"
          style="--_x: 62%; --_y: 4%; --_a: 22.8deg; --_f: 1.62; --_lag: 0.72; --_k: streak-b"
          ><i></i
        ></span>
        <span
          class="lane"
          style="--_x: 20%; --_y: 6%; --_a: 47.5deg; --_f: 2.71; --_lag: 0.58; --_k: streak-c"
          ><i></i
        ></span>
      </div>
      <svg class="ground" viewBox="0 0 400 88" preserveAspectRatio="none" aria-hidden="true">
        <path d="M0 14 C 46 6, 92 4, 140 10 S 228 20, 276 12 S 360 2, 400 9 V 88 H 0 Z" />
      </svg>
      <div class="copy">
        <p class="head">Keep watching</p>
        <p class="sub">Ambient sky. Nothing here reports state.</p>
      </div>
    </div>
  </body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.