Back to the library

Still life — blink

Variant: Blink

A blink is 276ms and lopsided: 72ms to shut, 36ms held, 168ms to open. Lids drop fast and lift slowly — a blink that opens as fast as it closes reads as a flicker in the drawing rather than a lid. The eyes flatten about their own centre line so top and bottom meet in the middle, and a lid stroke in the darker clay steps on for the hundred milliseconds they are nearly shut, because a squashed white on its own reads as a squint. Spacing matters more than the blink: one at 0.9s, a quick double at 3.6s, then 4.5s of open eyes before the loop comes round — gaps of 2.7s, 0.4s and 5.4s, since even gaps read as a metronome and uneven ones read as someone. Use it on mascots and avatars that sit on screen for a long time; it is the smallest motion that still says the figure is awake. Under reduced motion each blink keeps its full speed and only the gaps double, on keyframes of their own — stretching the original would turn every blink drowsy.

ambientidlecharactersvgloop

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>Still life — blink</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;
        --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 — three blinks spread unevenly through 8.5s: one at 0.9s, then a
           double at 3.6s and 4.02s. The gaps run 2.7s, 0.4s and 5.4s back round
           to the start; even gaps read as a metronome, uneven ones as someone. */
        --cycle: 8.5s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 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);
      }

      figure {
        display: grid;
        justify-items: center;
        gap: clamp(6px, 2vh, 12px);
      }

      /* Sized off the frame's height as well as its width: the card is short and
         the caption has to fit under the figure at every stage. */
      svg {
        display: block;
        width: min(260px, 84vw, calc((100vh - 76px) * 1.4));
        height: auto;
        overflow: visible;
      }

      .perch {
        fill: none;
        stroke: color-mix(in oklch, var(--oat), var(--slate) 26%);
        stroke-width: 4;
        stroke-linecap: round;
      }

      .twig {
        stroke-width: 2.6;
      }

      .tail,
      .beak,
      .wing {
        fill: var(--clay-d);
      }

      .body {
        fill: var(--clay);
      }

      .belly {
        fill: color-mix(in oklch, var(--clay) 34%, var(--ivory));
      }

      .foot,
      .lid {
        fill: none;
        stroke: var(--clay-d);
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .lid {
        stroke-width: 2.4;
        opacity: 0;
      }

      .white {
        fill: var(--paper);
      }

      .pupil {
        fill: var(--slate);
      }

      /* Every pivot is a point on the drawing rather than a box's centre: the
         body grows and leans from its feet, the face counter-turns about them
         too, the tail swings from where it meets the body, and the eyes close
         about their own centre line. */
      .fig,
      .ride,
      .breath,
      .head {
        transform-origin: 100px 125px;
      }

      .belly {
        transform-origin: 100px 121px;
      }

      .tail {
        transform-origin: 100px 118px;
      }

      .eyes {
        transform-origin: 100px 80px;
      }

      figcaption {
        display: grid;
        justify-items: center;
        gap: 2px;
        text-align: center;
      }

      .cue {
        font-size: clamp(13px, 3.8vw, 15px);
        font-weight: 600;
        letter-spacing: -0.01em;
      }

      .spec {
        font-size: clamp(11.5px, 3.2vw, 12.5px);
        font-variant-numeric: tabular-nums;
        color: color-mix(in oklch, var(--slate) 58%, var(--ivory));
      }

      /* A blink is 276ms: 72 shut, 36 held, 168 open. The asymmetry carries it.
         Lids drop fast and lift slowly, and a blink that opens as fast as it
         closes reads as a flicker in the drawing rather than a lid. The eyes
         flatten about their own centre line, so top and bottom meet in the
         middle. */
      .eyes {
        animation: blink var(--t) infinite;
      }

      /* A squashed white is a squint, not a shut eye. A lid line in the darker
         clay switches on for the ~100ms the eye is nearly closed and off again
         as it opens — stepped, because a lid is either there or it is not. */
      .lid {
        animation: lid var(--t) infinite;
      }

      @keyframes blink {
        0% {
          scale: 1 1;
        }
        10.588% {
          scale: 1 1;
          animation-timing-function: linear;
        }
        11.435% {
          scale: 1 0.04;
        }
        11.859% {
          scale: 1 0.04;
          animation-timing-function: var(--ease-out);
        }
        13.835% {
          scale: 1 1;
        }
        42.353% {
          scale: 1 1;
          animation-timing-function: linear;
        }
        43.2% {
          scale: 1 0.04;
        }
        43.624% {
          scale: 1 0.04;
          animation-timing-function: var(--ease-out);
        }
        45.6% {
          scale: 1 1;
        }
        47.294% {
          scale: 1 1;
          animation-timing-function: linear;
        }
        48.141% {
          scale: 1 0.04;
        }
        48.565% {
          scale: 1 0.04;
          animation-timing-function: var(--ease-out);
        }
        50.541% {
          scale: 1 1;
        }
        100% {
          scale: 1 1;
        }
      }

      @keyframes lid {
        0% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        11.153% {
          opacity: 1;
          animation-timing-function: steps(1, end);
        }
        12.353% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        42.918% {
          opacity: 1;
          animation-timing-function: steps(1, end);
        }
        44.118% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        47.859% {
          opacity: 1;
          animation-timing-function: steps(1, end);
        }
        49.059% {
          opacity: 0;
          animation-timing-function: steps(1, end);
        }
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* A blink covers no ground, so it stays at full speed; only the gaps
           between blinks double, on keyframes of their own. Stretching the
           original instead would slow each blink into a drowsy one. */
        .eyes {
          animation: blink-still calc(var(--t) * 2) infinite;
        }

        .lid {
          animation: lid-still calc(var(--t) * 2) infinite;
        }

        @keyframes blink-still {
          0% {
            scale: 1 1;
          }
          10.588% {
            scale: 1 1;
            animation-timing-function: linear;
          }
          11.012% {
            scale: 1 0.04;
          }
          11.224% {
            scale: 1 0.04;
            animation-timing-function: var(--ease-out);
          }
          12.212% {
            scale: 1 1;
          }
          42.353% {
            scale: 1 1;
            animation-timing-function: linear;
          }
          42.776% {
            scale: 1 0.04;
          }
          42.988% {
            scale: 1 0.04;
            animation-timing-function: var(--ease-out);
          }
          43.976% {
            scale: 1 1;
          }
          44.824% {
            scale: 1 1;
            animation-timing-function: linear;
          }
          45.247% {
            scale: 1 0.04;
          }
          45.459% {
            scale: 1 0.04;
            animation-timing-function: var(--ease-out);
          }
          46.447% {
            scale: 1 1;
          }
          100% {
            scale: 1 1;
          }
        }

        @keyframes lid-still {
          0% {
            opacity: 0;
            animation-timing-function: steps(1, end);
          }
          10.871% {
            opacity: 1;
            animation-timing-function: steps(1, end);
          }
          11.471% {
            opacity: 0;
            animation-timing-function: steps(1, end);
          }
          42.635% {
            opacity: 1;
            animation-timing-function: steps(1, end);
          }
          43.235% {
            opacity: 0;
            animation-timing-function: steps(1, end);
          }
          45.106% {
            opacity: 1;
            animation-timing-function: steps(1, end);
          }
          45.706% {
            opacity: 0;
            animation-timing-function: steps(1, end);
          }
          100% {
            opacity: 0;
          }
        }
      }
    </style>
  </head>
  <body>
    <figure
      role="img"
      aria-label="A small round bird on a perch that blinks at uneven intervals, including one quick double blink"
    >
      <svg viewBox="30 46 140 104" aria-hidden="true">
        <g class="ride"><path class="tail" d="M94 116 L90 140 L100 135.5 L110 140 L106 116 Z" /></g>
        <path class="perch" d="M36 126 Q100 130 164 126" />
        <path class="perch twig" d="M146 127 L154 119.5" />
        <g class="fig">
          <path
            class="foot"
            d="M94 121 V126.5 M106 121 V126.5 M90.5 128 Q93 124.5 96.5 127 M102.5 128 Q105 124.5 108.5 127"
          />
          <g class="breath">
            <ellipse class="body" cx="100" cy="91.5" rx="30" ry="33.5" />
            <ellipse class="belly" cx="100" cy="110" rx="17" ry="11" />
            <path
              class="wing"
              d="M72.5 88 Q67 106 85 121 Q76 104 72.5 88 Z M127.5 88 Q133 106 115 121 Q124 104 127.5 88 Z"
            />
            <g class="head">
              <path class="beak" d="M96 89 H104 L100 95.5 Z" />
              <g class="eyes">
                <circle class="white" cx="89" cy="80" r="8.5" />
                <circle class="white" cx="111" cy="80" r="8.5" />
                <g class="pupils">
                  <circle class="pupil" cx="89" cy="80" r="3.4" />
                  <circle class="pupil" cx="111" cy="80" r="3.4" />
                </g>
              </g>
              <path class="lid" d="M80.5 80 Q89 81 97.5 80 M102.5 80 Q111 81 119.5 80" />
            </g>
          </g>
        </g>
      </svg>
      <figcaption>
        <span class="cue">Blink</span>
        <span class="spec">shut 72ms · hold 36ms · open 168ms</span>
      </figcaption>
    </figure>
  </body>
</html>

The variant family

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