Back to the library

Safeguard — dead man’s switch

Variant: Dead man’s switch

The inverse of hold-to-confirm: the hold is not a promise about to be kept, it is the operation itself. A winch lowers a load only while its button is pressed. Load, line and depth readout share every keyframe stop and all run linear, because a motor pays out at motor speed and there is no curve to give it — and there is no coast either: the frame the finger lifts at 18m is the frame the load stops. The only motion nobody commanded is the brake’s bite: the load drops 2px on the line and recovers, which is what proves the stop was hard; the floor landing gets none, because the floor takes the weight and not the line. “Brake on” is the resting state, shown before anyone touches the control and back the instant they stop; the pill’s shell never leaves, only its word changes, and it never earns rust. Progress is kept rather than forfeited, and the second hold resumes from 18 at exactly the same rate. Use it for jog controls, push-to-talk, scrubbing a live system and any long action that should halt the moment attention does.

controlgesturephysicsloop

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>Safeguard — dead man's switch</title>
    <style>
      @property --_d {
        syntax: '<integer>';
        inherits: false;
        initial-value: 0;
      }

      :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 — 6.4s: a hold that is let go two thirds of the way down, then
           a second hold that finishes the descent. */
        --cycle: 6.4s;
        --t: calc(var(--cycle) / var(--speed));

        --_w: min(300px, 88vw);

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

      .stage {
        position: relative;
        width: var(--_w);
        height: 168px;
        animation: rearm var(--t) infinite;
      }

      .shaft {
        position: absolute;
        left: calc(22% - 30px);
        top: 8px;
        width: 60px;
        height: 152px;
        border-radius: calc(8px * var(--round));
        background: var(--paper);
        border: 1px solid var(--oat);
      }

      .ticks {
        position: absolute;
        left: -12px;
        top: 41px;
        width: 6px;
        height: 89px;
        background: repeating-linear-gradient(
          to bottom,
          color-mix(in srgb, var(--slate) 26%, var(--oat)) 0 1px,
          transparent 1px 17.6px
        );
      }

      .floor {
        position: absolute;
        left: 4px;
        right: 4px;
        bottom: 4px;
        height: 6px;
        border-radius: calc(2px * var(--round));
        background: repeating-linear-gradient(
          135deg,
          color-mix(in srgb, var(--slate) 30%, var(--oat)) 0 1.5px,
          transparent 1.5px 5px
        );
      }

      .drum {
        position: absolute;
        left: calc(50% - 14px);
        top: 8px;
        width: 28px;
        height: 8px;
        border-radius: 999px;
        background: color-mix(in srgb, var(--slate) 70%, var(--oat));
        z-index: 1;
      }

      /* Line and load share a parent so the brake's jolt moves them as one
         body; the drum sits on top and hides where the line enters it. */
      .hang {
        position: absolute;
        inset: 0;
        animation: jolt var(--t) infinite;
      }

      .line {
        position: absolute;
        left: calc(50% - 0.5px);
        top: 10px;
        width: 1px;
        height: 106px;
        background: color-mix(in srgb, var(--slate) 55%, var(--oat));
        transform-origin: 50% 0;
        transform: scaleY(0.1698);
        animation: pay-out var(--t) infinite;
      }

      .load {
        position: absolute;
        left: calc(50% - 19px);
        top: 28px;
        width: 38px;
        height: 24px;
        border-radius: calc(5px * var(--round));
        background: color-mix(in srgb, var(--slate) 82%, var(--oat));
        animation: lower var(--t) infinite;
      }

      .panel {
        position: absolute;
        left: calc(64% - 66px);
        top: 22px;
        width: 132px;
        display: grid;
        justify-items: center;
      }

      .btn {
        position: relative;
        width: 132px;
        height: 46px;
        display: grid;
        place-items: center;
        border-radius: calc(10px * var(--round));
        background: var(--paper);
        border: 1px solid var(--oat);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: -0.01em;
        animation: press var(--t) infinite;
      }

      .btn::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: color-mix(in srgb, var(--clay) 14%, transparent);
        opacity: 0;
        animation: held var(--t) infinite;
      }

      .btn span {
        position: relative;
      }

      .depth {
        margin-top: 14px;
        font-size: 22px;
        font-weight: 600;
        letter-spacing: -0.02em;
        font-variant-numeric: tabular-nums;
        counter-reset: d var(--_d);
        animation: count var(--t) infinite;
      }

      .depth::before {
        content: counter(d);
      }

      .depth small {
        margin-left: 3px;
        font-size: 13px;
        font-weight: 500;
        color: color-mix(in srgb, var(--slate) 55%, var(--ivory));
      }

      .pill {
        position: relative;
        margin-top: 8px;
        width: 116px;
        height: 22px;
        border-radius: 999px;
        border: 1px solid var(--oat);
        background: var(--paper);
        font-size: 12px;
        font-weight: 600;
      }

      /* The shell never moves; only the word changes, so the brake's state
         is never absent for a frame — it is a status, not a notification. */
      .pill span {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        opacity: 0;
      }

      .pill .on {
        color: color-mix(in srgb, var(--slate) 70%, var(--ivory));
        animation: p-on var(--t) infinite;
      }
      .pill .off {
        color: var(--clay-d);
        animation: p-off var(--t) infinite;
      }
      .pill .landed {
        color: var(--olive);
        animation: p-landed var(--t) infinite;
      }

      .ghost {
        position: absolute;
        left: 0;
        top: 0;
        width: 14px;
        height: 18px;
        transform: translate(calc(var(--_w) * 0.9), 150px);
        animation: hand 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: contact var(--t) infinite;
      }

      /* The load, the line and the readout are linear and share every
         keyframe stop. A winch pays out at motor speed, so the descent has no
         curve to give it — and because the hold is the only input, there is
         no coast either: the frame the finger lifts is the frame it stops. */
      @keyframes lower {
        0%,
        12.5% {
          transform: translateY(0);
          animation-timing-function: linear;
        }
        37.5%,
        53.75% {
          transform: translateY(52.8px);
          animation-timing-function: linear;
        }
        70.42%,
        90.62% {
          transform: translateY(88px);
        }
        90.63%,
        100% {
          transform: translateY(0);
        }
      }

      @keyframes pay-out {
        0%,
        12.5% {
          transform: scaleY(0.1698);
          animation-timing-function: linear;
        }
        37.5%,
        53.75% {
          transform: scaleY(0.6679);
          animation-timing-function: linear;
        }
        70.42%,
        90.62% {
          transform: scaleY(1);
        }
        90.63%,
        100% {
          transform: scaleY(0.1698);
        }
      }

      @keyframes count {
        0%,
        12.5% {
          --_d: 0;
          animation-timing-function: linear;
        }
        37.5%,
        53.75% {
          --_d: 18;
          animation-timing-function: linear;
        }
        70.42%,
        90.62% {
          --_d: 30;
        }
        90.63%,
        100% {
          --_d: 0;
        }
      }

      /* The brake bites and the load's own weight stretches the line 2px
         past the stop before it settles — the only movement in the file that
         nobody commanded, and the proof that the stop was hard. The floor
         landing gets none: the floor takes the weight, not the line. */
      @keyframes jolt {
        0%,
        37.5% {
          transform: translateY(0);
          animation-timing-function: var(--ease-out);
        }
        38.44% {
          transform: translateY(2px);
          animation-timing-function: var(--ease-in-out);
        }
        41.25%,
        100% {
          transform: translateY(0);
        }
      }

      @keyframes press {
        0%,
        11.875% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        13.75%,
        37.5% {
          transform: scale(0.97);
          animation-timing-function: var(--ease-out);
        }
        39.375%,
        53.125% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        55%,
        73.44% {
          transform: scale(0.97);
          animation-timing-function: var(--ease-out);
        }
        75.31%,
        100% {
          transform: scale(1);
        }
      }

      @keyframes held {
        0%,
        11.875% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        13.75%,
        37.5% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        39.375%,
        53.125% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        55%,
        70.42% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        72.3%,
        100% {
          opacity: 0;
        }
      }

      /* The brake is the resting state, not the alarm: it is on before
         anyone touches the control and back on the frame they stop, so the
         pill never earns rust. Each label is out before the next is in. */
      @keyframes p-on {
        0%,
        11.875% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        12.4%,
        37.5% {
          opacity: 0;
        }
        38%,
        38.9% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        39.8%,
        53.125% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        53.6%,
        90.62% {
          opacity: 0;
        }
        90.63%,
        100% {
          opacity: 1;
        }
      }

      @keyframes p-off {
        0%,
        12.4% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        13.3%,
        37.5% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        38%,
        53.6% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        54.5%,
        70.42% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        70.9%,
        100% {
          opacity: 0;
        }
      }

      @keyframes p-landed {
        0%,
        70.9% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        71.9%,
        90.62% {
          opacity: 1;
        }
        90.63%,
        100% {
          opacity: 0;
        }
      }

      @keyframes hand {
        0%,
        4.69% {
          transform: translate(calc(var(--_w) * 0.9), 150px);
          animation-timing-function: var(--ease-out);
        }
        10.94%,
        37.5% {
          transform: translate(calc(var(--_w) * 0.64 + 56px), 48px);
          animation-timing-function: var(--ease-out);
        }
        40.6%,
        50% {
          transform: translate(calc(var(--_w) * 0.64 + 62px), 38px);
          animation-timing-function: var(--ease-out);
        }
        53.125%,
        73.44% {
          transform: translate(calc(var(--_w) * 0.64 + 56px), 48px);
          animation-timing-function: var(--ease-out);
        }
        81.25%,
        100% {
          transform: translate(calc(var(--_w) * 0.9), 150px);
        }
      }

      @keyframes contact {
        0%,
        11.875% {
          opacity: 0;
          transform: scale(0.5);
          animation-timing-function: var(--ease-out);
        }
        13.75%,
        37.5% {
          opacity: 0.4;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        39.375%,
        53.125% {
          opacity: 0;
          transform: scale(0.5);
          animation-timing-function: var(--ease-out);
        }
        55%,
        73.44% {
          opacity: 0.4;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        75.31%,
        100% {
          opacity: 0;
          transform: scale(0.5);
        }
      }

      @keyframes rearm {
        0%,
        87.5% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        90.625%,
        92.19% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        100% {
          opacity: 1;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The pointer parks and the button stops flexing. The descent stays,
           slowed by half again: the load stopping when the hold stops is the
           entire claim, and it cannot be made by a still frame. */
        .ghost {
          opacity: 0;
          animation: none;
        }
        .btn {
          animation: none;
        }
        .hang {
          animation: none;
        }
        .stage {
          animation: rearm calc(var(--t) * 1.5) infinite;
        }
        .load {
          animation: lower calc(var(--t) * 1.5) infinite;
        }
        .line {
          animation: pay-out calc(var(--t) * 1.5) infinite;
        }
        .depth {
          animation: count calc(var(--t) * 1.5) infinite;
        }
        .btn::before {
          animation: held calc(var(--t) * 1.5) infinite;
        }
        .pill .on {
          animation: p-on calc(var(--t) * 1.5) infinite;
        }
        .pill .off {
          animation: p-off calc(var(--t) * 1.5) infinite;
        }
        .pill .landed {
          animation: p-landed calc(var(--t) * 1.5) infinite;
        }
      }
    </style>
  </head>
  <body>
    <div
      class="stage"
      role="img"
      aria-label="A winch lowering a load down a shaft only while its button is held. The hold is released at 18 metres and the load stops dead as the brake comes on; a second hold lowers it the rest of the way to 30 metres, where it lands"
    >
      <div class="shaft">
        <span class="ticks"></span>
        <span class="floor"></span>
        <span class="drum"></span>
        <div class="hang">
          <span class="line"></span>
          <span class="load"></span>
        </div>
      </div>
      <div class="panel">
        <div class="btn"><span>Hold to lower</span></div>
        <div class="depth"><small>m</small></div>
        <div class="pill">
          <span class="on">Brake on</span>
          <span class="off">Lowering</span>
          <span class="landed">Landed</span>
        </div>
      </div>
      <span class="ghost">
        <span class="tip"></span>
        <svg class="arrow" viewBox="0 0 14 18" xmlns="http://www.w3.org/2000/svg">
          <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>
    </div>
  </body>
</html>

The variant family

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