kitbash Sign in Connect agent
Components

Block reveal intro

A black stage where square blocks fall away in stair steps to uncover a night photograph and a two-line wordmark that pops in letter by letter; a Replay pill plays it again.

Part of the style

Hazard Diamond Arcade

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

Preview

Code
<section class="intro" aria-label="Opening">
  <div class="intro__stage">
    <img class="intro__picture" src="assets/wheel-night.jpg" alt="A lit ferris wheel turning against the night sky" width="1200" height="900">
    <div class="intro__shade" aria-hidden="true"></div>
    <div class="intro__blocks" aria-hidden="true"></div>
    <h1 class="intro__wordmark">
      <span class="intro__line">Clonk</span>
      <span class="intro__line intro__line--shift">Club</span>
    </h1>
    <p class="intro__note">Night league · bumper cars · season 04</p>
    <button class="intro__replay" type="button">
      <svg class="intro__replay-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12a8 8 0 1 0 2.4-5.7M4 4v5h5" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
      Replay
    </button>
  </div>
</section>

<style>
  .intro {
    background: var(--night);
    color: var(--ink);
  }
  .intro__stage {
    position: relative;
    display: grid;
    place-items: center;
    height: clamp(30rem, 62vw, 45rem);
    overflow: hidden;
    isolation: isolate;
  }
  .intro__picture {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: 50% 40%;
    z-index: -3;
  }
  .intro__shade {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: radial-gradient(ellipse at 50% 50%, transparent 30%, var(--night) 92%);
    opacity: 0.85;
  }
  .intro__blocks {
    position: absolute;
    inset: -1px;
    z-index: -1;
    display: grid;
    grid-template-columns: repeat(var(--cols, 12), 1fr);
    grid-auto-rows: 1fr;
  }
  .intro__block {
    background: var(--night);
    transition: opacity 1ms steps(1) calc(var(--d, 0) * var(--step));
  }
  .intro.is-open .intro__block {
    opacity: 0;
  }
  .intro__wordmark {
    margin: 0;
    display: grid;
    justify-items: center;
    font-family: var(--font-display);
    font-stretch: var(--wide);
    font-style: italic;
    font-weight: 900;
    font-size: var(--display-xl);
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .intro__line--shift {
    translate: 0.18em 0;
  }
  .intro__letter {
    display: inline-block;
    opacity: 0;
  }
  .intro.is-open .intro__letter {
    animation: intro-pop var(--pop) var(--ease) both, intro-heat 900ms var(--ease-in-out) both;
    animation-delay: calc(300ms + var(--i) * var(--step)), calc(700ms + var(--i) * var(--step));
  }
  @keyframes intro-pop {
    from { opacity: 0; scale: 1.8; filter: blur(6px); }
    to { opacity: 1; scale: 1; filter: blur(0); }
  }
  @keyframes intro-heat {
    from { color: var(--ink); }
    to { color: var(--accent); }
  }
  .intro__note {
    position: absolute;
    left: var(--edge);
    bottom: var(--edge);
    margin: 0;
    max-width: 16rem;
    font-size: var(--text-s);
    font-weight: 700;
    letter-spacing: var(--track);
    text-transform: uppercase;
    color: var(--ink);
  }
  .intro__replay {
    position: absolute;
    right: var(--edge);
    bottom: calc(var(--edge) - 0.75rem);
    display: inline-flex;
    align-items: center;
    gap: var(--space-s);
    min-height: 44px;
    padding: 0 var(--space-m) 0 0.75rem;
    border: 0;
    border-radius: var(--pill);
    background: var(--paper);
    color: var(--ink-dark);
    font: italic 800 var(--text-s) / 1 var(--font-display);
    font-stretch: var(--wide);
    letter-spacing: var(--track);
    text-transform: uppercase;
    cursor: pointer;
    transition: scale var(--quick) var(--ease), background-color var(--quick) var(--ease);
  }
  .intro__replay:hover,
  .intro__replay:focus-visible {
    background: var(--accent);
  }
  .intro__replay:focus-visible {
    outline: var(--line) solid var(--ink);
    outline-offset: 3px;
  }
  .intro__replay:active {
    scale: 0.94;
  }
  .intro__replay-icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  @media (max-width: 40rem) {
    .intro__stage {
      height: clamp(32rem, 150vw, 40rem);
    }
    .intro__note {
      max-width: 10rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .intro__block { display: none; }
    .intro__letter { opacity: 1; color: var(--accent); }
    .intro.is-open .intro__letter { animation: none; }
  }
</style>

<script>
(() => {
  const still = matchMedia('(prefers-reduced-motion: reduce)');

  function setup(root) {
    const blocks = root.querySelector('.intro__blocks');
    const stage = root.querySelector('.intro__stage');
    let count = 0;
    root.querySelectorAll('.intro__line').forEach((line) => {
      const word = line.textContent.trim();
      line.setAttribute('aria-label', word);
      line.textContent = '';
      for (const character of word) {
        const letter = document.createElement('span');
        letter.className = 'intro__letter';
        letter.setAttribute('aria-hidden', 'true');
        letter.style.setProperty('--i', count++);
        letter.textContent = character;
        line.append(letter);
      }
    });

    const build = () => {
      const cols = stage.clientWidth < 640 ? 6 : 12;
      const size = stage.clientWidth / cols;
      const rows = Math.ceil(stage.clientHeight / size);
      blocks.style.setProperty('--cols', cols);
      blocks.replaceChildren();
      for (let r = 0; r < rows; r++) {
        for (let c = 0; c < cols; c++) {
          const block = document.createElement('i');
          block.className = 'intro__block';
          const dx = Math.abs(c + 0.5 - cols / 2);
          const dy = Math.abs(r + 0.5 - rows / 2);
          block.style.setProperty('--d', Math.round(dx * 0.8 + dy * 1.3));
          blocks.append(block);
        }
      }
    };

    const play = () => {
      root.classList.remove('is-open');
      void root.offsetWidth;
      requestAnimationFrame(() => requestAnimationFrame(() => root.classList.add('is-open')));
    };

    build();
    if (still.matches) root.classList.add('is-open');
    else play();
    root.querySelector('.intro__replay').addEventListener('click', () => {
      build();
      play();
    });
  }

  document.querySelectorAll('.intro').forEach(setup);
})();
</script>

Similar components

Yellow curtain opener

Yellow curtain opener

Print burst intro

Print burst intro

Blur-in statement

Blur-in statement

Spiral intro

Spiral intro

Boot screen

Boot screen

Greeting loader

Greeting loader

Thumbnail ring loader

Thumbnail ring loader

Spine opening

Spine opening