Back to the library

Overflow — pan to read

Variant: Pan to read

A truncated name that shows its ending when the pointer rests on it. The row tints on arrival, then nothing happens for 500ms: a hover-intent delay, so a pointer sweeping down the list never sets rows sliding. Then the ellipsis fades out of its slot before the clip opens it, so the two never share a cell, and the name pans left at a constant reading pace — linear on purpose, since an eased pan rushes the middle of the name, which is the part being read. A short fade in the row’s own tint arrives on the left edge, because an ending with its start cut off would otherwise read as a whole, oddly named branch. It holds 900ms on the ending and rewinds in 320ms on an ease-out, because going back is navigation, not reading. The slot is a clip-path, not a background patch, so the tinted row never has to be matched. Use it in sidebars, branch pickers and playlists where a tooltip would cover the neighbours; on touch, pan on focus or long-press instead.

textoverflowtruncategestureloop

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>Overflow — pan to read</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)
        );

        --_muted: color-mix(in srgb, var(--slate) 50%, transparent);
        --_hover: color-mix(in srgb, var(--oat) 38%, var(--paper));

        /* Clock — 6.4s: 1% is 64ms. Pointer settles at 13%, the pan waits out
           a 500ms intent delay, reads for 1.4s, dwells 900ms on the ending,
           and rewinds in 320ms. */
        --cycle: 6.4s;
        --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);
      }

      .card {
        width: min(280px, calc(100vw - 32px));
        padding: 14px 10px 10px;
        display: grid;
        gap: 6px;
        border-radius: calc(12px * var(--round));
        background: var(--paper);
        border: 1px solid var(--oat);
      }

      .k {
        padding: 0 6px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--_muted);
      }

      ul {
        list-style: none;
        display: grid;
        gap: 2px;
      }

      li {
        position: relative;
        display: flex;
        align-items: center;
        gap: 8px;
        height: 32px;
        padding: 0 6px;
        border-radius: calc(7px * var(--round));
      }

      li svg.br {
        flex: none;
        width: 14px;
        height: 14px;
        fill: none;
        stroke: var(--_muted);
        stroke-width: 1.6;
        stroke-linecap: round;
      }

      /* 22ch of window: 21 glyphs and an ellipsis at rest. */
      .win {
        position: relative;
        width: 22ch;
        overflow: hidden;
        font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
        font-size: clamp(11.5px, 3.6vw, 12.5px);
        white-space: nowrap;
      }

      .live {
        animation: hover var(--t) linear infinite;
      }

      @keyframes hover {
        0%,
        12% {
          background: transparent;
          animation-timing-function: ease;
        }
        14.5%,
        70% {
          background: var(--_hover);
          animation-timing-function: ease;
        }
        73%,
        100% {
          background: transparent;
        }
      }

      /* The clip hides the 22nd glyph so the ellipsis has a slot of its own;
         no background is needed to cover anything. */
      .clip {
        display: block;
      }

      .live .clip {
        animation: clip var(--t) linear infinite;
      }

      @keyframes clip {
        0%,
        22% {
          clip-path: inset(0 1ch 0 0);
        }
        22.01%,
        62.5% {
          clip-path: inset(0 0 0 0);
        }
        62.51%,
        100% {
          clip-path: inset(0 1ch 0 0);
        }
      }

      /* Reading pace is constant, so the pan itself is linear — an eased pan
         rushes the middle of the name, which is the part being read. The
         rewind is navigation, not reading: short and ease-out. */
      .text {
        display: block;
      }

      .live .text {
        animation: pan var(--t) linear infinite;
      }

      @keyframes pan {
        0%,
        22.5% {
          transform: translateX(0);
          animation-timing-function: linear;
        }
        44%,
        58% {
          transform: translateX(-13ch);
          animation-timing-function: var(--ease-out);
        }
        63%,
        100% {
          transform: translateX(0);
        }
      }

      .end {
        position: absolute;
        top: 0;
        right: 0;
        width: 1ch;
        color: var(--_muted);
        animation: end var(--t) linear infinite;
      }

      /* Gone before the clip opens its slot, so "…" and the glyph it stood
         in for never share a cell. */
      @keyframes end {
        0%,
        20% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        22%,
        62% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        64%,
        100% {
          opacity: 1;
        }
      }

      /* Mid-pan the name has lost its start; a short fade in the row's own
         tint says so, so the ending never reads as a whole name. */
      .lead {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 3ch;
        background: linear-gradient(90deg, var(--_hover) 15%, transparent);
        opacity: 0;
        animation: lead var(--t) linear infinite;
      }

      @keyframes lead {
        0%,
        22.5% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        25%,
        58% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        60%,
        100% {
          opacity: 0;
        }
      }

      .ptr {
        position: absolute;
        top: 16px;
        left: 50%;
        width: 15px;
        height: 18px;
        fill: var(--slate);
        stroke: var(--paper);
        stroke-width: 1.2;
        stroke-linejoin: round;
        opacity: 0;
        animation: ptr var(--t) linear infinite;
      }

      @keyframes ptr {
        0%,
        8% {
          opacity: 0;
          transform: translate(18px, 22px);
          animation-timing-function: var(--ease-out);
        }
        13%,
        70% {
          opacity: 1;
          transform: translate(0, 0);
          animation-timing-function: var(--ease-out);
        }
        74%,
        100% {
          opacity: 0;
          transform: translate(14px, 26px);
        }
      }

      .muted {
        color: var(--_muted);
      }

      @media (prefers-reduced-motion: reduce) {
        .card *,
        .card *::before,
        .card *::after {
          animation-duration: calc(var(--t) * 1.6);
        }

        /* No pan: the start of the name crossfades to its ending and back. */
        .live .text {
          animation-name: rm-pan;
        }
        .ptr {
          animation-name: rm-ptr;
        }

        @keyframes rm-pan {
          0%,
          21% {
            opacity: 1;
            transform: translateX(0);
          }
          23% {
            opacity: 0;
            transform: translateX(0);
          }
          23.01% {
            opacity: 0;
            transform: translateX(-13ch);
          }
          27%,
          58% {
            opacity: 1;
            transform: translateX(-13ch);
          }
          60% {
            opacity: 0;
            transform: translateX(-13ch);
          }
          60.01% {
            opacity: 0;
            transform: translateX(0);
          }
          64%,
          100% {
            opacity: 1;
            transform: translateX(0);
          }
        }
        @keyframes rm-ptr {
          0%,
          8% {
            opacity: 0;
          }
          13%,
          70% {
            opacity: 1;
          }
          74%,
          100% {
            opacity: 0;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="A branch list where one long branch name is cut off with an ellipsis; a pointer rests on it, and after a short pause the name pans left at reading speed to show its ending, holds, then snaps back"
    >
      <span class="k">Branches</span>
      <ul>
        <li>
          <svg class="br" viewBox="0 0 16 16" aria-hidden="true">
            <circle cx="4.5" cy="3.5" r="1.6" />
            <circle cx="4.5" cy="12.5" r="1.6" />
            <circle cx="11.5" cy="5.5" r="1.6" />
            <path d="M4.5 5.1v5.8 M11.5 7.1c0 2.6-4.5 2.4-6.6 4" />
          </svg>
          <span class="win"
            ><span class="clip"><span class="text">main</span></span></span
          >
        </li>
        <li class="live">
          <svg class="br" viewBox="0 0 16 16" aria-hidden="true">
            <circle cx="4.5" cy="3.5" r="1.6" />
            <circle cx="4.5" cy="12.5" r="1.6" />
            <circle cx="11.5" cy="5.5" r="1.6" />
            <path d="M4.5 5.1v5.8 M11.5 7.1c0 2.6-4.5 2.4-6.6 4" />
          </svg>
          <span class="win"
            ><span class="clip"
              ><span class="text"
                ><span class="muted">feature/</span>billing-retry-jitter-on-429</span
              ></span
            ><span class="end">…</span><span class="lead"></span
          ></span>
          <svg class="ptr" viewBox="0 0 15 18" aria-hidden="true">
            <path d="M1.5 1.2v13.6l3.6-3.3 2.4 5.3 2.3-1-2.4-5.2h4.9z" />
          </svg>
        </li>
        <li>
          <svg class="br" viewBox="0 0 16 16" aria-hidden="true">
            <circle cx="4.5" cy="3.5" r="1.6" />
            <circle cx="4.5" cy="12.5" r="1.6" />
            <circle cx="11.5" cy="5.5" r="1.6" />
            <path d="M4.5 5.1v5.8 M11.5 7.1c0 2.6-4.5 2.4-6.6 4" />
          </svg>
          <span class="win"
            ><span class="clip"><span class="text">fix/flaky-auth-test</span></span></span
          >
        </li>
      </ul>
    </div>
  </body>
</html>

The variant family

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