kitbash Sign in Connect agent
Components

Letter gathering intro

A white screen where the brand's letters fade in as a small centred cluster, then drift out to the corners and the bottom edge; a replay link sits in the middle.

Part of the style

Corner Serif Frame

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --ink: #111311;
  --ink-soft: #636963;
  --paper: #fcf6e6;
  --veil: rgba(252, 246, 230, 0.3);
  --wash: #ebe6d7;
}
</style>

<section class="intro" aria-label="Opening">
  <p class="intro__word">Nauve</p>
  <div class="intro__middle">
    <p class="intro__line">Period rooms at one twelfth of their size, built by hand.</p>
    <button class="intro__replay" type="button">Replay</button>
  </div>
</section>

<style>
  .intro {
    position: relative;
    height: clamp(560px, 62vw, 860px);
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
  }
  .intro__word {
    position: absolute;
    inset: 0;
    margin: 0;
    font-family: var(--font-letter);
    font-size: var(--letter);
    font-weight: 400;
    line-height: 1;
    text-transform: uppercase;
  }
  .intro__letter {
    position: absolute;
    left: calc(50% + (var(--u) - 0.5) * var(--intro-spread, 7.2em));
    top: calc(50% + (var(--v) - 0.5) * 1.3em);
    translate: calc(var(--u) * -100%) calc(var(--v) * -100%);
    opacity: 0;
    transition:
      opacity 600ms linear calc(var(--i) * 120ms),
      left var(--slow) var(--ease),
      top var(--slow) var(--ease);
  }
  .intro.is-in .intro__letter {
    opacity: 1;
  }
  .intro.is-spread .intro__letter {
    left: calc(var(--edge) + var(--u) * (100% - 2 * var(--edge)));
    top: calc(var(--edge) + var(--v) * (100% - 2 * var(--edge)));
    transition-delay: 0ms, calc(var(--i) * 40ms), calc(var(--i) * 40ms);
  }
  .intro__middle {
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    display: grid;
    justify-items: center;
    gap: var(--space-s);
    width: min(28ch, 70%);
    text-align: center;
    opacity: 0;
    transition: opacity var(--time) var(--ease-fade);
    pointer-events: none;
  }
  .intro.is-spread .intro__middle {
    opacity: 1;
    transition-delay: 600ms;
    pointer-events: auto;
  }
  .intro__line {
    margin: 0;
    font-size: var(--text-s);
    line-height: var(--leading);
  }
  .intro__replay {
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--space-m);
    border: 0;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: var(--text-s);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color var(--quick) var(--ease-fade);
  }
  .intro__replay:hover,
  .intro__replay:focus-visible {
    color: var(--ink);
  }
  .intro__replay:focus-visible {
    outline: var(--rule) solid var(--ink);
  }

  @media (max-width: 600px) {
    .intro {
      height: clamp(560px, 150vw, 760px);
    }
    .intro__word {
      font-size: var(--letter-l);
      --intro-spread: 4.2em;
    }
    .intro__line {
      font-size: var(--text-m);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .intro__letter,
    .intro__middle {
      transition: none;
    }
  }
</style>

<script>
  (() => {
    // Split the word into letters: the first two go to the top corners, the rest spread along the bottom.
    const spread = (el) => {
      const word = el.textContent.trim();
      const chars = [...word].filter((c) => c.trim());
      el.setAttribute('aria-label', word);
      el.textContent = '';
      const n = chars.length;
      chars.forEach((c, i) => {
        let u = 0;
        let v = 0;
        if (n === 1) u = 0.5;
        else if (i < 2) u = i;
        else {
          const m = n - 2;
          u = m > 1 ? (i - 2) / (m - 1) : 0.5;
          v = 1;
        }
        const span = document.createElement('span');
        span.className = 'intro__letter';
        span.setAttribute('aria-hidden', 'true');
        span.textContent = c;
        span.style.cssText = `--u:${u};--v:${v};--i:${i}`;
        el.append(span);
      });
    };
    const still = matchMedia('(prefers-reduced-motion: reduce)').matches;
    document.querySelectorAll('.intro').forEach((root) => {
      const word = root.querySelector('.intro__word');
      if (word) spread(word);
      let timer = 0;
      const play = () => {
        clearTimeout(timer);
        root.classList.remove('is-in', 'is-spread');
        if (still) {
          root.classList.add('is-in', 'is-spread');
          return;
        }
        void root.offsetWidth;
        requestAnimationFrame(() => {
          root.classList.add('is-in');
          timer = setTimeout(() => root.classList.add('is-spread'), 1200);
        });
      };
      const seen = new IntersectionObserver((entries) => {
        if (entries.some((e) => e.isIntersecting)) {
          seen.disconnect();
          play();
        }
      }, { threshold: 0.2 });
      seen.observe(root);
      root.querySelector('.intro__replay')?.addEventListener('click', play);
    });
  })();
</script>

Similar components

Thumbnail ring loader

Thumbnail ring loader

Print burst intro

Print burst intro

Ticker loader

Ticker loader

Blur-in statement

Blur-in statement

Badge intro

Badge intro

Lens-scale intro

Lens-scale intro

Wordmark intro

Wordmark intro

Scramble loader

Scramble loader