Back to the library

Dry stone — tossed on two clocks

Variant: Tossed

A stone thrown onto a wall, built as three nested layers on three clocks: x is linear because nothing pushes sideways in flight, y is a parabola — exact 2s − s² up and s² down — because gravity is the only force, and the half-turn is linear because nothing applies torque. That composition is the whole lesson, and the mistake flies beside it as a dashed ghost: one element on one path through the apex, ease-in-out on both axes per leg, which peaks at mid-flight, hangs at the top and comes in on a straight diagonal — a tent, not an arc. Author the axes separately and the parabola falls out for free. One rise and one fall under a single gravity also fixes where the apex sits — at √97 : √55 of the flight, 57% of the way, not halfway — and a dot left every eighth of the flight shows it: evenly spaced across, bunched over the top, stretched at both ends. The dots are uncovered by a linear wipe riding the stone’s centre, which only lines up because x really is linear in time. Touchdown is a short friction slide whose opening slope equals the flight’s 166px/s, so the stone starts losing speed instead of stopping dead. Reach for it for add-to-cart arcs, drag-to-bin, and anything sent across a screen that should feel thrown rather than tweened.

physicseasingentranceloop

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 — tossed on two clocks</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)
        );

        /* Clock — every duration in the document runs off --t. */
        --cycle: 4s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
        /* Gravity, exactly: these two are the cubic forms of 2s − s² and s².
           They are physics, not taste, so they stay out of --ease-accent where
           a remix could swap them for a UI curve. */
        --_rise: cubic-bezier(0.333, 0.667, 0.667, 1);
        --_fall: cubic-bezier(0.333, 0, 0.667, 0.333);
      }

      * {
        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,
      .legend {
        font-size: 11px;
        letter-spacing: 0.04em;
        color: color-mix(in srgb, var(--slate) 52%, transparent);
      }

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

      .ground {
        position: absolute;
        left: 0;
        right: 0;
        top: 126px;
        height: 2px;
        background: var(--oat);
      }

      /* Dry-stacked: no mortar, so the joints are gaps and every course
         breaks the joints of the one under it. */
      .wall {
        position: absolute;
        left: 158px;
        top: 84px;
        width: 82px;
        display: grid;
        gap: 2px;
      }

      .course {
        display: flex;
        gap: 2px;
        height: 12px;
      }

      .course:last-child {
        height: 14px;
      }

      .course span,
      .laid {
        border-radius: calc(3px * var(--round));
        background: color-mix(in srgb, var(--oat) 72%, var(--paper));
      }

      .course span:nth-child(2n) {
        background: var(--oat);
      }

      .laid {
        position: absolute;
        left: 210px;
        top: 70px;
        width: 22px;
        height: 14px;
        background: var(--oat);
      }

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

      /* The record of the flight, one dot per eighth of it. The layer is
         uncovered by a linear wipe that rides the stone's centre, which only
         works because x is linear in time — the wipe is the proof. Equal
         steps across, unequal steps up and down: slow at the top, fast at
         both ends, and that bunching is what makes an arc read as thrown. */
      .trace {
        position: absolute;
        inset: 0;
        clip-path: inset(0 210px 0 0);
        animation: uncover var(--t) linear infinite;
      }

      .trace i {
        position: absolute;
        width: 4px;
        height: 4px;
        margin: -2px 0 0 -2px;
        border-radius: 50%;
        background: color-mix(in srgb, var(--slate) 34%, transparent);
      }

      /* Three nested layers, three clocks. x has no force on it, so it is
         linear; y has only gravity, so it is a parabola; the spin has no
         torque, so it is linear too. A single element on one eased path
         cannot do this — any curve shared by x and y bends the arc. */
      .ax {
        position: absolute;
        left: 19px;
        top: 112px;
        animation: across var(--t) infinite;
      }

      .ay {
        animation: updown var(--t) infinite;
      }

      .stone {
        width: 22px;
        height: 14px;
        border-radius: calc(3px * var(--round));
        background: var(--clay);
        animation: spin var(--t) linear infinite;
      }

      /* Launch 12%, flight 0.95s = 23.75% of the cycle. The last 8px is a
         slide on the wall: friction is a constant force, so it is the same
         quadratic as the rise, and its opening slope equals the flight's
         166px/s — the stone does not change speed on touchdown, it starts
         losing it. */
      @keyframes across {
        0%,
        12% {
          transform: translateX(0);
          animation-timing-function: linear;
        }
        35.75% {
          transform: translateX(158px);
          animation-timing-function: var(--_rise);
        }
        38.155%,
        94% {
          transform: translateX(166px);
        }
        95%,
        100% {
          transform: translateX(0);
        }
      }

      /* Up 97px, down 55px, one gravity: the rise takes √97 : √55 of the
         flight, so the apex lands at 57% of it, not halfway. */
      @keyframes updown {
        0%,
        12% {
          transform: translateY(0);
          animation-timing-function: var(--_rise);
        }
        25.55% {
          transform: translateY(-97px);
          animation-timing-function: var(--_fall);
        }
        35.75%,
        94% {
          transform: translateY(-42px);
        }
        95%,
        100% {
          transform: translateY(0);
        }
      }

      /* Half a turn in the air. It comes down flat because it was thrown
         that way, and it stops turning at touchdown because the wall took the
         spin — nothing eases it out. */
      @keyframes spin {
        0%,
        12% {
          transform: rotate(0deg);
        }
        35.75%,
        94% {
          transform: rotate(180deg);
        }
        95%,
        100% {
          transform: rotate(0deg);
        }
      }

      /* The build this replaces: one element, one path through the apex,
         one ease-in-out on both axes per leg. It peaks at mid-flight instead
         of 57%, hangs at the top, and comes in on a straight diagonal — a
         tent, not an arc. It is drawn as a ghost and gives way on landing. */
      .ghost {
        position: absolute;
        left: 19px;
        top: 112px;
        width: 22px;
        height: 14px;
        border-radius: calc(3px * var(--round));
        border: 1.5px dashed color-mix(in srgb, var(--slate) 38%, transparent);
        animation: tween var(--t) infinite;
      }

      @keyframes tween {
        0%,
        12% {
          transform: translate(0, 0);
          opacity: 1;
          animation-timing-function: var(--ease-in-out);
        }
        23.875% {
          transform: translate(79px, -97px);
          opacity: 1;
          animation-timing-function: var(--ease-in-out);
        }
        35.75% {
          transform: translate(158px, -42px);
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        41%,
        94% {
          transform: translate(158px, -42px);
          opacity: 0;
        }
        95%,
        100% {
          transform: translate(0, 0);
          opacity: 0;
        }
      }

      .legend {
        display: flex;
        gap: 18px;
      }

      .legend span {
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      .legend span::before {
        content: '';
        width: 10px;
        height: 7px;
        border-radius: calc(2px * var(--round));
        background: var(--clay);
      }

      .legend .k-tween::before {
        background: none;
        border: 1.5px dashed color-mix(in srgb, var(--slate) 38%, transparent);
      }

      @keyframes uncover {
        0%,
        12% {
          clip-path: inset(0 210px 0 0);
        }
        35.75%,
        94% {
          clip-path: inset(0 50px 0 0);
        }
        95%,
        100% {
          clip-path: inset(0 210px 0 0);
        }
      }

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

      @media (prefers-reduced-motion: reduce) {
        /* The flight goes; its record stays. The stone rests where it landed
           and the trace breathes, so the lesson — even across, bunched at the
           ends — is on the card without anything crossing it. */
        .rig,
        .ax,
        .ay,
        .stone {
          animation: none;
          opacity: 1;
        }

        .ghost {
          animation: none;
          opacity: 0;
        }

        .ax {
          transform: translateX(166px);
        }

        .ay {
          transform: translateY(-42px);
        }

        .trace {
          clip-path: none;
          animation: rest-cue calc(var(--t) * 1.8) var(--ease-in-out) infinite;
        }

        @keyframes rest-cue {
          0%,
          100% {
            opacity: 0.45;
          }
          50% {
            opacity: 1;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="stage"
      role="img"
      aria-label="A stone is tossed in an arc onto a dry-stone wall, half-turning in the air, and slides a little to rest beside the last stone laid; dots left at equal intervals of time sit evenly spaced across but bunch together at the top of the arc. A dashed ghost on a single eased path peaks too early and comes in on a straight diagonal"
    >
      <p class="cap">x steady &middot; y under gravity</p>
      <div class="scene">
        <div class="ground"></div>
        <div class="wall">
          <div class="course">
            <span style="width: 24px"></span><span style="width: 30px"></span
            ><span style="width: 24px"></span>
          </div>
          <div class="course">
            <span style="width: 14px"></span><span style="width: 30px"></span
            ><span style="width: 34px"></span>
          </div>
          <div class="course">
            <span style="width: 28px"></span><span style="width: 26px"></span
            ><span style="width: 24px"></span>
          </div>
        </div>
        <span class="laid"></span>
        <div class="rig">
          <div class="trace">
            <i style="left: 30px; top: 119px"></i>
            <i style="left: 49.75px; top: 81.15px"></i>
            <i style="left: 69.5px; top: 52.61px"></i>
            <i style="left: 89.25px; top: 33.39px"></i>
            <i style="left: 109px; top: 23.48px"></i>
            <i style="left: 128.75px; top: 22.89px"></i>
            <i style="left: 148.5px; top: 31.61px"></i>
            <i style="left: 168.25px; top: 49.65px"></i>
            <i style="left: 188px; top: 77px"></i>
          </div>
          <span class="ghost"></span>
          <div class="ax">
            <div class="ay"><div class="stone"></div></div>
          </div>
        </div>
      </div>
      <p class="legend">
        <span>two clocks</span>
        <span class="k-tween">one eased path</span>
      </p>
    </div>
  </body>
</html>

The variant family

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