kitbash Sign in Connect agent
Components

Knocked-about hello

Giant chunky caps where every letter lands at its own angle and offset, a hand-drawn squiggle underline, twinkling sparkles and a short caption. Hovered letters wobble; a click or the button knocks them all over again.

Part of the style

Lid-Off Daydream

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --frame: #334493;
  --fg: #fff2f1;
  --white: #fffafa;
  --ink: #5164aa;
  --glass: rgba(255, 250, 250, 0.1);
  --chip-bg: rgba(255, 250, 250, 0.08);
  --chip-line: rgba(255, 242, 241, 0.3);
  --tick: rgba(255, 250, 250, 0.2);
  --lav: #fdb4b1;
  --sel: #fea8a6;
  --field-purple: #843c3d;
  --sel-deep: #ba2b39;
  --sweater: #270b0b;
  --skin: #ffb4b1;
  --field-blue: #8a3336;
  --field-night: #562324;
  --ball-blue: #d02139;
  --skin-shade: #e98988;
  --coral: #b37a96;
  --field-rose: #815f6f;
  --sun: #fdb4b1;
  --field-plum: #8d5772;
  --mint: #feeceb;
  --go: #cd92af;
  --go-ring: rgba(152, 101, 127, 0.55);
  --water: rgba(250, 161, 159, 0.34);
}
</style>

<section class="hello">
  <div class="hello__stage">
    <span class="hello__dot hello__dot--a" aria-hidden="true"></span>
    <span class="hello__dot hello__dot--b" aria-hidden="true"></span>
    <span class="hello__dot hello__dot--c" aria-hidden="true"></span>
    <svg class="hello__sparkle hello__sparkle--a" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 0C13 8 16 11 24 12C16 13 13 16 12 24C11 16 8 13 0 12C8 11 11 8 12 0Z" /></svg>
    <svg class="hello__sparkle hello__sparkle--b" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 0C13 8 16 11 24 12C16 13 13 16 12 24C11 16 8 13 0 12C8 11 11 8 12 0Z" /></svg>
    <svg class="hello__sparkle hello__sparkle--c" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 0C13 8 16 11 24 12C16 13 13 16 12 24C11 16 8 13 0 12C8 11 11 8 12 0Z" /></svg>
    <svg class="hello__sparkle hello__sparkle--d" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 0C13 8 16 11 24 12C16 13 13 16 12 24C11 16 8 13 0 12C8 11 11 8 12 0Z" /></svg>
    <svg class="hello__sparkle hello__sparkle--e" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 0C13 8 16 11 24 12C16 13 13 16 12 24C11 16 8 13 0 12C8 11 11 8 12 0Z" /></svg>

    <div class="hello__center">
      <h2 class="hello__line" aria-label="Hi, I'm Juno.">
        <span class="hello__word" aria-hidden="true"><span class="hello__ch">H</span><span class="hello__ch hello__ch--small">I</span><span class="hello__ch">,</span></span>
        <span class="hello__word" aria-hidden="true"><span class="hello__ch">I</span><span class="hello__ch">'</span><span class="hello__ch">M</span></span>
        <span class="hello__word" aria-hidden="true"><span class="hello__ch">J</span><span class="hello__ch hello__ch--small">U</span><span class="hello__ch">N</span><span class="hello__ch">O</span><span class="hello__ch">.</span></span>
      </h2>
      <svg class="hello__squiggle" viewBox="0 0 480 40" aria-hidden="true">
        <path pathLength="1" d="M6 22C26 6 46 6 66 22S106 38 126 22S166 6 186 22S226 38 246 22S286 6 306 22S346 38 366 22S406 6 426 22S466 34 474 26" />
      </svg>
      <p class="hello__cap">Nine years drawing interfaces, icons and the odd mascot. I lead design at a small studio that makes tools for kids who code, and I still sketch every screen on paper first.</p>
      <button class="hello__knock" type="button">
        <svg class="hello__knock-icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M16 10a6 6 0 1 1-2-4.5M16 3v4h-4" /></svg>
        Knock it over
      </button>
    </div>
  </div>
</section>

<style>
  .hello {
    padding: var(--bezel);
    background: var(--frame);
  }
  .hello__stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: clamp(540px, 56vw, 800px);
    padding: var(--space-xl) var(--pad);
    overflow: hidden;
    border-radius: var(--r-stage);
    background: var(--field-plum);
    color: var(--fg);
    isolation: isolate;
  }
  .hello__stage::after {
    content: "";
    position: absolute;
    inset: -40%;
    z-index: 4;
    background: var(--grain);
    opacity: var(--grain-strength);
    mix-blend-mode: overlay;
    pointer-events: none;
    animation: hello-film var(--loop-film) steps(1) infinite;
    animation-play-state: var(--hello-film, running);
  }
  .hello__dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--fg);
    opacity: 0.7;
  }
  .hello__dot--a { left: 52%; top: 12%; }
  .hello__dot--b { left: 18%; top: 72%; }
  .hello__dot--c { left: 88%; top: 58%; }
  .hello__sparkle {
    position: absolute;
    width: 22px;
    fill: var(--fg);
    animation: hello-twinkle var(--loop-pulse) ease-in-out infinite alternate;
  }
  .hello__sparkle--a { left: 15%; top: 21%; }
  .hello__sparkle--b { left: 86%; top: 17%; width: 18px; animation-delay: -0.8s; }
  .hello__sparkle--c { left: 76%; top: 66%; width: 26px; animation-delay: -1.6s; }
  .hello__sparkle--d { left: 23%; top: 64%; width: 13px; animation-delay: -0.4s; }
  .hello__sparkle--e { left: 58%; top: 8%; width: 12px; animation-delay: -2s; }

  .hello__center {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    max-width: 100%;
    text-align: center;
  }
  .hello__line {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 0.22em;
    margin: 0;
    color: var(--fg);
    font: 400 var(--text-giant) / var(--lead-tight) var(--font-chunky);
    letter-spacing: 0;
    cursor: pointer;
    user-select: none;
  }
  .hello__word {
    display: inline-flex;
    align-items: baseline;
    white-space: nowrap;
  }
  .hello__ch {
    display: inline-block;
    transform: translateY(var(--hello-y, 0em)) rotate(var(--hello-r, 0deg));
    transition: transform var(--t-settle) var(--ease-out);
    transition-delay: var(--hello-delay, 0ms);
  }
  .hello__ch--small {
    font-size: var(--small-cap);
  }
  .hello.is-knocked .hello__ch {
    transform: translateY(var(--hello-y0, 0.3em)) rotate(var(--hello-r0, 20deg));
    transition: none;
  }
  .hello__ch.is-wobbling {
    animation: hello-wobble 0.6s var(--ease-pop);
  }

  .hello__squiggle {
    width: clamp(180px, 33vw, 480px);
    margin-top: -0.04em;
    fill: none;
    stroke: var(--lav);
    stroke-width: 5;
    stroke-linecap: round;
  }
  .hello__squiggle path {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s var(--ease-out) 0.55s;
  }
  .hello.is-knocked .hello__squiggle path {
    stroke-dashoffset: 1;
    transition: none;
  }
  .hello__cap {
    max-width: 560px;
    margin: var(--space-l) 0 0;
    font: 550 var(--text-cap) / var(--lead-body) var(--font-ui);
    letter-spacing: var(--track-body);
    text-wrap: balance;
  }
  .hello__knock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-top: var(--space-l);
    padding: 0 16px;
    border: var(--line) solid var(--ink);
    border-radius: var(--r-hint);
    background: var(--white);
    box-shadow: var(--shadow-hint);
    color: var(--ink);
    font: 700 var(--text-pill) / 1 var(--font-ui);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform var(--t-quick) var(--ease-out), box-shadow var(--t-quick) var(--ease-out);
  }
  .hello__knock:hover {
    transform: translate(-1px, -1px) rotate(-2deg);
  }
  .hello__knock:active {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 var(--ink);
  }
  .hello__knock:focus-visible {
    outline: var(--line) solid var(--sel);
    outline-offset: 3px;
  }
  .hello__knock-icon {
    width: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  @media (max-width: 40rem) {
    .hello__line { font-size: clamp(84px, 27vw, 140px); row-gap: 0.16em; }
    .hello__sparkle--c { left: 84%; top: 86%; }
    .hello__sparkle--d { left: 8%; top: 52%; }
  }

  @keyframes hello-film {
    0% { transform: translate(0, 0); }
    14% { transform: translate(-7%, 4%); }
    28% { transform: translate(5%, -6%); }
    42% { transform: translate(-3%, -8%); }
    57% { transform: translate(8%, 3%); }
    71% { transform: translate(-6%, 7%); }
    85% { transform: translate(4%, -2%); }
  }
  @keyframes hello-twinkle {
    from { transform: scale(0.7); opacity: 0.35; }
    to { transform: scale(1.1); opacity: 1; }
  }
  @keyframes hello-wobble {
    0% { rotate: 0deg; translate: 0 0; }
    30% { rotate: 14deg; translate: 0 -0.06em; }
    60% { rotate: -9deg; translate: 0 0.02em; }
    85% { rotate: 4deg; }
    100% { rotate: 0deg; translate: 0 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    .hello__stage::after,
    .hello__sparkle {
      animation: none;
    }
    .hello__ch.is-wobbling {
      animation: none;
    }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)');
    const SETTLED_ANGLES = [-4, 3, -2, 5, -3, 2, -5, 3, 4, -2, 3, -4];
    const SETTLED_DROPS = [0, -0.04, 0.03, 0, -0.05, 0.02, 0.04, -0.02, 0.03, -0.03, 0.05, 0];
    const KNOCKED_ANGLES = [-8, 33, -7, -25, -30, -32, 40, -39, -8, 20, 15, -10];
    const STAGGER_MS = 40;

    function knockedPose(index, shuffle) {
      if (!shuffle) return { angle: KNOCKED_ANGLES[index % KNOCKED_ANGLES.length], drop: 0.18 + (index % 3) * 0.1 };
      return { angle: Math.round(Math.random() * 80 - 40), drop: Math.random() * 0.4 - 0.1 };
    }

    function setPoses(letters, shuffle) {
      letters.forEach((letter, index) => {
        const pose = knockedPose(index, shuffle);
        letter.style.setProperty('--hello-r', `${SETTLED_ANGLES[index % SETTLED_ANGLES.length]}deg`);
        letter.style.setProperty('--hello-y', `${SETTLED_DROPS[index % SETTLED_DROPS.length]}em`);
        letter.style.setProperty('--hello-r0', `${pose.angle}deg`);
        letter.style.setProperty('--hello-y0', `${pose.drop}em`);
        letter.style.setProperty('--hello-delay', `${index * STAGGER_MS}ms`);
      });
    }

    function knock(root, letters, shuffle) {
      setPoses(letters, shuffle);
      if (still.matches) return;
      root.classList.add('is-knocked');
      root.getBoundingClientRect();
      requestAnimationFrame(() => requestAnimationFrame(() => root.classList.remove('is-knocked')));
    }

    function setUp(root) {
      const letters = [...root.querySelectorAll('.hello__ch')];
      setPoses(letters, false);
      if (!still.matches) root.classList.add('is-knocked');

      let landed = false;
      new IntersectionObserver(([entry]) => {
        if (entry.isIntersecting && !landed) {
          landed = true;
          requestAnimationFrame(() => root.classList.remove('is-knocked'));
        }
        root.querySelectorAll('.hello__sparkle').forEach((sparkle) => {
          sparkle.style.animationPlayState = entry.isIntersecting ? '' : 'paused';
        });
        root.querySelector('.hello__stage').style.setProperty('--hello-film', entry.isIntersecting ? 'running' : 'paused');
      }).observe(root);

      letters.forEach((letter) => {
        letter.addEventListener('pointerenter', () => {
          if (still.matches || root.classList.contains('is-knocked')) return;
          letter.classList.remove('is-wobbling');
          letter.getBoundingClientRect();
          letter.classList.add('is-wobbling');
        });
        letter.addEventListener('animationend', () => letter.classList.remove('is-wobbling'));
      });

      root.querySelector('.hello__line').addEventListener('click', () => knock(root, letters, true));
      root.querySelector('.hello__knock').addEventListener('click', () => knock(root, letters, true));
    }

    document.querySelectorAll('.hello').forEach(setUp);
  })();
</script>

Similar components

Small caps statement

Small caps statement

Red flood studio

Red flood studio

Case study flood

Case study flood

Project chapter

Project chapter

Black statement

Black statement

Discipline shapes

Discipline shapes

Essay

Essay

Project sheet

Project sheet