Back to the library

Glyph — download

Variant: Download

A line icon whose stroke order is the verb. The shaft draws top to bottom on an ease-in-out and the head grows outward from its tip, so the arrow is seen arriving rather than simply present. Then the catch: arrow and tray dip together for 104ms, the tray half as far because it is taking the weight rather than delivering it, and recover over 364ms on an ease-out. The arrow's 1.5-unit dip is one whole pixel in the 16px button, the least that still reads as landing there rather than as a soft edge. It sinks into the tray and fades, and the loop ends on an empty tray. The icon appears twice, at hero size and inside a 16px button, because a draw-on that only reads at 100px is not an icon animation; the small copy takes a 2-unit stroke so it survives the pixel grid. Use it on download and export buttons, played once per press — the loop is only the demo.

svgline-drawingiconcontrolloop

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>Glyph — download</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 — 2.6s: draw 780ms, land 468ms, hold 780ms, sink 208ms, empty tray. */
        --cycle: 2.6s;
        --t: calc(var(--cycle) / var(--speed));

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

      .demo {
        display: grid;
        justify-items: center;
        gap: clamp(14px, 5vmin, 28px);
      }

      .glyph {
        display: block;
        fill: none;
        stroke: currentColor;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      /* Two instances of the same file. The hero shows what the strokes do;
         the button shows whether it still reads at the size it will ship at.
         The 16px copy takes a 2-unit stroke so it survives the pixel grid —
         at the hero's 1.5 it would render under a pixel wide. */
      .hero {
        width: clamp(72px, 30vmin, 128px);
        height: auto;
        stroke-width: 1.5;
      }

      .button {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 16px 8px 13px;
        border: 1px solid var(--oat);
        border-radius: 999px;
        background: var(--paper);
        color: inherit;
        font: inherit;
        font-size: 13px;
        font-weight: 500;
        line-height: 1;
        cursor: pointer;
      }

      .button .glyph {
        width: 16px;
        height: 16px;
        stroke-width: 2;
      }

      /* pathLength 100 and a 200 gap: an offset of 100 is a dash parked
         wholly before the start, so the round cap never leaves a dot there. */
      .shaft,
      .arm {
        stroke-dasharray: 100 200;
        stroke-dashoffset: 100;
      }

      /* Each curve sits on the element, not inside the keyframes: Chromium
         drops a var() in a keyframe's animation-timing-function and falls
         back to plain ease. One curve per animation is enough, because the
         stretches between keyframes that do not move do not care. */

      /* The shaft is drawn top to bottom and the head from its tip outward:
         stroke order is the direction, so the arrow is seen arriving. */
      .shaft {
        animation: shaft var(--t) var(--ease-in-out) infinite;
      }

      .arm {
        animation: arm var(--t) var(--ease-out) infinite;
      }

      .arrow {
        animation: arrow var(--t) var(--ease-out) infinite;
      }

      .tray {
        animation: tray var(--t) var(--ease-out) infinite;
      }

      @keyframes shaft {
        0%,
        4% {
          stroke-dashoffset: 100;
        }
        26%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      @keyframes arm {
        0%,
        24% {
          stroke-dashoffset: 100;
        }
        34%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      /* The catch. Arrow and tray dip together for 104ms — the tray half as
         far, since it is taking the weight rather than delivering it — then
         recover over 364ms. 1.5 units is one whole pixel in the 16px button,
         the least that still reads as a dip there rather than a soft edge.
         Then the arrow sinks into the tray and the loop ends on an empty one. */
      @keyframes arrow {
        0%,
        34% {
          opacity: 1;
          transform: translateY(0);
        }
        38% {
          transform: translateY(1.5px);
        }
        52%,
        82% {
          opacity: 1;
          transform: translateY(0);
        }
        90%,
        100% {
          opacity: 0;
          transform: translateY(3px);
        }
      }

      @keyframes tray {
        0%,
        34% {
          transform: translateY(0);
        }
        38% {
          transform: translateY(0.75px);
        }
        52%,
        100% {
          transform: translateY(0);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* Drop the dip and the sink — they are movement. The draw is not, and
           its order still carries the direction, so it stays at half pace. */
        .tray {
          animation: none;
        }

        .shaft,
        .arm {
          animation-duration: calc(var(--t) * 2);
        }

        .arrow {
          animation: arrow-fade calc(var(--t) * 2) var(--ease-out) infinite;
        }

        @keyframes arrow-fade {
          0%,
          82% {
            opacity: 1;
          }
          92%,
          100% {
            opacity: 0;
          }
        }
      }
    </style>
  </head>
  <body>
    <div class="demo">
      <svg
        class="glyph hero"
        viewBox="0 0 24 24"
        role="img"
        aria-label="A download icon: the arrow's shaft draws downward, its head grows from the tip, and it lands in the tray, which dips under it"
      >
        <path class="tray" d="M4 14.5 V18 a2 2 0 0 0 2 2 H18 a2 2 0 0 0 2 -2 V14.5" />
        <g class="arrow">
          <path class="shaft" pathLength="100" d="M12 3.5 V15" />
          <path class="arm" pathLength="100" d="M12 15 L7.5 10.5" />
          <path class="arm" pathLength="100" d="M12 15 L16.5 10.5" />
        </g>
      </svg>

      <button class="button" type="button">
        <svg class="glyph" viewBox="0 0 24 24" aria-hidden="true">
          <path class="tray" d="M4 14.5 V18 a2 2 0 0 0 2 2 H18 a2 2 0 0 0 2 -2 V14.5" />
          <g class="arrow">
            <path class="shaft" pathLength="100" d="M12 3.5 V15" />
            <path class="arm" pathLength="100" d="M12 15 L7.5 10.5" />
            <path class="arm" pathLength="100" d="M12 15 L16.5 10.5" />
          </g>
        </svg>
        Download
      </button>
    </div>
  </body>
</html>

The variant family

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