kitbash Sign in Connect agent
Components

Creature deck

The signature: a stack of coloured cards, each with a drawn creature that bobs and blinks; arrows or a tap deal the top card off to the right and send it under the stack.

Part of the style

Scattered Paper Cards

7 parts that belong together, with their tokens, type and rules.

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --field: #20201f;
  --on-field: #000000;
  --paper: #000000;
  --paper-bright: #000000;
  --paper-shade: #000000;
  --paper-blue: #000000;
  --ink: #f8e2c6;
  --ink-soft: #656559;
  --line-draw: #131313;
  --creature-dark: #fff4e7;
  --card-sun: #6c6256;
  --card-orange: #544a3d;
  --card-lemon: #706556;
  --creature-cream: #62605d;
  --card-mint: #6c6256;
  --card-aqua: #e8d9c7;
  --field-deep: #3a2f21;
  --card-red: #6c6256;
  --creature-brown: #4f4c47;
  --creature-rust: #6d665c;
}
</style>

<section class="deck" aria-labelledby="deck-title">
  <div class="deck__intro">
    <p class="deck__kicker">The kitchen crew</p>
    <h2 class="deck__title" id="deck-title">Four helpers, one for every noisy job.</h2>
    <p class="deck__text">Tap the stack to deal the next helper. Each one teaches a sound and a skill.</p>
    <div class="deck__controls">
      <button class="deck__ring deck__prev" type="button" aria-label="Previous helper">
        <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M15 5l-7 7 7 7" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" /></svg>
      </button>
      <p class="deck__count" aria-live="polite"><span class="deck__now">01</span> / <span class="deck__all">04</span></p>
      <button class="deck__ring deck__next" type="button" aria-label="Next helper">
        <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M9 5l7 7-7 7" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" /></svg>
      </button>
    </div>
  </div>

  <div class="deck__stack" role="button" tabindex="0" aria-label="Deal the next helper">
    <article class="deck__card deck__card--orange">
      <svg class="deck__creature" viewBox="0 0 200 200" aria-hidden="true">
        <g class="deck__bob">
          <path class="deck__fur" d="M38 132 26 104l24 2-8-28 24 8 2-28 18 16 10-26 12 22 14-20 6 26 20-14-2 28 20-6-8 26 16 6-16 16z" />
          <ellipse class="deck__fur" cx="100" cy="124" rx="66" ry="40" />
          <ellipse class="deck__cream" cx="142" cy="128" rx="34" ry="26" />
          <circle class="deck__rust" cx="176" cy="124" r="8" />
          <g class="deck__eye"><circle class="deck__white" cx="140" cy="114" r="11" /><circle class="deck__pupil" cx="144" cy="114" r="6" /></g>
          <path class="deck__mouth" d="M150 142q8 6 16 0" />
          <ellipse class="deck__fur" cx="80" cy="166" rx="14" ry="7" />
          <ellipse class="deck__fur" cx="128" cy="166" rx="14" ry="7" />
        </g>
        <g class="deck__pencil">
          <path d="M34 186 62 112" />
          <path d="M62 112c-4-22 4-40 18-46 6 14 2 34-18 46zM62 112c2-18 12-30 18-46M62 112c-6-14-2-30 18-46" />
        </g>
      </svg>
      <h3 class="deck__name">Bristle</h3>
      <p class="deck__role">Head whisker · makes the whirr</p>
    </article>

    <article class="deck__card deck__card--mint">
      <svg class="deck__creature" viewBox="0 0 200 200" aria-hidden="true">
        <g class="deck__bob">
          <ellipse class="deck__rust" cx="92" cy="54" rx="7" ry="14" transform="rotate(-20 92 54)" />
          <ellipse class="deck__rust" cx="104" cy="50" rx="7" ry="16" />
          <ellipse class="deck__rust" cx="116" cy="54" rx="7" ry="14" transform="rotate(20 116 54)" />
          <circle class="deck__cream" cx="104" cy="114" r="54" />
          <path class="deck__fur" d="M64 116c-14 10-18 30-6 40 14-4 24-18 22-36z" />
          <path class="deck__rust" d="M148 104l26 10-26 10z" />
          <g class="deck__eye"><circle class="deck__white" cx="126" cy="98" r="12" /><circle class="deck__pupil" cx="130" cy="98" r="6.5" /></g>
          <path class="deck__legs" d="M88 166v18m-8 0h16M120 166v18m-8 0h16" />
        </g>
        <g class="deck__pencil">
          <ellipse cx="44" cy="70" rx="14" ry="18" />
          <path d="M44 88v58" />
        </g>
      </svg>
      <h3 class="deck__name">Pip</h3>
      <p class="deck__role">Egg inspector · does the crack</p>
    </article>

    <article class="deck__card deck__card--red">
      <svg class="deck__creature" viewBox="0 0 200 200" aria-hidden="true">
        <g class="deck__bob">
          <path class="deck__cream" d="M24 156q8-24 44-22h84q20 0 22-28 2-14 12-10 4 30-8 60z" />
          <circle class="deck__fur" cx="96" cy="100" r="48" />
          <path class="deck__spiral" d="M96 100m-6 0a6 6 0 1 1 12 0 14 14 0 1 1-28 0 22 22 0 1 1 44 0 32 32 0 1 1-64 0" />
          <path class="deck__legs" d="M176 98l-6-30M188 102l4-30" />
          <g class="deck__eye"><circle class="deck__white" cx="170" cy="64" r="9" /><circle class="deck__pupil" cx="172" cy="64" r="5" /></g>
          <circle class="deck__pupil" cx="192" cy="70" r="5" />
        </g>
      </svg>
      <h3 class="deck__name">Mo</h3>
      <p class="deck__role">Slow cooker · hums for hours</p>
    </article>

    <article class="deck__card deck__card--sun">
      <svg class="deck__creature" viewBox="0 0 200 200" aria-hidden="true">
        <g class="deck__bob">
          <path class="deck__rust" d="M150 104l40-34v68z" />
          <ellipse class="deck__rust" cx="96" cy="104" rx="64" ry="44" />
          <path class="deck__stripe" d="M80 64q-12 40 0 80M106 62q-12 42 0 84" />
          <path class="deck__fur" d="M92 60q16-26 40-18-10 14-28 22z" />
          <g class="deck__eye"><circle class="deck__white" cx="56" cy="92" r="12" /><circle class="deck__pupil" cx="52" cy="92" r="6.5" /></g>
          <ellipse class="deck__pupil" cx="40" cy="120" rx="7" ry="9" />
        </g>
        <g class="deck__pencil">
          <circle cx="40" cy="166" r="6" /><circle cx="22" cy="150" r="4" /><circle cx="30" cy="132" r="3" />
        </g>
      </svg>
      <h3 class="deck__name">Gulp</h3>
      <p class="deck__role">Soup taster · says the slurp</p>
    </article>
  </div>
</section>

<style>
  .deck {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: center;
    gap: var(--space-xl);
    padding: var(--section-space) var(--edge);
    overflow: hidden;
    background: var(--field);
    color: var(--on-field);
  }
  .deck__kicker {
    margin: 0 0 var(--space-m);
    font: 600 var(--text-s)/1 var(--font-display);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .deck__title {
    margin: 0 0 var(--space-m);
    font: 700 var(--text-xl)/1.02 var(--font-display);
    letter-spacing: -0.01em;
    text-wrap: balance;
  }
  .deck__text { margin: 0 0 var(--space-l); max-width: 34ch; }
  .deck__controls { display: flex; align-items: center; gap: var(--space-m); }
  .deck__count { margin: 0; min-width: 5ch; text-align: center; font: 600 var(--text-m)/1 var(--font-display); }
  .deck__ring {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: var(--ring) solid currentColor;
    border-radius: var(--pill);
    background: transparent;
    color: var(--on-field);
    cursor: pointer;
    transition: background-color var(--quick) var(--ease), color var(--quick) var(--ease), transform var(--settle) var(--ease-pop);
  }
  .deck__ring:hover,
  .deck__ring:focus-visible { background: var(--on-field); color: var(--field); outline: none; }
  .deck__prev:hover { transform: translateX(-3px) rotate(-8deg); }
  .deck__next:hover { transform: translateX(3px) rotate(8deg); }

  .deck__stack {
    position: relative;
    display: grid;
    width: min(400px, 100%);
    justify-self: center;
    cursor: pointer;
    outline: none;
  }
  .deck__stack:focus-visible .deck__card[data-pos="0"] { box-shadow: inset 0 0 0 4px var(--ink); }
  .deck__card {
    grid-area: 1 / 1;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: var(--space-s);
    aspect-ratio: 5 / 6;
    padding: var(--space-l);
    color: var(--ink);
    text-align: center;
    clip-path: var(--quad-a);
    z-index: calc(10 - var(--pos, 0));
    transition: rotate var(--settle) var(--ease-pop), translate var(--settle) var(--ease-pop);
  }
  .deck__card[data-pos="0"] { rotate: 3deg; }
  .deck__card[data-pos="1"] { rotate: -5deg; translate: -14px 8px; clip-path: var(--quad-b); }
  .deck__card[data-pos="2"] { rotate: 8deg; translate: 18px 12px; clip-path: var(--quad-c); }
  .deck__card[data-pos="3"] { rotate: -11deg; translate: -8px 20px; }
  .deck__card--orange { background: var(--card-orange); }
  .deck__card--mint { background: var(--card-mint); }
  .deck__card--red { background: var(--card-red); }
  .deck__card--sun { background: var(--card-sun); }
  .deck__card.is-leaving { animation: deck-deal var(--deal) var(--ease) forwards; z-index: 11; }
  .deck__card.is-arriving { animation: deck-back var(--deal) var(--ease-pop); z-index: 11; }
  @keyframes deck-deal {
    40% { translate: 70% -6%; rotate: 18deg; }
    100% { translate: -8px 20px; rotate: -11deg; z-index: 0; }
  }
  @keyframes deck-back {
    from { translate: -70% -6%; rotate: -18deg; }
  }

  .deck__creature { width: 72%; height: auto; overflow: visible; }
  .deck__bob { animation: deck-bob 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
  .deck__eye { animation: deck-blink 4s infinite; transform-box: fill-box; transform-origin: center; }
  .deck.is-paused .deck__bob,
  .deck.is-paused .deck__eye { animation-play-state: paused; }
  @keyframes deck-bob {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-6px) rotate(-2deg); }
  }
  @keyframes deck-blink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
  }
  .deck__fur { fill: var(--creature-brown); }
  .deck__cream { fill: var(--creature-cream); }
  .deck__rust { fill: var(--creature-rust); }
  .deck__white { fill: var(--paper-bright); }
  .deck__pupil { fill: var(--creature-dark); }
  .deck__mouth, .deck__legs { fill: none; stroke: var(--creature-dark); stroke-width: 4; stroke-linecap: round; }
  .deck__spiral, .deck__stripe { fill: none; stroke: var(--creature-cream); stroke-width: 7; stroke-linecap: round; }
  .deck__pencil { fill: none; stroke: var(--ink-soft); stroke-width: var(--line); stroke-linecap: round; }
  .deck__name { margin: 0; font: 700 var(--text-xl)/1 var(--font-display); }
  .deck__role { margin: 0; font: 600 var(--text-s)/1.3 var(--font-display); }

  @media (max-width: 48rem) {
    .deck { grid-template-columns: minmax(0, 1fr); }
    .deck__stack { width: min(320px, 86%); order: -1; }
  }
  @media (prefers-reduced-motion: reduce) {
    .deck__bob, .deck__eye, .deck__card.is-leaving, .deck__card.is-arriving { animation: none; }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)');
    const watch = new IntersectionObserver((entries) => {
      for (const entry of entries) entry.target.classList.toggle('is-paused', !entry.isIntersecting);
    });
    for (const root of document.querySelectorAll('.deck')) {
      const stack = root.querySelector('.deck__stack');
      const now = root.querySelector('.deck__now');
      const all = root.querySelector('.deck__all');
      if (!stack) continue;
      watch.observe(root);
      const original = [...stack.querySelectorAll('.deck__card')];
      let cards = [...original];
      const pad = (n) => String(n).padStart(2, '0');
      if (all) all.textContent = pad(cards.length);
      const place = () => {
        cards.forEach((card, i) => {
          card.dataset.pos = String(Math.min(i, 3));
          card.style.setProperty('--pos', i);
          card.setAttribute('aria-hidden', i === 0 ? 'false' : 'true');
        });
        if (now) now.textContent = pad(original.indexOf(cards[0]) + 1);
      };
      place();
      let busy = false;
      const next = () => {
        if (busy) return;
        const top = cards[0];
        const done = () => { top.classList.remove('is-leaving'); cards = [...cards.slice(1), top]; place(); busy = false; };
        if (still.matches) return done();
        busy = true;
        top.classList.add('is-leaving');
        top.addEventListener('animationend', done, { once: true });
      };
      const prev = () => {
        if (busy) return;
        const last = cards[cards.length - 1];
        cards = [last, ...cards.slice(0, -1)];
        place();
        if (still.matches) return;
        busy = true;
        last.classList.add('is-arriving');
        last.addEventListener('animationend', () => { last.classList.remove('is-arriving'); busy = false; }, { once: true });
      };
      stack.addEventListener('click', next);
      stack.addEventListener('keydown', (e) => {
        if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); next(); }
      });
      root.querySelector('.deck__next')?.addEventListener('click', next);
      root.querySelector('.deck__prev')?.addEventListener('click', prev);
    }
  })();
</script>

Similar components

Featured tile rail

Featured tile rail

Spiral gallery

Spiral gallery

Bracketed Exhibits

Bracketed Exhibits

Badge carousel

Badge carousel

Section card slider

Section card slider

Latest work rail

Latest work rail

Spread

Spread

Loose project grid

Loose project grid