kitbash Sign in Connect agent
Components

About

Round mosaic portrait, a 1940s public domain photograph printed on canvas in two inks (bark and sky), that sharpens in steps when seen, an underlined uppercase name and a one-sentence introduction in large mono.

Part of the style

Reed Mono Chapters

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --reed: #1a1612;
  --bark: #d3ab83;
  --sand: #080503;
  --night: #e5bd94;
  --chalk: #181410;
  --chalk-dim: #000000;
  --shade: rgba(254, 229, 205, 0.28);
  --bark-veil: rgba(211, 171, 131, 0.2);
  --olive: #987b69;
  --mustard: #2d1302;
  --harbor: #ad7e5c;
  --sky: #563c29;
  --signal: #684e3d;
  --skin: #483f3a;
  --hair: #130f0d;
  --teal: #ad7e5c;
}
</style>

<section class="about">
  <div class="about__inner">
    <canvas class="about__portrait" role="img" aria-label="Portrait of Ada Pell, printed in two inks"></canvas>
    <img class="about__photo" src="assets/ada-portrait.jpg" alt="" width="570" height="600" hidden>
    <div class="about__text">
      <h2 class="about__name">Ada Pell</h2>
      <p class="about__lede">I design the signs that get people from the ferry to the water. Every arrow on North Pier was drawn at this desk.</p>
    </div>
  </div>
</section>

<style>
  .about {
    padding: var(--space-wall) var(--edge);
    background: var(--reed);
    color: var(--bark);
  }
  .about__inner {
    display: grid;
    grid-template-columns: auto minmax(0, var(--measure));
    align-items: end;
    justify-content: center;
    gap: var(--space-7);
  }
  .about__portrait {
    width: clamp(7rem, 4rem + 9vw, 13rem);
    aspect-ratio: 1;
    border-radius: 50%;
    image-rendering: pixelated;
  }
  .about__photo {
    display: none;
  }
  .about__name {
    display: inline-block;
    margin: 0 0 var(--space-4);
    padding-bottom: 0.15em;
    border-bottom: var(--rule) solid currentColor;
    font-size: var(--text-m);
    font-weight: 500;
    letter-spacing: var(--tracking-caps);
    line-height: 1;
    text-transform: uppercase;
  }
  .about__lede {
    margin: 0;
    font-size: var(--text-xl);
    letter-spacing: var(--tracking-tight);
    line-height: 1.25;
  }

  @media (max-width: 40rem) {
    .about__inner { grid-template-columns: minmax(0, 1fr); }
  }
</style>

<script>
  (() => {
    const still = matchMedia('(prefers-reduced-motion: reduce)').matches;
    const steps = [7, 11, 18, 30, 64, 128];
    const stepTime = 220;
    const FACE = { x: 0.16, y: 0.17, size: 0.58 };

    function readInks(element) {
      const style = getComputedStyle(element);
      return { light: style.getPropertyValue('--sky').trim(), dark: style.getPropertyValue('--bark').trim() };
    }

    // The photograph as a two-ink print: grey tones run from the dark ink to the light one.
    function printPhoto(context, size, photo, inks) {
      const side = Math.min(photo.naturalWidth, photo.naturalHeight) * FACE.size;
      context.filter = 'grayscale(1) contrast(1.25) brightness(1.05)';
      context.drawImage(photo, photo.naturalWidth * FACE.x, photo.naturalHeight * FACE.y, side, side, 0, 0, size, size);
      context.filter = 'none';
      context.globalCompositeOperation = 'screen';
      context.fillStyle = inks.dark;
      context.fillRect(0, 0, size, size);
      context.globalCompositeOperation = 'multiply';
      context.fillStyle = inks.light;
      context.fillRect(0, 0, size, size);
      context.globalCompositeOperation = 'source-over';
    }

    function setUp(canvas, photo) {
      const context = canvas.getContext('2d');
      const source = document.createElement('canvas');
      source.width = source.height = 256;
      printPhoto(source.getContext('2d'), 256, photo, readInks(canvas));

      const showAt = (blocks) => {
        canvas.width = canvas.height = blocks;
        context.imageSmoothingEnabled = true;
        context.drawImage(source, 0, 0, blocks, blocks);
      };

      if (still) { showAt(steps.at(-1)); return; }
      showAt(steps[0]);
      new IntersectionObserver(([entry], observer) => {
        if (!entry.isIntersecting) return;
        observer.disconnect();
        steps.forEach((blocks, index) => setTimeout(() => showAt(blocks), 300 + index * stepTime));
      }, { threshold: 0.3 }).observe(canvas);
    }

    document.querySelectorAll('.about').forEach((root) => {
      const canvas = root.querySelector('.about__portrait');
      const photo = root.querySelector('.about__photo');
      const start = () => setUp(canvas, photo);
      if (photo.complete && photo.naturalWidth) start();
      else photo.addEventListener('load', start, { once: true });
    });
  })();
</script>

Similar components

About with cut-out portrait

About with cut-out portrait

Author

Author

Team and biographies

Team and biographies

Lineup tiles

Lineup tiles

Ruled hero

Ruled hero

Pink voice card

Pink voice card

Ringed services

Ringed services

Red flood studio

Red flood studio