Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

7.4 KB
Raw Blame
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="A semantic word-by-word scroll reveal demo.">
  <title>Field Note — Scroll-Scrubbed Word Reveal</title>
  <style>
    :root { color-scheme: light; --paper: #efe8d8; --ink: #1e211c; --quiet: rgba(30,33,28,.14); --moss: #315c45; --red: #e44d34; --line: rgba(30,33,28,.18); --progress: 0; }
    * { box-sizing: border-box; }
    body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font-family: Arial, Helvetica, sans-serif; }
    .masthead { position: fixed; z-index: 5; top: 0; left: 0; right: 0; height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px,4vw,54px); border-bottom: 1px solid var(--line); background: rgba(239,232,216,.86); backdrop-filter: blur(14px); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
    .masthead b { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
    .masthead b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
    .story { height: 310vh; position: relative; }
    .reader { position: sticky; top: 0; min-height: 100vh; padding: 104px clamp(22px,4vw,60px) 36px; display: grid; grid-template-columns: 120px minmax(0,1fr) 150px; gap: clamp(20px,3vw,50px); align-items: center; }
    .side { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; padding: 24px 0; color: #6a6b62; font-size: 10px; line-height: 1.6; letter-spacing: .12em; text-transform: uppercase; }
    .side strong { color: var(--ink); font-size: 11px; font-weight: 600; }
    .rail { position: relative; width: 1px; height: min(320px, 42vh); margin-top: auto; background: var(--line); }
    .rail i { display: block; width: 3px; height: 100%; margin-left: -1px; background: var(--red); transform: scaleY(var(--progress)); transform-origin: top; }
    .passage { min-width: 0; margin: 0; max-width: 1040px; font: 400 clamp(50px, 5.7vw, 94px)/.92 Georgia, "Times New Roman", serif; letter-spacing: -.058em; }
    .passage em { color: var(--moss); font-style: italic; }
    .passage strong { color: var(--red); font-weight: 400; }
    [data-word] { display: inline; opacity: calc(.22 + var(--word-progress) * .78); filter: blur(calc((1 - var(--word-progress)) * 4px)); transform: translateY(calc((1 - var(--word-progress)) * .16em)); transition: color .15s linear; }
    .counter { font: 400 clamp(48px,6vw,82px)/1 Georgia, serif; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
    .counter small { display: block; margin-top: 10px; color: #74756d; font: 10px/1.4 Arial, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
    .note { min-height: 76vh; padding: 100px clamp(22px,6vw,86px); border-top: 1px solid var(--line); display: grid; grid-template-columns: 150px minmax(0,760px); gap: clamp(24px,5vw,80px); align-content: center; }
    .note span { color: var(--red); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
    .note p { margin: 0; font: 400 clamp(30px,4vw,58px)/1.08 Georgia, serif; letter-spacing: -.035em; }
    :focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }
    @media (max-width: 850px) {
      .reader { grid-template-columns: 44px 1fr; gap: 20px; padding-inline: 18px; }
      .side { grid-row: 1; }
      .side span:first-child { display: none; }
      .passage { grid-column: 2; font-size: clamp(46px, 11vw, 76px); }
      .measure { display: none; }
      .rail { height: 32vh; }
      .note { grid-template-columns: 1fr; }
    }
    @media (prefers-reduced-motion: reduce) {
      :root { --progress: 1; }
      .story { height: auto; }
      .reader { position: relative; min-height: 100vh; }
      [data-word] { opacity: 1 !important; filter: none !important; transform: none !important; }
    }
  </style>
</head>
<body>
  <header class="masthead"><b>Field note / 07</b><span>Scroll to read</span></header>
  <main>
    <section class="story" aria-labelledby="manifesto">
      <div class="reader">
        <aside class="side" aria-hidden="true"><span>On attention<br>and motion</span><div class="rail"><i></i></div><strong class="fraction">00 / 19</strong></aside>
        <h1 class="passage" id="manifesto" data-reveal>Motion earns attention when it <em>clarifies change</em>, protects the reader’s pace, and leaves the interface <strong>more obvious</strong> than it found it.</h1>
        <aside class="side measure" aria-hidden="true"><span>Progressive<br>comprehension</span><div class="counter"><span class="percent">00</span><small>percent read</small></div><span>Native scroll<br>Reversible state</span></aside>
      </div>
    </section>
    <section class="note"><span>Settled state</span><p>The sentence remains ordinary, semantic text. The animation changes the pace of discovery—not the meaning, order, or access.</p></section>
  </main>
  <script>
    (() => {
      const passage = document.querySelector('[data-reveal]');
      const original = passage.cloneNode(true);
      const walker = document.createTreeWalker(passage, NodeFilter.SHOW_TEXT, {
        acceptNode(node) { return node.nodeValue.trim() ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; }
      });
      const nodes = [];
      while (walker.nextNode()) nodes.push(walker.currentNode);
      for (const node of nodes) {
        const fragment = document.createDocumentFragment();
        for (const token of node.nodeValue.split(/(\s+)/)) {
          if (/^\s+$/.test(token)) fragment.append(token);
          else if (token) {
            const span = document.createElement('span');
            span.dataset.word = '';
            span.textContent = token;
            fragment.append(span);
          }
        }
        node.replaceWith(fragment);
      }

      const words = [...passage.querySelectorAll('[data-word]')];
      const section = document.querySelector('.story');
      const percent = document.querySelector('.percent');
      const fraction = document.querySelector('.fraction');
      const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
      let scheduled = false;

      function render() {
        scheduled = false;
        const rect = section.getBoundingClientRect();
        const distance = Math.max(1, section.offsetHeight - innerHeight);
        const progress = reduced ? 1 : Math.min(1, Math.max(0, -rect.top / distance));
        document.documentElement.style.setProperty('--progress', progress.toFixed(4));
        const head = 3.2 + progress * (words.length - .8);
        let revealed = 0;
        words.forEach((word, index) => {
          const local = Math.min(1, Math.max(0, (head - index) / 2.4));
          word.style.setProperty('--word-progress', local.toFixed(3));
          if (local > .62) revealed += 1;
        });
        percent.textContent = String(Math.round(progress * 100)).padStart(2, '0');
        fraction.textContent = `${String(revealed).padStart(2, '0')} / ${String(words.length).padStart(2, '0')}`;
      }

      function requestRender() { if (!scheduled) { scheduled = true; requestAnimationFrame(render); } }
      addEventListener('scroll', requestRender, { passive: true });
      addEventListener('resize', requestRender);
      addEventListener('pagehide', () => passage.replaceWith(original), { once: true });
      render();
    })();
  </script>
</body>
</html>