kitbash Sign in Connect agent
Components

Tilting statement

Dark walnut band with caps on the left, a round object tilting with scroll in the middle and words lighting up on the right.

Part of the style

Cutting Mat Desk

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --page: #4a666d;
  --night: #001115;
  --cream: #f0f6f9;
  --cream-line: rgba(240, 246, 249, 0.302);
  --shade: rgba(61, 89, 95, 0.922);
  --signal: #c1e4f0;
  --cream-soft: rgba(243, 250, 252, 0.502);
  --paper: #f2fafd;
  --desk: #616c70;
  --desk-deep: #555b5d;
  --signal-glow: rgba(96, 128, 138, 0.2);
  --umber: #4f5557;
  --mat: #54747e;
  --mat-deep: #4e6f7a;
  --cream-veil: rgba(155, 189, 200, 0.11);
}
</style>

<section class="statement">
  <h2 class="statement__caps statement__words">More than<br />a compass.</h2>
  <div class="statement__object">
    <img class="statement__photo" src="assets/compass-field.jpg" alt="A field compass with a white dial set in an open wooden case" width="800" height="533" />
  </div>
  <p class="statement__copy statement__words">Norrow is not just a needle in a box. It is four winters of tuning, a jewelled pivot and a dial you can read by candle.</p>
  <p class="statement__foot">Hand-finished <em class="statement__note">in brass and walnut</em></p>
</section>

<style>
  .statement {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: center;
    gap: var(--gap);
    min-height: clamp(560px, 50vw, 760px);
    padding: var(--section-space) var(--edge);
    background: var(--page);
    color: var(--cream);
    perspective: 1200px;
  }
  .statement__caps {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 500;
    line-height: 1.04;
    text-transform: uppercase;
    justify-self: end;
  }
  .statement__copy {
    max-width: 17ch;
    margin: 0;
    font-size: var(--text-m);
    font-weight: 500;
    line-height: 1.33;
  }
  .statement__word {
    color: var(--cream-soft);
    transition: color var(--slow) var(--ease-plain);
    transition-delay: calc(var(--order) * 60ms);
  }
  .statement.is-seen .statement__word {
    color: var(--cream);
  }
  .statement__object {
    justify-self: center;
    width: min(100%, 420px);
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 40px 60px -20px var(--shade), inset 0 0 0 var(--rule) var(--cream-line);
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
    transition: transform 120ms linear;
  }
  .statement__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 42% 50%;
    transform: translate(8%, -17%) scale(2.9);
    transform-origin: 42% 67%;
  }
  .statement__foot {
    position: absolute;
    right: var(--edge);
    bottom: var(--space-l);
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    color: var(--cream-soft);
  }
  .statement__note {
    font-family: var(--font-note);
    font-size: var(--text-s);
    text-transform: none;
  }

  @media (max-width: 720px) {
    .statement {
      grid-template-columns: minmax(0, 1fr);
      justify-items: center;
      text-align: center;
      gap: var(--space-l);
    }
    .statement__caps { justify-self: center; }
    .statement__object { width: min(80vw, 320px); }
    .statement__copy { max-width: 26ch; }
    .statement__foot { position: static; }
  }

  @media (prefers-reduced-motion: reduce) {
    .statement__word { color: var(--cream); transition: none; }
    .statement__object { transform: none; }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)');
    const seen = new IntersectionObserver((entries) => {
      for (const entry of entries) {
        if (!entry.isIntersecting) continue;
        entry.target.classList.add('is-seen');
        seen.unobserve(entry.target);
      }
    }, { threshold: 0.15 });

    document.querySelectorAll('.statement').forEach((root) => {
      let order = 0;
      for (const block of root.querySelectorAll('.statement__words')) {
        const walker = document.createTreeWalker(block, NodeFilter.SHOW_TEXT);
        const texts = [];
        while (walker.nextNode()) texts.push(walker.currentNode);
        for (const text of texts) {
          const parts = text.textContent.split(/(\s+)/);
          const bits = document.createDocumentFragment();
          for (const part of parts) {
            if (!part.trim()) { bits.append(part); continue; }
            const word = document.createElement('span');
            word.className = 'statement__word';
            word.style.setProperty('--order', order++);
            word.textContent = part;
            bits.append(word);
          }
          text.replaceWith(bits);
        }
      }
      seen.observe(root);

      const object = root.querySelector('.statement__object');
      let frame = 0;
      const tilt = () => {
        frame = 0;
        if (still.matches) return;
        const box = root.getBoundingClientRect();
        const view = innerHeight || 720;
        const progress = Math.min(1, Math.max(0, (view - box.top) / (view + box.height)));
        root.style.setProperty('--tilt-x', `${((progress - 0.5) * 50).toFixed(2)}deg`);
        root.style.setProperty('--tilt-y', `${((0.5 - progress) * 30).toFixed(2)}deg`);
      };
      const ask = () => { if (!frame) frame = requestAnimationFrame(tilt); };
      new IntersectionObserver(([entry]) => {
        if (entry.isIntersecting) { addEventListener('scroll', ask, { passive: true }); ask(); }
        else removeEventListener('scroll', ask);
      }).observe(object);
    });
  })();
</script>

Similar components

Statement

Statement

Black half, photo half

Black half, photo half

Window glimpse and statement

Window glimpse and statement

Night Room Statement

Night Room Statement

Matted diff feature

Matted diff feature

Centred statement

Centred statement

Letter and footer

Letter and footer

Plain statement

Plain statement