Back to the library

End feel — firm

Variant: Firm

A limit you are allowed past, at a price. The last fifth of the range is hatched beneath the rail, legal but resisted, and the hand drives into it without slowing: the approach is tuned to arrive at exactly the pace it then holds, so the only change at 80 is the thumb starting to fall behind, ending up roughly two units of pointer for every one of thumb. A clay layer over the hatch rises with the strain. A second push wins a little more. On release the stretch gives a few units back and the thumb keeps the rest — the difference from a rubber band, which returns every pixel to the boundary. Reach for it when the far end is a warning rather than a wall: boosting past 100%, overcommitting a budget, a setting outside the recommended range.

physicscontrolgestureloop

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>End feel — firm</title>
    <style>
      /* Three registered numbers: where the thumb is (--_p), where the hand
         is (--_h), and what the readout says (--_v). Thumb and hand share
         keyframes until the zone, so they are pixel-identical while gripped
         and the frame they part is the frame the resistance is felt. */
      @property --_p {
        syntax: '<number>';
        inherits: true;
        initial-value: 20;
      }
      @property --_h {
        syntax: '<number>';
        inherits: true;
        initial-value: 20;
      }
      @property --_v {
        syntax: '<integer>';
        inherits: true;
        initial-value: 20;
      }

      :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) 52%, transparent);
        --_rail: color-mix(in srgb, var(--oat) 60%, transparent);
        --_zone: color-mix(in srgb, var(--slate) 22%, transparent);

        /* Clock — 4.4s: drag, the resisted stretch, a held push, release. */
        --cycle: 4.4s;
        --t: calc(var(--cycle) / var(--speed));

        --_w: min(232px, 70vw);
      }

      * {
        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);
      }

      .rig {
        display: grid;
        gap: 14px;
        justify-items: center;
        animation: rig-cycle var(--t) linear infinite;
      }

      .cap,
      .foot {
        font-size: 11px;
        letter-spacing: 0.04em;
        color: var(--_muted);
      }

      .foot {
        opacity: 0;
        animation: foot-in var(--t) linear infinite;
      }

      .box {
        position: relative;
        width: var(--_w);
        height: 78px;
        animation:
          thumb var(--t) infinite,
          hand var(--t) infinite;
      }

      .rail {
        position: absolute;
        left: 0;
        right: 0;
        top: 45px;
        height: 4px;
        border-radius: 2px;
        background: var(--_rail);
        overflow: hidden;
      }

      .fill {
        position: absolute;
        inset: 0;
        background: var(--clay);
        transform-origin: left center;
        transform: scaleX(calc(var(--_p) / 100));
      }

      /* The last fifth of the range is legal but resisted. The hatch sits
         below the thumb's footprint so it stays readable while the thumb is
         over it; the clay layer on top reports how hard the stretch is being
         pushed right now. */
      .zone,
      .tension {
        position: absolute;
        left: calc(var(--_w) * 0.8);
        width: calc(var(--_w) * 0.2);
        top: 61px;
        height: 5px;
        border-radius: 2.5px;
      }

      .zone {
        background: repeating-linear-gradient(
          -45deg,
          var(--_zone) 0 1.5px,
          transparent 1.5px 4.5px
        );
      }

      .tension {
        background: var(--clay);
        opacity: 0;
        animation: tension var(--t) infinite;
      }

      .carrier {
        position: absolute;
        left: 0;
        top: 34px;
        width: 0;
        height: 26px;
        transform: translateX(calc(var(--_w) * var(--_p) / 100));
      }

      .thumb {
        position: absolute;
        left: -10px;
        top: 3px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--paper);
        border: 1.5px solid var(--oat);
        box-shadow: 0 2px 6px color-mix(in srgb, var(--slate) 16%, transparent);
      }

      .chip {
        position: absolute;
        left: 0;
        top: -32px;
        transform: translateX(-50%);
        padding: 2px 7px;
        border-radius: calc(7px * var(--round));
        background: var(--paper);
        border: 1px solid var(--oat);
        font-size: 12px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
      }

      .chip::before {
        counter-reset: v var(--_v);
        content: counter(v);
      }

      .ghost {
        position: absolute;
        left: 0;
        top: 0;
        transform: translate(calc(var(--_w) * var(--_h) / 100), 47px);
      }

      .lift {
        position: relative;
        display: block;
        width: 14px;
        height: 18px;
        opacity: 0;
        animation: lift var(--t) infinite;
      }

      .arrow {
        display: block;
        width: 100%;
        height: 100%;
        fill: var(--slate);
        stroke: var(--ivory);
        stroke-width: 1.4;
        stroke-linejoin: round;
      }

      .tip {
        position: absolute;
        left: -9px;
        top: -9px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--clay-d);
        opacity: 0;
        transform: scale(0.5);
        animation: grip var(--t) infinite;
      }

      /* Up to 80 the thumb is the hand. Past it the hand keeps a constant
         4 units per 44ms while each 88ms slice buys the thumb less — 6, 4.5,
         3, then 1.5 as the hand stops — so the pointer pulls away about two
         to one. Linear slices, because the hand's pace is constant and the
         shrinking is the resistance. A second push wins two more units;
         on release the stretch gives four back over 220ms and the thumb
         keeps 91: a firm limit keeps most of what you paid for. */
      @keyframes thumb {
        0%,
        8% {
          --_p: 20;
          --_v: 20;
          animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.8);
        }
        20% {
          --_p: 80;
          --_v: 80;
          animation-timing-function: linear;
        }
        22% {
          --_p: 86;
          --_v: 86;
          animation-timing-function: linear;
        }
        24% {
          --_p: 90.5;
          --_v: 90;
          animation-timing-function: linear;
        }
        26% {
          --_p: 93.5;
          --_v: 93;
          animation-timing-function: cubic-bezier(0.2, 0.4, 0.4, 1);
        }
        28%,
        32% {
          --_p: 95;
          --_v: 95;
          animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
        }
        35% {
          --_p: 94;
          --_v: 94;
          animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
        }
        38%,
        46% {
          --_p: 96;
          --_v: 96;
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        51%,
        97% {
          --_p: 91;
          --_v: 91;
        }
        98%,
        100% {
          --_p: 20;
          --_v: 20;
        }
      }

      /* The approach reaches 80 at the same 4 units per 44ms it then holds
         straight through the zone, so the only change at the seam is the
         thumb starting to fall behind — the hand never hesitates. */
      @keyframes hand {
        0%,
        8% {
          --_h: 20;
          animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.8);
        }
        20% {
          --_h: 80;
          animation-timing-function: linear;
        }
        26% {
          --_h: 104;
          animation-timing-function: cubic-bezier(0.2, 0.4, 0.4, 1);
        }
        28%,
        32% {
          --_h: 108;
          animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
        }
        35% {
          --_h: 104;
          animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
        }
        38%,
        97% {
          --_h: 108;
        }
        98%,
        100% {
          --_h: 20;
        }
      }

      @keyframes lift {
        0%,
        3% {
          opacity: 0;
          transform: translate(18px, 40px);
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        8%,
        46% {
          opacity: 1;
          transform: translate(0, 0);
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        53%,
        100% {
          opacity: 0;
          transform: translate(2px, 26px);
        }
      }

      /* The grip disc is thumb-sized only while it holds the thumb. The
         frame they part it shrinks to a fingertip, so the pointer out past
         the limit never reads as a second thumb. */
      @keyframes grip {
        0%,
        7% {
          opacity: 0;
          transform: scale(0.5);
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        8%,
        20% {
          opacity: 0.4;
          transform: scale(1);
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        21.5%,
        45.5% {
          opacity: 0.4;
          transform: scale(0.45);
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        47.5%,
        100% {
          opacity: 0;
          transform: scale(0.5);
        }
      }

      /* Tension is the hand-to-thumb gap made visible: zero until the zone,
         brightest at the held push, relaxing on release as the stretch gives
         back. */
      @keyframes tension {
        0%,
        20% {
          opacity: 0;
          animation-timing-function: linear;
        }
        28%,
        46% {
          opacity: 0.6;
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        53%,
        100% {
          opacity: 0;
        }
      }

      @keyframes foot-in {
        0%,
        48% {
          opacity: 0;
          animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
        }
        52%,
        88% {
          opacity: 1;
        }
        92%,
        100% {
          opacity: 0;
        }
      }

      @keyframes rig-cycle {
        0% {
          opacity: 0;
        }
        3%,
        90% {
          opacity: 1;
        }
        95%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The travel goes; the effort stays. The thumb is parked inside the
           zone and the tension layer breathes over the hatch, so the card
           still says "you can go here, but it costs". */
        .rig,
        .box,
        .lift {
          animation: none;
        }

        .box {
          --_p: 91;
          --_v: 91;
        }

        .foot {
          animation: none;
          opacity: 1;
        }

        .tension {
          animation: tension-rest calc(var(--t) * 1.6) ease infinite;
        }

        @keyframes tension-rest {
          0%,
          10% {
            opacity: 0.12;
          }
          40%,
          60% {
            opacity: 0.55;
          }
          90%,
          100% {
            opacity: 0.12;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="rig"
      role="img"
      aria-label="A slider dragged into a resisted last fifth of its range: past 80 the thumb falls further and further behind the pointer, and on release it gives back a little and keeps the rest"
    >
      <p class="cap">end feel · firm</p>
      <div class="box">
        <div class="rail"><i class="fill"></i></div>
        <i class="zone"></i>
        <i class="tension"></i>
        <div class="carrier">
          <span class="chip"></span>
          <span class="thumb"></span>
        </div>
        <span class="ghost">
          <span class="lift">
            <span class="tip"></span>
            <svg class="arrow" viewBox="0 0 14 18">
              <path d="M1 1 L1 14.8 L4.5 11.6 L6.7 16.6 L9.3 15.4 L7.1 10.5 L11.8 10.3 Z" />
            </svg>
          </span>
        </span>
      </div>
      <p class="foot">pushed to 100 — it kept 91</p>
    </div>
  </body>
</html>

The variant family

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