#128 ui light mobile: high Spatial & Canvas

Pannable & Zoomable Spatial Canvas

Infinite dot-grid thinking canvas with pointer panning, cursor-anchored zoom, draggable cards, and live SVG connectors.

Inspired by Kinopio ↗

Download .html
Fullscreen ↗

WHY THIS AESTHETIC IS UNIQUE

Replaces rigid vertical lists with spatial memory: cards move freely in 2D space with elastic dashed SVG wires, cursor-centered wheel zoom, and a one-tap Fit View reset for mobile screens.

BEST FOR

Creative moodboards and brand sprintsSpatial brainstorming and mind-mappingArchitecture diagramming and research boardsVisual storyboarding workspaces

TAGS

COLOR PALETTE (CLICK TO COPY HEX)

TYPOGRAPHY

Display
Inter
Body
Inter
Mono
JetBrains Mono
Scale
14px bold card titles, 12.5px compact descriptions, 10px mono category pills, 12px mono zoom percentage readout.

Google Fonts Stylesheet ↗

ARCHITECTURE & MOBILE NOTES

LAYOUT

Full-viewport touch-action:none stage with CSS-transformed world layer, SVG bezier wire overlay, and floating top/bottom pill HUDs that never block canvas hits.

INTERACTION

Pointer capture handles smooth background panning and individual card dragging across mouse and touch; wheel zoom anchors to cursor coordinates while +/−/Fit View provide explicit controls.

MOBILE

Auto-runs Fit View on initial load and viewport resize so all spatial cards frame cleanly at 390px, with >=40px floating pill zoom controls and touch-friendly card dragging.

AI AGENT GUARDRAILS

DO

  • Set touch-action: none on the spatial viewport and use Pointer Events for unified mouse and touch drag.
  • Always include an explicit Fit View button so users can never get lost off-canvas.
  • Keep floating HUD bars pointer-events:none on their wrappers so canvas drag remains unobstructed.

DON'T

  • Never rely exclusively on scroll-wheel or trackpad pinch without +/- zoom buttons.
  • Avoid re-rendering the entire DOM on pan frames; update a single CSS transform matrix.
STANDALONE SOURCE · demos/spatial-canvas-moodboard.html (13.7 KB)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pannable & Zoomable Spatial Canvas — Kinopio-Inspired Pattern</title>
<style>
  :root {
    --canvas: #f3f5f0;
    --dot: #cbd4c4;
    --surface: #ffffff;
    --ink: #1c2420;
    --muted: #5f6d65;
    --accent: #2a9d6f;
    --accent-2: #e07a5f;
    --accent-3: #4f6df5;
    --border: rgba(28,36,32,0.12);
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body {
    height: 100%;
    overflow: hidden;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    user-select: none;
    touch-action: none;
  }
  .viewport {
    position: fixed;
    inset: 0;
    cursor: grab;
    background-image: radial-gradient(var(--dot) 1.4px, transparent 1.4px);
    background-size: 24px 24px;
  }
  .viewport.panning { cursor: grabbing; }
  .world {
    position: absolute;
    left: 0; top: 0;
    width: 2400px; height: 1600px;
    transform-origin: 0 0;
  }
  svg.wires {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: visible;
  }
  .card {
    position: absolute;
    width: 230px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 13px 14px;
    box-shadow: 0 10px 26px rgba(28,36,32,0.08);
    cursor: move;
    transition: box-shadow .15s, border-color .15s;
  }
  .card:hover, .card.dragging {
    box-shadow: 0 18px 36px rgba(28,36,32,0.16);
    border-color: var(--accent);
    z-index: 20;
  }
  .card-tag {
    display: inline-block;
    font: 700 10px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
  }
  .card-title { font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
  .card-body { font-size: 12.5px; color: var(--muted); line-height: 1.48; }
  .swatches { display: flex; gap: 6px; margin-top: 10px; }
  .swatch { height: 26px; flex: 1; border-radius: 7px; border: 1px solid rgba(0,0,0,0.08); }
  .mini-art {
    margin-top: 10px;
    height: 74px;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .hud-top {
    position: fixed;
    top: 14px; left: 14px; right: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
    z-index: 40;
  }
  .pill-bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 8px;
    box-shadow: 0 8px 24px rgba(28,36,32,0.08);
    backdrop-filter: blur(12px);
  }
  .board-name { font-size: 13px; font-weight: 700; padding: 0 8px; white-space: nowrap; }
  .btn {
    min-height: 40px; min-width: 40px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    font: 600 13px var(--font);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  }
  .btn:hover { background: rgba(28,36,32,0.06); }
  .btn.primary { background: var(--ink); color: #fff; }
  .btn.primary:hover { background: var(--accent); }
  .hud-bottom {
    position: fixed;
    bottom: 16px; left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    max-width: calc(100vw - 24px);
  }
  .zoom-readout { font: 600 12px var(--mono); min-width: 44px; text-align: center; color: var(--muted); }
  .hint-chip {
    position: fixed;
    bottom: 72px; left: 50%; transform: translateX(-50%);
    background: rgba(28,36,32,0.85); color: #fff;
    padding: 6px 12px; border-radius: 999px; font-size: 12px;
    pointer-events: none; z-index: 35; white-space: nowrap;
  }
  @media (max-width: 640px) {
    .board-name { font-size: 12px; padding: 0 4px; }
    .hide-sm { display: none; }
  }
</style>
</head>
<body>
<div class="hud-top">
  <div class="pill-bar">
    <span class="board-name">🌿 Autumn Packaging Moodboard</span>
    <span class="hide-sm" style="font:600 11px var(--mono);color:var(--muted);padding-right:6px;" id="cardCount">6 cards</span>
  </div>
  <div class="pill-bar">
    <button class="btn primary" id="addCardBtn" type="button">+ Add Card</button>
  </div>
</div>

<div class="viewport" id="viewport" aria-label="Spatial moodboard canvas">
  <div class="world" id="world">
    <svg class="wires" id="wires"></svg>
  </div>
</div>

<div class="hint-chip" id="hintChip">Drag background to pan · Drag cards to arrange · Scroll or tap ± to zoom</div>

<div class="hud-bottom">
  <div class="pill-bar">
    <button class="btn" id="zoomOutBtn" type="button" aria-label="Zoom out">−</button>
    <span class="zoom-readout" id="zoomReadout">100%</span>
    <button class="btn" id="zoomInBtn" type="button" aria-label="Zoom in">+</button>
    <button class="btn" id="fitBtn" type="button">Fit View</button>
  </div>
</div>

<script>
const CARDS = [
  { id: 'c1', x: 110, y: 120, tag: 'Direction', bg: '#e6f4ee', fg: '#1e7451', title: 'Tactile Paper & Botanical Ink', body: 'Uncoated 320gsm cotton stock paired with debossed serif marks and sage foil accents.', art: 'botanical' },
  { id: 'c2', x: 420, y: 90, tag: 'Palette', bg: '#fdeee9', fg: '#b94e34', title: 'Earth & Mineral Swatches', body: 'Warm clay, lichen sage, deep pine ink, and bleached linen highlights.', swatches: ['#2a9d6f', '#e07a5f', '#264653', '#e9c46a', '#f4f1de'] },
  { id: 'c3', x: 420, y: 310, tag: 'Typography', bg: '#edf0ff', fg: '#3952c7', title: 'Display + Mono Pairing', body: 'Editorial high-contrast headlines anchored by tabular monospace batch numbers.', art: 'type' },
  { id: 'c4', x: 730, y: 160, tag: 'Form Factor', bg: '#fef6e0', fg: '#9a6700', title: 'Refillable Tin Geometry', body: 'Chamfered 18mm corner radius with magnetic lid detent and blind-embossed crest.', art: 'tin' },
  { id: 'c5', x: 140, y: 370, tag: 'Research', bg: '#f1eef9', fg: '#6b46c1', title: 'Unboxing Ritual Notes', body: 'First touch is dry paper grain; inner lid reveals brew ratio diagram in 1-color ink.' },
  { id: 'c6', x: 720, y: 390, tag: 'Decision', bg: '#e6f4ee', fg: '#1e7451', title: 'Sign-off Target: Oct 18', body: 'Send dielines + Pantone drawdowns to Kyoto press once foil contrast passes review.' }
];

const EDGES = [
  ['c1', 'c2'], ['c1', 'c3'], ['c1', 'c5'], ['c2', 'c4'], ['c3', 'c4'], ['c4', 'c6'], ['c3', 'c6']
];

const viewport = document.getElementById('viewport');
const world = document.getElementById('world');
const wires = document.getElementById('wires');
const zoomReadout = document.getElementById('zoomReadout');
const cardCount = document.getElementById('cardCount');

let state = { x: 40, y: 40, scale: 1 };

function artSVG(kind) {
  if (kind === 'botanical') {
    return `<div class="mini-art"><svg viewBox="0 0 220 74" width="100%" height="100%"><rect width="220" height="74" fill="#eef4ee"/><path d="M18 68 C58 14, 118 58, 202 12" stroke="#2a9d6f" stroke-width="3" fill="none"/><circle cx="74" cy="36" r="14" fill="#e07a5f" opacity="0.8"/><circle cx="148" cy="32" r="20" fill="#264653" opacity="0.22"/></svg></div>`;
  }
  if (kind === 'type') {
    return `<div class="mini-art"><svg viewBox="0 0 220 74" width="100%" height="100%"><rect width="220" height="74" fill="#1c2420"/><text x="14" y="42" fill="#f3f5f0" font-family="Georgia,serif" font-size="28" font-weight="700">Aa Bb</text><text x="116" y="42" fill="#7ee0b4" font-family="monospace" font-size="13">BATCH 042</text><text x="14" y="61" fill="#9ca8a1" font-family="monospace" font-size="10">320GSM · DEBOSS · SAGE FOIL</text></svg></div>`;
  }
  if (kind === 'tin') {
    return `<div class="mini-art"><svg viewBox="0 0 220 74" width="100%" height="100%"><rect width="220" height="74" fill="#faf6ec"/><rect x="44" y="12" width="132" height="50" rx="14" fill="#ffffff" stroke="#264653" stroke-width="2"/><line x1="44" y1="28" x2="176" y2="28" stroke="#e07a5f" stroke-width="2" stroke-dasharray="4 3"/><circle cx="110" cy="45" r="8" fill="#2a9d6f"/></svg></div>`;
  }
  return '';
}

function applyTransform() {
  world.style.transform = `translate(${state.x}px, ${state.y}px) scale(${state.scale})`;
  viewport.style.backgroundPosition = `${state.x}px ${state.y}px`;
  viewport.style.backgroundSize = `${24 * state.scale}px ${24 * state.scale}px`;
  zoomReadout.textContent = `${Math.round(state.scale * 100)}%`;
}

function renderWires() {
  let html = '';
  for (const [aId, bId] of EDGES) {
    const a = CARDS.find(c => c.id === aId);
    const b = CARDS.find(c => c.id === bId);
    if (!a || !b) continue;
    const x1 = a.x + 115, y1 = a.y + 65;
    const x2 = b.x + 115, y2 = b.y + 65;
    const mx = (x1 + x2) / 2;
    html += `<path d="M ${x1} ${y1} C ${mx} ${y1}, ${mx} ${y2}, ${x2} ${y2}" stroke="#8da095" stroke-width="2" stroke-dasharray="5 5" fill="none" opacity="0.65"/>`;
  }
  wires.innerHTML = html;
}

function renderCards() {
  world.querySelectorAll('.card').forEach(el => el.remove());
  for (const c of CARDS) {
    const el = document.createElement('article');
    el.className = 'card';
    el.dataset.id = c.id;
    el.style.left = c.x + 'px';
    el.style.top = c.y + 'px';
    el.innerHTML = `
      <span class="card-tag" style="background:${c.bg};color:${c.fg};">${c.tag}</span>
      <h3 class="card-title">${c.title}</h3>
      <p class="card-body">${c.body}</p>
      ${c.swatches ? `<div class="swatches">${c.swatches.map(s => `<div class="swatch" style="background:${s}" title="${s}"></div>`).join('')}</div>` : ''}
      ${c.art ? artSVG(c.art) : ''}
    `;
    attachCardDrag(el, c);
    world.appendChild(el);
  }
  cardCount.textContent = `${CARDS.length} cards`;
  renderWires();
}

function attachCardDrag(el, card) {
  let startX, startY, origX, origY, dragging = false;
  el.addEventListener('pointerdown', e => {
    e.stopPropagation();
    dragging = true;
    el.classList.add('dragging');
    el.setPointerCapture(e.pointerId);
    startX = e.clientX; startY = e.clientY;
    origX = card.x; origY = card.y;
    document.getElementById('hintChip').style.opacity = '0';
  });
  el.addEventListener('pointermove', e => {
    if (!dragging) return;
    card.x = Math.round(origX + (e.clientX - startX) / state.scale);
    card.y = Math.round(origY + (e.clientY - startY) / state.scale);
    el.style.left = card.x + 'px';
    el.style.top = card.y + 'px';
    renderWires();
  });
  const end = () => { dragging = false; el.classList.remove('dragging'); };
  el.addEventListener('pointerup', end);
  el.addEventListener('pointercancel', end);
}

let panning = false, panStartX = 0, panStartY = 0, origPanX = 0, origPanY = 0;
viewport.addEventListener('pointerdown', e => {
  if (e.target.closest('.card')) return;
  panning = true;
  viewport.classList.add('panning');
  viewport.setPointerCapture(e.pointerId);
  panStartX = e.clientX; panStartY = e.clientY;
  origPanX = state.x; origPanY = state.y;
  document.getElementById('hintChip').style.opacity = '0';
});
viewport.addEventListener('pointermove', e => {
  if (!panning) return;
  state.x = origPanX + (e.clientX - panStartX);
  state.y = origPanY + (e.clientY - panStartY);
  applyTransform();
});
const stopPan = () => { panning = false; viewport.classList.remove('panning'); };
viewport.addEventListener('pointerup', stopPan);
viewport.addEventListener('pointercancel', stopPan);

function zoomAt(factor, cx = window.innerWidth / 2, cy = window.innerHeight / 2) {
  const next = Math.min(2.2, Math.max(0.45, state.scale * factor));
  const ratio = next / state.scale;
  state.x = cx - (cx - state.x) * ratio;
  state.y = cy - (cy - state.y) * ratio;
  state.scale = next;
  applyTransform();
}

viewport.addEventListener('wheel', e => {
  e.preventDefault();
  zoomAt(e.deltaY < 0 ? 1.09 : 0.92, e.clientX, e.clientY);
}, { passive: false });

document.getElementById('zoomInBtn').addEventListener('click', () => zoomAt(1.2));
document.getElementById('zoomOutBtn').addEventListener('click', () => zoomAt(0.83));

function fitView() {
  const xs = CARDS.map(c => c.x), ys = CARDS.map(c => c.y);
  const minX = Math.min(...xs) - 40, maxX = Math.max(...xs) + 270;
  const minY = Math.min(...ys) - 70, maxY = Math.max(...ys) + 210;
  const scaleX = (window.innerWidth - 32) / (maxX - minX);
  const scaleY = (window.innerHeight - 110) / (maxY - minY);
  state.scale = Math.min(1.1, Math.max(0.42, Math.min(scaleX, scaleY)));
  state.x = (window.innerWidth - (maxX - minX) * state.scale) / 2 - minX * state.scale;
  state.y = (window.innerHeight - (maxY - minY) * state.scale) / 2 - minY * state.scale;
  applyTransform();
}
document.getElementById('fitBtn').addEventListener('click', fitView);

const NEW_IDEAS = [
  ['Texture', '#e6f4ee', '#1e7451', 'Linen Emboss Sample', 'Test 45-degree weave emboss on outer sleeve for warm grip.'],
  ['Copy', '#fdeee9', '#b94e34', 'Origin Story Insert', 'Include farm elevation, harvest week, and roaster signature card.'],
  ['Motion', '#edf0ff', '#3952c7', 'Micro-Interaction Spec', 'QR code on inner flap launches an interactive brew timer.']
];
let ideaIdx = 0;
document.getElementById('addCardBtn').addEventListener('click', () => {
  const [tag, bg, fg, title, body] = NEW_IDEAS[ideaIdx++ % NEW_IDEAS.length];
  const id = 'c' + (CARDS.length + 1);
  const cx = Math.round((window.innerWidth / 2 - state.x) / state.scale - 115 + (Math.random() * 60 - 30));
  const cy = Math.round((window.innerHeight / 2 - state.y) / state.scale - 60 + (Math.random() * 60 - 30));
  CARDS.push({ id, x: cx, y: cy, tag, bg, fg, title, body });
  EDGES.push([CARDS[CARDS.length - 2].id, id]);
  renderCards();
});

renderCards();
fitView();
window.addEventListener('resize', fitView);
</script>
</body>
</html>