kitbash Sign in Connect agent
Components

Work globe

Work and the year range at the two edges and a turning sphere of drawn project tiles between them; tiles at the back shrink, blur and dim, the sphere can be dragged, and the front tile names itself.

Part of the style

Ink Bloom Column

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

Preview

Code
<style>
/* Goes after the pack's base.css */
:root {
  --paper: #000000;
  --ink: #ffffff;
  --mist: #000000;
  --tint: rgba(255, 255, 255, 0.05);
  --hairline: rgba(255, 255, 255, 0.1);
  --ink-ghost: rgba(255, 255, 255, 0.1);
  --ink-soft: rgba(255, 255, 255, 0.5);
  --menu-1: #0c0c0c;
  --menu-2: #050505;
  --menu-3: #010101;
  --theme-slate: #131313;
  --on-ink: #000000;
  --theme-ember: #023bfd;
  --theme-oxblood: #0127ab;
  --theme-lichen: #023bfd;
}
</style>

<section class="globe" aria-label="Selected work">
  <h2 class="globe__word" data-goo>Work</h2>
  <p class="globe__years" data-goo>24&ndash;26</p>
  <canvas class="globe__canvas" role="img" aria-label="A turning sphere of project tiles. Drag to spin it."></canvas>
  <p class="globe__caption" aria-live="polite"><span class="globe__index">(01)</span> <span class="globe__title">Ferry Hall, waiting room tone</span></p>
</section>

<style>
  .globe {
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    column-gap: var(--gap);
    align-items: center;
    height: max(520px, 62.5vw);
    padding: var(--edge);
    overflow: clip;
    background: var(--paper);
  }
  .globe__word,
  .globe__years {
    position: relative;
    z-index: 1;
    margin: 0;
    grid-row: 1;
    font-size: var(--text-xl);
    font-weight: inherit;
    line-height: var(--leading-xl);
    letter-spacing: var(--tracking-xl);
    pointer-events: none;
  }
  .globe__word { grid-column: 1 / span 2; }
  .globe__years { grid-column: 7 / -1; justify-self: end; }
  .globe__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: pan-y;
  }
  .globe.is-dragging .globe__canvas { cursor: grabbing; }
  .globe__canvas:focus-visible { outline: var(--stroke) solid var(--ink); outline-offset: -6px; }
  .globe__caption {
    position: absolute;
    left: 50%;
    bottom: var(--edge);
    margin: 0;
    translate: -50% 0;
    white-space: nowrap;
    pointer-events: none;
  }
  .globe__index { color: var(--ink-soft); }

  @media (max-width: 47.99rem) {
    .globe {
      grid-template-columns: repeat(4, minmax(0, 1fr));
      align-items: start;
      height: max(560px, 160vw);
    }
    .globe__word { grid-column: 1 / -1; grid-row: 1; padding-top: var(--space-l); }
    .globe__years { grid-column: 1 / -1; grid-row: 1; align-self: end; justify-self: end; margin-bottom: var(--space-l); }
    .globe { grid-template-rows: 1fr; }
    .globe__caption { white-space: normal; text-align: center; width: calc(100% - 2 * var(--edge)); }
  }
</style>

<script>
(() => {
  /* Goo reveal: each line starts as a heavy blur through a hard alpha threshold and grows out of ink blobs.
     Blocks marked data-goo reveal when they come into view; their data-line children follow each other. */
  function revealOnView(root) {
    if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
    const styles = getComputedStyle(root);
    const time = (name) => parseFloat(styles.getPropertyValue(name)) * 1000;
    const durL = time('--dur-l'), stagger = time('--stagger');
    const most = parseFloat(styles.getPropertyValue('--goo-blur'));
    const [x1, y1, x2, y2] = styles.getPropertyValue('--ease-out').match(/-?[\d.]+/g).map(Number);
    const curve = (a, b, t) => 3 * a * t * (1 - t) ** 2 + 3 * b * t * t * (1 - t) + t ** 3;
    const easeOut = (x) => {
      let low = 0, high = 1, t = x;
      for (let step = 0; step < 24; step += 1) { t = (low + high) / 2; if (curve(x1, x2, t) < x) low = t; else high = t; }
      return curve(y1, y2, t);
    };
    const defs = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
    defs.setAttribute('aria-hidden', 'true');
    defs.style.cssText = 'position:absolute;width:0;height:0;overflow:hidden';
    root.prepend(defs);
    const prepare = (line) => {
      const ns = 'http://www.w3.org/2000/svg';
      const filter = document.createElementNS(ns, 'filter');
      const blur = document.createElementNS(ns, 'feGaussianBlur');
      const matrix = document.createElementNS(ns, 'feColorMatrix');
      filter.id = `globe-goo-${Math.random().toString(36).slice(2, 9)}`;
      Object.entries({ x: '-25%', y: '-25%', width: '150%', height: '150%', 'color-interpolation-filters': 'sRGB' }).forEach(([key, value]) => filter.setAttribute(key, value));
      blur.setAttribute('in', 'SourceGraphic');
      matrix.setAttribute('type', 'matrix');
      filter.append(blur, matrix);
      defs.append(filter);
      const scale = Math.max(0.3, parseFloat(getComputedStyle(line).fontSize) / 90);
      line._goo = (deviation, amp, offset) => {
        blur.setAttribute('stdDeviation', (deviation * scale).toFixed(2));
        matrix.setAttribute('values', `1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 ${amp} ${offset}`);
      };
      line._goo(most, 20, -8);
      line.style.filter = `url(#${filter.id})`;
    };
    const play = (line, delay) => {
      const begin = performance.now() + delay;
      const frame = (now) => {
        const elapsed = now - begin;
        if (elapsed < 0) { requestAnimationFrame(frame); return; }
        const blurDone = Math.min(1, elapsed / durL);
        const threshold = Math.min(1, Math.max(0, (elapsed - durL * 0.65) / (durL * 0.35)));
        line._goo(most * (1 - easeOut(blurDone)), 20 - 19 * threshold, -8 + 8 * threshold);
        if (blurDone < 1) requestAnimationFrame(frame); else line.style.filter = '';
      };
      requestAnimationFrame(frame);
    };
    const linesOf = (block) => {
      const lines = [...block.querySelectorAll('[data-line]')];
      return lines.length ? lines : [block];
    };
    const blocks = [...root.querySelectorAll('[data-goo]')];
    blocks.forEach((block) => linesOf(block).forEach(prepare));
    const seen = new IntersectionObserver((entries) => {
      entries.filter((entry) => entry.isIntersecting).forEach((entry, order) => {
        seen.unobserve(entry.target);
        linesOf(entry.target).forEach((line, index) => play(line, (order + index) * stagger));
      });
    }, { threshold: 0.1 });
    blocks.forEach((block) => seen.observe(block));
  }
  const still = matchMedia('(prefers-reduced-motion: reduce)');
  const TILES = 26;
  const STEP_MS = 2500;
  const SPIN_MS = 24000;
  const TILT = -0.32;
  const ART = 8;
  const WORKS = [
    'Ferry Hall, waiting room tone', 'Lindenau Baths, reverb study', 'Night Tram, title sound', 'Moss Archive, app clicks',
    'Glasshouse, installation drone', 'Kiln, short film foley', 'Signal Box, museum audio', 'Paper Choir, spatial mix',
  ];

  function token(root, name) { return getComputedStyle(root).getPropertyValue(name).trim(); }

  function bezier(spec) {
    const [x1, y1, x2, y2] = spec.match(/-?[\d.]+/g).map(Number);
    const curve = (a, b, t) => 3 * a * t * (1 - t) ** 2 + 3 * b * t * t * (1 - t) + t ** 3;
    return (x) => {
      let low = 0, high = 1, t = x;
      for (let step = 0; step < 24; step += 1) {
        t = (low + high) / 2;
        if (curve(x1, x2, t) < x) low = t; else high = t;
      }
      return curve(y1, y2, t);
    };
  }

  /* Each project gets a small drawn cover: white marks on a black card. */
  function drawArt(kind, ink, paper) {
    const tile = document.createElement('canvas');
    tile.width = 200;
    tile.height = 150;
    const c = tile.getContext('2d');
    c.fillStyle = ink;
    c.fillRect(0, 0, 200, 150);
    c.fillStyle = paper;
    c.strokeStyle = paper;
    c.lineWidth = 4;
    if (kind === 0) {
      for (let bar = 0; bar < 22; bar += 1) {
        const height = 10 + Math.abs(Math.sin(bar * 1.7) * Math.cos(bar * 0.45)) * 90;
        c.fillRect(22 + bar * 7.4, 75 - height / 2, 4, height);
      }
    } else if (kind === 1) {
      c.beginPath(); c.arc(100, 75, 8, 0, Math.PI * 2); c.fill();
      for (let ring = 1; ring < 5; ring += 1) { c.beginPath(); c.arc(100, 75, 8 + ring * 15, -0.9, 0.9); c.stroke(); c.beginPath(); c.arc(100, 75, 8 + ring * 15, Math.PI - 0.9, Math.PI + 0.9); c.stroke(); }
    } else if (kind === 2) {
      for (let col = 0; col < 16; col += 1) {
        for (let row = 0; row < 10; row += 1) {
          c.globalAlpha = Math.max(0.08, Math.sin(col * 0.5 + row * 0.9) * 0.5 + 0.5 - row * 0.05);
          c.fillRect(20 + col * 10.2, 20 + row * 11.5, 8.6, 9.5);
        }
      }
      c.globalAlpha = 1;
    } else if (kind === 3) {
      c.font = '600 92px Archivo, sans-serif';
      c.textBaseline = 'middle';
      c.fillText('A/B', 18, 80);
    } else if (kind === 4) {
      c.beginPath();
      for (let x = 0; x <= 200; x += 2) c.lineTo(x, 75 + Math.sin(x / 11) * 34 * Math.sin(x / 64));
      c.stroke();
    } else if (kind === 5) {
      for (let col = 0; col < 9; col += 1) for (let row = 0; row < 6; row += 1) { c.beginPath(); c.arc(28 + col * 18, 30 + row * 18, (col + row) % 4 === 0 ? 6 : 2.5, 0, Math.PI * 2); c.fill(); }
    } else if (kind === 6) {
      c.lineWidth = 3;
      c.strokeRect(16, 16, 168, 118);
      c.font = '600 54px Archivo, sans-serif';
      c.fillText('mix.', 28, 118);
    } else {
      c.save(); c.beginPath(); c.rect(0, 0, 200, 150); c.clip();
      for (let stripe = -150; stripe < 200; stripe += 22) c.fillRect(stripe, 0, 9, 150);
      c.restore();
      c.fillStyle = ink; c.fillRect(64, 44, 72, 62);
    }
    return tile;
  }

  function fibonacci(count) {
    const gold = Math.PI * (3 - Math.sqrt(5));
    return Array.from({ length: count }, (_, index) => {
      const y = 1 - (index / (count - 1)) * 2;
      const ring = Math.sqrt(1 - y * y);
      return [Math.cos(index * gold) * ring, y, Math.sin(index * gold) * ring];
    });
  }

  function rotate([x, y, z], yaw, pitch) {
    const x1 = x * Math.cos(yaw) + z * Math.sin(yaw);
    const z1 = -x * Math.sin(yaw) + z * Math.cos(yaw);
    const y2 = y * Math.cos(pitch) - z1 * Math.sin(pitch);
    const z2 = y * Math.sin(pitch) + z1 * Math.cos(pitch);
    return [x1, y2, z2];
  }

  function setUp(root) {
    const canvas = root.querySelector('.globe__canvas');
    const context = canvas.getContext('2d');
    const caption = root.querySelector('.globe__title');
    const index = root.querySelector('.globe__index');
    const styles = getComputedStyle(root);
    const ink = styles.getPropertyValue('--ink').trim();
    const paper = styles.getPropertyValue('--paper').trim();
    const backEdge = styles.getPropertyValue('--ink-soft').trim();
    const osmo = bezier(token(root, '--ease-osmo'));
    const points = fibonacci(TILES);
    const arts = Array.from({ length: ART }, (_, kind) => drawArt(kind, ink, paper));
    const slot = (Math.PI * 2) / 9;
    let width = 0, height = 0, frame = 0, front = -1;
    let dragYaw = 0, dragPitch = 0, velocity = 0, dragging = null, clock = 0, last = performance.now();

    function fit() {
      const density = Math.min(2, devicePixelRatio || 1);
      width = canvas.clientWidth;
      height = canvas.clientHeight;
      canvas.width = width * density;
      canvas.height = height * density;
      context.setTransform(density, 0, 0, density, 0, 0);
      paint();
    }

    function yawAt(time) {
      const steps = Math.floor(time / STEP_MS);
      const phase = (time % STEP_MS) / STEP_MS;
      return (steps + osmo(phase)) * slot;
    }

    function paint() {
      const radius = Math.min(width * 0.23, height * 0.36);
      const centreX = width / 2, centreY = height / 2;
      const roll = (clock / SPIN_MS) * Math.PI * 2;
      const yaw = yawAt(clock) + dragYaw;
      const pitch = TILT + dragPitch;
      const tileWidth = radius * 0.13, tileHeight = tileWidth * 0.75;
      const camera = 2.6;
      const cosRoll = Math.cos(roll), sinRoll = Math.sin(roll);
      const tiles = points.map((point, number) => {
        const [x, y, z] = rotate(point, yaw, pitch);
        const east = rotate([point[2], 0, -point[0]].map((v) => v / (Math.hypot(point[0], point[2]) || 1)), yaw, pitch);
        const north = [y * east[2] - z * east[1], z * east[0] - x * east[2], x * east[1] - y * east[0]];
        return { number, x, y, z, east, north };
      }).sort((a, b) => a.z - b.z);

      context.clearRect(0, 0, width, height);
      let nearest = null;
      for (const tile of tiles) {
        const scale = camera / (camera - tile.z);
        const toScreen = (vx, vy) => [(vx * cosRoll - vy * sinRoll) * scale, (vx * sinRoll + vy * cosRoll) * scale];
        const [cx, cy] = toScreen(tile.x * radius, -tile.y * radius);
        const [ax, ay] = toScreen(tile.east[0] * tileWidth, -tile.east[1] * tileWidth);
        const [bx, by] = toScreen(-tile.north[0] * tileHeight, tile.north[1] * tileHeight);
        const depth = (tile.z + 1) / 2;
        const facing = tile.z > -0.05;
        const size = Math.pow(depth, 1.3);
        context.save();
        context.globalAlpha = 0.25 + 0.75 * size;
        context.filter = size < 0.6 ? `blur(${((0.6 - size) * 4).toFixed(2)}px)` : 'none';
        const density = Math.min(2, devicePixelRatio || 1);
        context.setTransform(ax * density, ay * density, bx * density, by * density, (centreX + cx) * density, (centreY + cy) * density);
        if (facing) {
          context.drawImage(arts[tile.number % ART], -1, -1, 2, 2);
        } else {
          context.fillStyle = paper;
          context.fillRect(-1, -1, 2, 2);
          context.strokeStyle = backEdge;
          context.lineWidth = 0.035;
          context.strokeRect(-1, -1, 2, 2);
          context.strokeRect(-0.6, -0.45, 1.2, 0.9);
        }
        context.restore();
        if (facing && (!nearest || tile.z > nearest.z)) nearest = tile;
      }
      if (nearest && nearest.number !== front) {
        front = nearest.number;
        caption.textContent = WORKS[front % WORKS.length];
        index.textContent = `(${String(front + 1).padStart(2, '0')})`;
      }
    }

    function tick(now) {
      const delta = Math.min(64, now - last);
      last = now;
      if (!dragging) {
        clock += delta;
        dragYaw += velocity;
        velocity *= 0.94;
        dragPitch *= 0.96;
      }
      paint();
      frame = requestAnimationFrame(tick);
    }

    function start() {
      cancelAnimationFrame(frame);
      last = performance.now();
      if (!still.matches) frame = requestAnimationFrame(tick);
    }

    canvas.addEventListener('pointerdown', (event) => {
      dragging = { x: event.clientX, y: event.clientY, yaw: dragYaw, pitch: dragPitch, time: event.timeStamp };
      velocity = 0;
      root.classList.add('is-dragging');
      canvas.setPointerCapture(event.pointerId);
    });
    canvas.addEventListener('pointermove', (event) => {
      if (!dragging) return;
      const spinYaw = dragging.yaw + (event.clientX - dragging.x) * 0.008;
      velocity = (spinYaw - dragYaw) * 0.6;
      dragYaw = spinYaw;
      dragPitch = Math.max(-0.6, Math.min(0.6, dragging.pitch + (event.clientY - dragging.y) * 0.004));
      if (still.matches) paint();
    });
    const release = () => { dragging = null; root.classList.remove('is-dragging'); };
    canvas.addEventListener('pointerup', release);
    canvas.addEventListener('pointercancel', release);
    canvas.tabIndex = 0;
    canvas.addEventListener('keydown', (event) => {
      if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return;
      event.preventDefault();
      velocity += event.key === 'ArrowLeft' ? -0.06 : 0.06;
      if (still.matches) { dragYaw += velocity * 6; velocity = 0; paint(); }
    });

    new ResizeObserver(fit).observe(canvas);
    new IntersectionObserver(([entry]) => {
      cancelAnimationFrame(frame);
      if (entry.isIntersecting) start();
    }).observe(root);
    if (document.fonts) document.fonts.ready.then(() => { arts.splice(0, ART, ...Array.from({ length: ART }, (_, kind) => drawArt(kind, ink, paper))); paint(); });
  }

  document.querySelectorAll('.globe').forEach((root) => { setUp(root); revealOnView(root); });
})();
</script>

Similar components

Work grid with pill

Work grid with pill

Project windows

Project windows

Inset project tiles

Inset project tiles

Shelf drawing

Shelf drawing

Poster rail

Poster rail

Archive tiles

Archive tiles

Staggered work grid

Staggered work grid

Scrapbook board

Scrapbook board