Back to the library

Dry stone — rolled, not spun

Variant: Rolled

Two round stones shoved the same 150.8px on the same braking curve. The top one rolls: its turn is owed by its travel, θ = d / r, which on a 12px radius is exactly two turns — and because translate and rotate live in one transform and one set of keyframes, they cannot drift apart on any frame. The chalk mark on its rim prints the track each time it comes down, and the prints land one circumference apart, so the proof is left on the course. The bottom one is the common build: the same travel, and a three-quarter turn authored separately on its own pleasing ease-in-out. It skates early and then spins against the ground while it is braking, and the contact point visibly slides. Braking is 2s − s² in both lanes, because rolling resistance is a constant force and a constant force removes speed at a constant rate. Reach for it whenever a round thing travels — a coin, a token, a toggle knob, a wheel in an illustration, a refresh glyph that slides as it turns — and derive the angle from the distance instead of designing it.

physicseasinggestureloop

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>Dry stone — rolled, not spun</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 — every duration in the document runs off --t. */
        --cycle: 4s;
        --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);
        /* Rolling resistance is a constant force, so a shoved stone loses
           speed at a constant rate: exactly 2s − s². Physics, not taste. */
        --_coast: cubic-bezier(0.333, 0.667, 0.667, 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 {
        display: grid;
        gap: 10px;
        width: 240px;
      }

      .cap,
      .lbl {
        font-size: 11px;
        letter-spacing: 0.04em;
        color: color-mix(in srgb, var(--slate) 52%, transparent);
      }

      .scene {
        position: relative;
        width: 240px;
        height: 140px;
      }

      .lbl {
        position: absolute;
        left: 0;
        line-height: 1;
      }

      .lbl.a {
        top: 8px;
      }

      .lbl.b {
        top: 80px;
      }

      .lbl b {
        font-weight: 600;
        color: var(--slate);
      }

      /* The top course of a wall, used as a track. */
      .track {
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--oat);
      }

      .track.a {
        top: 58px;
      }

      .track.b {
        top: 124px;
      }

      .rig {
        position: absolute;
        inset: 0;
        animation: rig-cycle var(--t) linear infinite;
      }

      .stone {
        position: absolute;
        left: 12px;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--paper);
        border: 1.5px solid var(--oat);
      }

      /* The chalk mark on the rim, and a grain line through the centre so the
         turn is legible at any angle. */
      .stone::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 2px;
        bottom: 50%;
        width: 1.5px;
        margin-left: -0.75px;
        background: var(--oat);
      }

      .stone::after {
        content: '';
        position: absolute;
        left: 50%;
        top: 1px;
        width: 5px;
        height: 5px;
        margin-left: -2.5px;
        border-radius: 50%;
        background: var(--clay-d);
      }

      .stone.a {
        top: 34px;
        animation: roll var(--t) infinite;
      }

      .stone.b {
        top: 100px;
        animation: slide var(--t) infinite;
      }

      .stone.b .spin {
        position: absolute;
        inset: -1.5px;
        border-radius: 50%;
        animation: spin var(--t) infinite;
      }

      .stone.b .spin::before,
      .stone.b .spin::after {
        content: '';
        position: absolute;
        left: 50%;
      }

      .stone.b .spin::before {
        top: 3.5px;
        bottom: 50%;
        width: 1.5px;
        margin-left: -0.75px;
        background: var(--oat);
      }

      .stone.b .spin::after {
        top: 2.5px;
        width: 5px;
        height: 5px;
        margin-left: -2.5px;
        border-radius: 50%;
        background: var(--clay-d);
      }

      /* The lower stone carries its marks on an inner layer, so its own
         pseudo-elements stay empty. */
      .stone.b::before,
      .stone.b::after {
        content: none;
      }

      /* One transform, one curve. θ = d / r: 150.8px of travel on a 12px
         radius is 12.57 rad, exactly two turns, and because translate and
         rotate interpolate inside the same keyframes they cannot drift apart
         on any frame — the contact point is always momentarily still, which
         is what rolling is. */
      @keyframes roll {
        0%,
        12% {
          transform: translateX(0) rotate(0deg);
          animation-timing-function: var(--_coast);
        }
        39.5%,
        94% {
          transform: translateX(150.8px) rotate(720deg);
        }
        95%,
        100% {
          transform: translateX(0) rotate(0deg);
        }
      }

      /* The common build: the same travel, and a turn authored separately on
         its own pleasing curve. Three-quarters of a turn over two turns'
         worth of road, eased in and out while the stone itself is braking —
         it skates, then spins against the ground, and nobody can say why it
         looks like ice. */
      @keyframes slide {
        0%,
        12% {
          transform: translateX(0);
          animation-timing-function: var(--_coast);
        }
        39.5%,
        94% {
          transform: translateX(150.8px);
        }
        95%,
        100% {
          transform: translateX(0);
        }
      }

      @keyframes spin {
        0%,
        12% {
          transform: rotate(0deg);
          animation-timing-function: var(--ease-in-out);
        }
        39.5%,
        94% {
          transform: rotate(270deg);
        }
        95%,
        100% {
          transform: rotate(0deg);
        }
      }

      /* Where the chalk touched the course. On a true roll the mark comes
         down at θ = 180° and 540°, d = πr and 3πr, so the prints land one
         circumference apart — the proof is printed on the track. */
      .print {
        position: absolute;
        top: 57px;
        width: 5px;
        height: 4px;
        margin-left: -2.5px;
        border-radius: 999px;
        background: var(--clay-d);
        opacity: 0;
      }

      .print.p1 {
        left: 61.7px;
        animation: print-1 var(--t) infinite;
      }

      .print.p2 {
        left: 137.1px;
        animation: print-2 var(--t) infinite;
      }

      .dim {
        position: absolute;
        left: 61.7px;
        top: 64px;
        width: 75.4px;
        height: 12px;
        opacity: 0;
        animation: dim-in var(--t) infinite;
      }

      .dim::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        height: 5px;
        border: 1px solid color-mix(in srgb, var(--slate) 34%, transparent);
        border-top: 0;
      }

      .dim span {
        position: absolute;
        left: 50%;
        top: 2px;
        transform: translateX(-50%);
        padding: 0 4px;
        background: var(--ivory);
        font-size: 11px;
        line-height: 1;
        letter-spacing: 0.04em;
        color: color-mix(in srgb, var(--slate) 62%, transparent);
      }

      /* The roll spends 27.5% of the cycle. 2s − s² reaches a quarter of
         the travel at s = 0.134 and three-quarters at s = 0.5. */
      @keyframes print-1 {
        0%,
        15.68% {
          opacity: 0;
        }
        15.7%,
        86% {
          opacity: 1;
        }
        92%,
        100% {
          opacity: 0;
        }
      }

      @keyframes print-2 {
        0%,
        25.75% {
          opacity: 0;
        }
        25.77%,
        86% {
          opacity: 1;
        }
        92%,
        100% {
          opacity: 0;
        }
      }

      @keyframes dim-in {
        0%,
        27% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        33%,
        86% {
          opacity: 1;
        }
        92%,
        100% {
          opacity: 0;
        }
      }

      @keyframes rig-cycle {
        0% {
          opacity: 0;
        }
        5%,
        86% {
          opacity: 1;
        }
        92%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* No travel, no turning: both stones at rest where they finish, the
           prints and their spacing on the track, and the measurement — the
           one thing worth taking away — breathing. */
        .rig,
        .stone.a,
        .stone.b,
        .stone.b .spin,
        .print.p1,
        .print.p2 {
          animation: none;
          opacity: 1;
        }

        .stone.a {
          transform: translateX(150.8px) rotate(720deg);
        }

        .stone.b {
          transform: translateX(150.8px);
        }

        .stone.b .spin {
          transform: rotate(270deg);
        }

        .dim {
          animation: rest-cue calc(var(--t) * 1.6) var(--ease-in-out) infinite;
        }

        @keyframes rest-cue {
          0%,
          100% {
            opacity: 0.4;
          }
          50% {
            opacity: 1;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="stage"
      role="img"
      aria-label="Two round stones are shoved along two tracks the same distance on the same braking curve. The top one rolls exactly two turns, leaving chalk prints one circumference apart; the bottom one turns three-quarters of a turn on its own eased curve and visibly skates and spins against the ground"
    >
      <p class="cap">turn owed by travel &middot; θ = d / r</p>
      <div class="scene">
        <p class="lbl a"><b>rolled</b> &middot; θ from distance</p>
        <div class="track a"></div>
        <p class="lbl b"><b>spun</b> &middot; θ on its own ease</p>
        <div class="track b"></div>
        <div class="rig">
          <span class="print p1"></span>
          <span class="print p2"></span>
          <div class="dim"><span>2πr</span></div>
          <div class="stone a"></div>
          <div class="stone b"><div class="spin"></div></div>
        </div>
      </div>
    </div>
  </body>
</html>