Back to the library

Sensor — blocked attempts, counted

Variant: Blocked, counted

An app whose microphone permission is off keeps trying, and the user should know — once, not three times. The first attempt opens a Mic blocked pill out of a slashed-mic glyph; the second grows it leftward to make room for a ×2 badge instead of stacking a second notice; the third rolls the count to ×3 over 200ms on ease-out, so the same notice gets heavier rather than a new one arriving. The glyph knocks once per attempt — 72ms up, 216ms back — and that is the only motion that repeats, so it repeats exactly as often as something was refused. One pill, three clip states, laid out once at full width, so the bar never reflows. After 2.2s of quiet it folds back into the glyph on ease-in-out and leaves entirely: nothing was collected, so unlike a live sensor there is no state left to persist. Use it for denied permissions, blocked trackers and rate-limited background access — refusals the user made once and deserves to see enforced.

statusprivacyindicatorerrorcounterclip-pathloop

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>Sensor — blocked attempts, counted</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 — 7.2s, so 1% is 72ms. Three attempts at 720ms, 2.16s and
           3.17s, a 2.2s quiet read after the last, then the pill folds back
           into its glyph and leaves. */
        --cycle: 7.2s;
        --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);

        --_muted: color-mix(in srgb, var(--slate) 52%, transparent);
        --_tint: color-mix(in srgb, var(--rust) 9%, var(--paper));
        --_chip: color-mix(in srgb, var(--rust) 16%, var(--paper));
        --_icon: color-mix(in srgb, var(--oat) 60%, var(--paper));

        /* Three clip states for one pill: just the glyph, glyph and label,
           everything. 30px is the badge plus its gap, less the 8px the label
           needs as its own left margin once the round end clips beside it. */
        --_glyph: inset(0 0 0 calc(100% - 24px) round 999px);
        --_label: inset(0 0 0 30px round 999px);
        --_all: inset(0 0 0 0 round 999px);
      }

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

      .device {
        width: min(320px, 86vw);
        background: var(--paper);
        border: 1px solid var(--oat);
        border-radius: calc(16px * var(--round));
        overflow: hidden;
      }

      .bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 40px;
        padding: 0 8px 0 14px;
        border-bottom: 1px solid var(--oat);
      }

      .time {
        font-size: 12.5px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
      }

      /* Badge on the far left, glyph on the far right: the pill grows out of
         the glyph the first time and further leftward when there is a count
         to show, so the second attempt makes room instead of stacking a
         second notice beside the first. Laid out once at full width; only
         the clip moves, so nothing in the bar ever reflows. */
      .pill {
        display: inline-flex;
        align-items: center;
        height: 24px;
        padding-left: 6px;
        border-radius: 999px;
        background: var(--_tint);
        clip-path: var(--_glyph);
        opacity: 0;
        animation:
          reach var(--t) infinite,
          shown var(--t) infinite;
      }

      @keyframes reach {
        0%,
        10% {
          clip-path: var(--_glyph);
          animation-timing-function: var(--ease-out);
        }
        13.1%,
        30% {
          clip-path: var(--_label);
          animation-timing-function: var(--ease-out);
        }
        33.1%,
        74.5% {
          clip-path: var(--_all);
          animation-timing-function: var(--ease-in-out);
        }
        78%,
        100% {
          clip-path: var(--_glyph);
        }
      }

      @keyframes shown {
        0%,
        10% {
          opacity: 0;
        }
        11%,
        78.5% {
          opacity: 1;
        }
        81%,
        100% {
          opacity: 0;
        }
      }

      .badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 16px;
        margin-right: 10px;
        border-radius: 999px;
        background: var(--_chip);
        color: var(--rust);
        font-size: 11px;
        font-weight: 700;
        line-height: 16px;
        font-variant-numeric: tabular-nums;
        opacity: 0;
        animation: badge var(--t) infinite;
      }

      @keyframes badge {
        0%,
        31% {
          opacity: 0;
          transform: scale(0.9);
          animation-timing-function: var(--ease-out);
        }
        33.5%,
        73.5% {
          opacity: 1;
          transform: scale(1);
        }
        75%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      .digits {
        display: inline-block;
        height: 16px;
        overflow: hidden;
      }

      .col {
        display: grid;
        animation: roll var(--t) infinite;
      }

      /* The count rolls rather than swaps, 200ms on ease-out, so a third
         attempt reads as the same notice getting heavier — not a new one. */
      @keyframes roll {
        0%,
        44% {
          transform: translateY(0);
          animation-timing-function: var(--ease-out);
        }
        46.8%,
        90% {
          transform: translateY(-16px);
        }
        90.1%,
        100% {
          transform: translateY(0);
        }
      }

      .lbl {
        margin-right: 6px;
        font-size: 12px;
        font-weight: 600;
        color: var(--rust);
        white-space: nowrap;
        opacity: 0;
        animation: lbl var(--t) ease infinite;
      }

      @keyframes lbl {
        0%,
        11.5% {
          opacity: 0;
        }
        13.5%,
        73.5% {
          opacity: 1;
        }
        75%,
        100% {
          opacity: 0;
        }
      }

      .glyph {
        display: grid;
        place-items: center;
        flex: none;
        width: 24px;
        height: 24px;
      }

      .glyph svg {
        width: 14px;
        height: 14px;
        overflow: visible;
        fill: none;
        stroke-linecap: round;
        animation: knock var(--t) infinite;
      }

      .mic {
        stroke: var(--rust);
        stroke-width: 1.6;
      }

      .slash-under {
        stroke: var(--_tint);
        stroke-width: 4;
      }

      .slash {
        stroke: var(--rust);
        stroke-width: 1.6;
      }

      /* One knock per attempt: 72ms up, 216ms back, both ease-out. It is
         the only motion that repeats, and it repeats exactly as often as
         something was refused — the glyph is a counter you can feel. The
         third peaks just after the count starts rolling, so the eye reads
         the roll first and the knock confirms it. */
      @keyframes knock {
        0%,
        10% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        11% {
          transform: scale(1.16);
          animation-timing-function: var(--ease-out);
        }
        14%,
        30% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        31% {
          transform: scale(1.16);
          animation-timing-function: var(--ease-out);
        }
        34%,
        44.5% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        45.5% {
          transform: scale(1.16);
          animation-timing-function: var(--ease-out);
        }
        48.5%,
        100% {
          transform: scale(1);
        }
      }

      .app {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: clamp(16px, 5vw, 22px) 16px;
      }

      .icon {
        display: grid;
        place-items: center;
        flex: none;
        width: 36px;
        height: 36px;
        border-radius: calc(9px * var(--round));
        background: var(--_icon);
        font-size: 14px;
        font-weight: 700;
        color: var(--_muted);
      }

      .meta {
        display: grid;
        gap: 2px;
        min-width: 0;
      }

      .title {
        font-size: 13px;
        font-weight: 600;
        letter-spacing: -0.01em;
      }

      .perm {
        font-size: 11.5px;
        color: var(--_muted);
      }

      .switch {
        flex: none;
        margin-left: auto;
        width: 30px;
        height: 18px;
        border-radius: 999px;
        background: var(--oat);
        position: relative;
      }

      .switch::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--paper);
      }

      @media (prefers-reduced-motion: reduce) {
        /* The knock and the badge's scale go; the count still rolls — it is
           the number changing, and a hard swap would read as a new notice.
           Every clock stretches by the same 1.5 so the pill still opens on
           the attempt it answers. */
        .glyph svg {
          animation: none;
        }

        .badge {
          animation-name: badge-calm;
        }

        @keyframes badge-calm {
          0%,
          31% {
            opacity: 0;
          }
          33.5%,
          73.5% {
            opacity: 1;
          }
          75%,
          100% {
            opacity: 0;
          }
        }

        .pill,
        .badge,
        .col,
        .lbl {
          animation-duration: calc(var(--t) * 1.5);
        }
      }
    </style>
  </head>
  <body>
    <div
      class="device"
      role="img"
      aria-label="Notes, whose microphone permission is off, tries the mic three times; a 'Mic blocked' pill opens from a slashed-mic glyph, grows a ×2 badge on the second try and rolls it to ×3 on the third, then folds back into the glyph and leaves"
    >
      <div class="bar">
        <span class="time">9:41</span>
        <span class="pill">
          <span class="badge"
            >×<span class="digits"
              ><span class="col"><span>2</span><span>3</span></span></span
            ></span
          >
          <span class="lbl">Mic blocked</span>
          <span class="glyph">
            <svg viewBox="0 0 14 14" aria-hidden="true">
              <g class="mic">
                <rect x="4.6" y="1" width="4.8" height="7.4" rx="2.4" />
                <path d="M2.4 6.6a4.6 4.6 0 0 0 9.2 0" />
                <path d="M7 11.2v1.8" />
              </g>
              <path class="slash-under" d="M1.5 1.5 L12.5 12.5" />
              <path class="slash" d="M1.5 1.5 L12.5 12.5" />
            </svg>
          </span>
        </span>
      </div>
      <div class="app" aria-hidden="true">
        <span class="icon">N</span>
        <span class="meta">
          <span class="title">Notes</span>
          <span class="perm">Microphone · not allowed</span>
        </span>
        <span class="switch"></span>
      </div>
    </div>
  </body>
</html>