Skip to content

The design language that makes your AI harness better at design.

JavaScript
9.3 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Motion Anti-Patterns — Should Flag vs Should Pass</title>
  <style>
    /* ─── Two-column fixture convention ─────────────────────────────
       Left column = should flag. Right column = should pass.
       Tests assert (a) every flag-column rule fires and (b) the total
       finding count matches the number of flag cases (no false
       positives leaking from the pass column).
       ──────────────────────────────────────────────────────────── */
    body { font-family: system-ui, sans-serif; background: #f9fafb; padding: 24px; margin: 0; }
    .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; }
    .col h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 16px; color: #475569; }
    .col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 0 8px; color: #64748b; }
    .demo { padding: 14px 16px; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 10px; }
    .demo h4 { font-weight: 600; font-size: 13px; margin: 0; }
    .demo p { font-size: 12px; color: #6b7280; margin: 4px 0 0; }

    /* ── FLAG: bounce / elastic easing ── */
    @keyframes bounce-keyframe {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-10px); }
    }
    .bounce-animation { animation: bounce-keyframe 1s infinite; }
    .elastic-transition { transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55); }

    /* ── PASS: layout property transitions. The layout-transition rule
       was retired on 2026-10-07: on two judged cohorts every finding was a
       progress bar, a shrinking header, an accordion or a toast, and none
       was harmful. ── */
    .width-transition { transition: width 0.3s ease; }
    .height-transition { transition: height 0.4s ease-out; }
    .padding-transition { transition: padding 0.2s linear; }
    .margin-transition { transition: margin 0.3s ease-in; }
    .max-height-transition { transition: max-height 0.5s ease; }
    .multi-layout-transition { transition: width 0.3s ease, height 0.3s ease; }
    .mixed-transition { transition: width 0.3s ease, opacity 0.3s ease; }
    .transition-property-width { transition-property: width; transition-duration: 0.3s; }

    /* ── PASS: good easing ── */
    @keyframes fade-in-keyframe {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .fade-in-good { animation: fade-in-keyframe 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
    .ease-out-quart { transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); }
    .ease-out-expo { transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

    /* ── PASS: safe transitions ── */
    .transform-transition { transition: transform 0.3s ease-out; }
    .opacity-transition { transition: opacity 0.2s ease; }
    .color-transition { transition: color 0.15s ease, background-color 0.15s ease; }
    .shadow-transition { transition: box-shadow 0.2s ease; }
    .all-transition { transition: all 0.3s ease; }
    .multi-safe-transition { transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.2s ease; }

    /* ── PASS: hover zoom on card imagery (a long-standing convention) ── */
    .zoom-card img { display: block; width: 240px; height: 160px; transition: transform 0.3s ease; }
    .zoom-card:hover img { transform: scale(1.04); }
    .zoom-card img:hover { transform: scale(1.05); }
  </style>
</head>
<body>
  <div class="grid">
    <!-- ════════════════════════════════════════════════════════════
         LEFT COLUMN: should flag
         ═══════════════════════════════════════════════════════════ -->
    <div class="col" data-col="flag">
      <h2>Should flag</h2>

      <h3>Bounce / elastic easing</h3>
      <div class="demo bounce-animation">
        <h4>CSS bounce animation</h4>
        <p>animation: bounce 1s infinite</p>
      </div>
      <div class="demo elastic-transition">
        <h4>Elastic cubic-bezier</h4>
        <p>cubic-bezier(0.68, -0.55, 0.265, 1.55)</p>
      </div>
    </div>

    <!-- ════════════════════════════════════════════════════════════
         RIGHT COLUMN: should pass
         ═══════════════════════════════════════════════════════════ -->
    <div class="col" data-col="pass">
      <h2>Should pass</h2>

      <h3>Good easing</h3>
      <div class="demo fade-in-good">
        <h4>Smooth fade in</h4>
        <p>animation: fadeIn with exponential ease-out</p>
      </div>
      <div class="demo ease-out-quart">
        <h4>Ease-out quart</h4>
        <p>cubic-bezier(0.25, 1, 0.5, 1) — smooth deceleration</p>
      </div>
      <div class="demo ease-out-expo">
        <h4>Ease-out expo</h4>
        <p>cubic-bezier(0.16, 1, 0.3, 1) — natural feel</p>
      </div>

      <h3>Safe transitions (transform / opacity / color only)</h3>
      <div class="demo transform-transition">
        <h4>transition: transform</h4>
        <p>Transform is GPU-accelerated and safe.</p>
      </div>
      <div class="demo opacity-transition">
        <h4>transition: opacity</h4>
        <p>Opacity is GPU-accelerated and safe.</p>
      </div>
      <div class="demo color-transition">
        <h4>transition: color, background-color</h4>
        <p>Color transitions are paint-only, no layout.</p>
      </div>
      <div class="demo shadow-transition">
        <h4>transition: box-shadow</h4>
        <p>Shadow transitions are paint-only.</p>
      </div>
      <div class="demo all-transition">
        <h4>transition: all</h4>
        <p>Too common to flag — usually paired with transform/opacity.</p>
      </div>
      <div class="demo multi-safe-transition">
        <h4>transition: transform, opacity, box-shadow</h4>
        <p>Multiple safe properties combined.</p>
      </div>

      <h3>Layout property transitions (the retired layout-transition rule)</h3>
      <div class="demo width-transition">
        <h4>transition: width</h4>
        <p>A progress bar fills by its width.</p>
      </div>
      <div class="demo height-transition">
        <h4>transition: height</h4>
        <p>A header shrinks on scroll by its height.</p>
      </div>
      <div class="demo padding-transition">
        <h4>transition: padding</h4>
        <p>A header tightens its padding on scroll.</p>
      </div>
      <div class="demo margin-transition">
        <h4>transition: margin</h4>
        <p>A toast slides in by its margin.</p>
      </div>
      <div class="demo max-height-transition">
        <h4>transition: max-height</h4>
        <p>An accordion opens by its max-height.</p>
      </div>
      <div class="demo multi-layout-transition">
        <h4>transition: width, height</h4>
        <p>Multiple layout properties.</p>
      </div>
      <div class="demo mixed-transition">
        <h4>transition: width, opacity</h4>
        <p>Layout property mixed with OK property.</p>
      </div>
      <div class="demo transition-property-width">
        <h4>transition-property: width</h4>
        <p>Longhand form.</p>
      </div>

      <h3>Hover zoom on card imagery</h3>
      <a class="demo zoom-card group" href="#zoom-parent-hover">
        <h4>Parent hover scales the card image</h4>
        <img src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='240'%20height='160'%3E%3Crect%20width='240'%20height='160'%20fill='%23cbd5e1'/%3E%3C/svg%3E" width="240" height="160" alt="Card thumbnail that zooms when the card is hovered" />
        <p>A card-wide zoom is the click affordance, not decoration.</p>
      </a>
      <a class="demo zoom-card" href="#zoom-own-hover">
        <h4>Image hover scales the image itself</h4>
        <img src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='240'%20height='160'%3E%3Crect%20width='240'%20height='160'%20fill='%23bfc9d6'/%3E%3C/svg%3E" width="240" height="160" alt="Thumbnail that zooms on its own hover" />
        <p>Same convention, written on the image's own hover state.</p>
      </a>
      <a class="demo group" href="#zoom-utility-classes">
        <h4>Utility classes, restrained magnitude</h4>
        <img class="transition-transform group-hover:scale-[1.04] hover:scale-105" src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='240'%20height='160'%3E%3Crect%20width='240'%20height='160'%20fill='%23b6c2d1'/%3E%3C/svg%3E" width="240" height="160" alt="Thumbnail that zooms through utility classes" />
        <p>A four to five percent lift reads as a pointer cue.</p>
      </a>
    </div>
  </div>
  <script src="/js/detect-antipatterns-browser.js"></script>
</body>
</html>