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.

feat: enhance metadata and improve avatar animations across multiple pages

nirholas91011c72c1f4
diff --git a/api/agent-page.js b/api/agent-page.js
new file mode 100644
index 000000000..95f3c403b
--- /dev/null
+++ b/api/agent-page.js
@@ -0,0 +1,159 @@
+/**
+ * Server-rendered metadata page for hosted agents
+ * ------------------------------------------------
+ * GET /api/agent-page?id=<agentId>
+ *
+ * Wired to /agent/:id via vercel.json. Returns an HTML page with
+ * Open Graph + Twitter Player Card + oEmbed discovery + Farcaster Frame tags
+ * so social crawlers get a rich preview. Real browsers are redirected to the
+ * agent-home.html SPA.
+ */
+
+import { sql } from './_lib/db.js';
+import { env } from './_lib/env.js';
+import { cors, wrap } from './_lib/http.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+
+ const url = new URL(req.url, 'http://x');
+ const agentId = url.searchParams.get('id');
+
+ if (!agentId) return notFound(res, 'Invalid agent URL');
+
+ const [agent] = await sql`
+ SELECT id, name, description
+ FROM agent_identities
+ WHERE id = ${agentId} AND deleted_at IS NULL
+ LIMIT 1
+ `;
+
+ if (!agent) return notFound(res, `Agent not found`);
+
+ const origin = env.APP_ORIGIN;
+ const pageUrl = `${origin}/agent/${agentId}`;
+ const embedUrl = `${origin}/agent/${agentId}/embed`;
+ const ogUrl = `${origin}/api/agent/${agentId}/og`;
+ const oembedJs = `${origin}/api/oembed?url=${encodeURIComponent(pageUrl)}&format=json`;
+
+ const title = agent.name || 'Agent';
+ const desc = agent.description || 'An embodied three.ws.';
+
+ res.statusCode = 200;
+ res.setHeader('content-type', 'text/html; charset=utf-8');
+ res.setHeader('cache-control', 'public, max-age=60, s-maxage=600, stale-while-revalidate=3600');
+ res.end(renderHtml({ title, desc, agentId, pageUrl, embedUrl, ogUrl, oembedJs, origin }));
+});
+
+function notFound(res, reason) {
+ res.statusCode = 404;
+ res.setHeader('content-type', 'text/html; charset=utf-8');
+ res.setHeader('cache-control', 'public, max-age=60');
+ res.end(
+ `<!doctype html><meta charset="utf-8"><title>Agent not found — three.ws</title>
+<style>body{font-family:Inter,system-ui,sans-serif;background:#0a0a0a;color:#e0e0e0;display:grid;place-items:center;min-height:100vh;margin:0}main{text-align:center;padding:2rem;max-width:520px}a{color:#8b5cf6}</style>
+<main><h1>Agent not found</h1><p>${escapeHtml(reason)}</p><p><a href="/discover">Browse all agents</a> · <a href="/">Open viewer</a></p></main>`,
+ );
+}
+
+function renderHtml(p) {
+ const t = escapeHtml(p.title);
+ const d = escapeHtml(p.desc);
+ return `<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>${t} — three.ws</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
+ <meta name="description" content="${d}">
+ <meta name="theme-color" content="#0a0a0a">
+
+ <meta property="og:type" content="profile">
+ <meta property="og:site_name" content="three.ws">
+ <meta property="og:title" content="${t}">
+ <meta property="og:description" content="${d}">
+ <meta property="og:url" content="${escapeAttr(p.pageUrl)}">
+ <meta property="og:image" content="${escapeAttr(p.ogUrl)}">
+ <meta property="og:image:width" content="1200">
+ <meta property="og:image:height" content="630">
+ <meta property="og:image:alt" content="${t} on three.ws">
+
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="${t}">
+ <meta name="twitter:description" content="${d}">
+ <meta name="twitter:image" content="${escapeAttr(p.ogUrl)}">
+ <meta name="twitter:player" content="${escapeAttr(p.embedUrl)}">
+ <meta name="twitter:player:width" content="480">
+ <meta name="twitter:player:height" content="600">
+
+ <!-- Farcaster Frame (vNext) -->
+ <meta property="fc:frame" content="vNext">
+ <meta property="fc:frame:image" content="${escapeAttr(p.ogUrl)}">
+ <meta property="fc:frame:image:aspect_ratio" content="1.91:1">
+ <meta property="fc:frame:button:1" content="View Agent">
+ <meta property="fc:frame:button:1:action" content="link">
+ <meta property="fc:frame:button:1:target" content="${escapeAttr(p.pageUrl)}">
+ <meta property="fc:frame:button:2" content="Discover">
+ <meta property="fc:frame:button:2:action" content="link">
+ <meta property="fc:frame:button:2:target" content="${escapeAttr(p.origin)}/discover">
+
+ <link rel="canonical" href="${escapeAttr(p.pageUrl)}">
+ <link rel="alternate" type="application/json+oembed" href="${escapeAttr(p.oembedJs)}" title="${t}">
+ <link rel="shortcut icon" href="/favicon.ico">
+
+ <style>
+ html,body{margin:0;padding:0;background:#0a0a0a;color:#e0e0e0;font-family:Inter,system-ui,sans-serif;height:100%;overflow:hidden}
+ .shell{display:grid;place-items:center;height:100vh;text-align:center;padding:2rem;gap:1rem}
+ .shell a{color:#8b5cf6;text-decoration:none}
+ .shell a:hover{text-decoration:underline}
+ .spinner{width:32px;height:32px;border:2px solid rgba(255,255,255,0.1);border-top-color:#8b5cf6;border-radius:50%;animation:spin 1s linear infinite}
+ @keyframes spin{to{transform:rotate(360deg)}}
+ @media(prefers-reduced-motion:reduce){.spinner{animation:none}}
+ </style>
+</head>
+<body>
+ <noscript>
+ <div class="shell">
+ <h1>${t}</h1>
+ <p>${d}</p>
+ <p><a href="${escapeAttr(p.embedUrl)}">Open 3D viewer</a> · <a href="/discover">Browse agents</a></p>
+ </div>
+ </noscript>
+ <div class="shell" id="loading" aria-live="polite">
+ <div class="spinner" aria-hidden="true"></div>
+ <p>Loading ${t}…</p>
+ </div>
+ <script>
+ (function () {
+ window.location.replace(${JSON.stringify(p.pageUrl)});
+ })();
+ </script>
+ <script type="application/ld+json">
+${escapeJsonLd({
+ '@context': 'https://schema.org',
+ '@type': 'Person',
+ name: p.title,
+ description: p.desc,
+ url: p.pageUrl,
+ image: p.ogUrl,
+ provider: { '@type': 'Organization', name: 'three.ws', url: 'https://three.ws/' },
+})}
+ </script>
+</body>
+</html>`;
+}
+
+function escapeHtml(s) {
+ return String(s).replace(
+ /[&<>"']/g,
+ (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c],
+ );
+}
+function escapeAttr(s) {
+ return escapeHtml(s);
+}
+function escapeJsonLd(obj) {
+ const clean = JSON.parse(JSON.stringify(obj));
+ return JSON.stringify(clean, null, 2).replace(/</g, '\\u003c');
+}
diff --git a/create.html b/create.html
index ca0197562..bf6e2fe9c 100644
--- a/create.html
+++ b/create.html
@@ -12,12 +12,16 @@
<meta name="robots" content="noindex" />
<meta property="og:type" content="website">
+ <meta property="og:site_name" content="three.ws">
<meta property="og:url" content="https://three.ws/create">
<meta property="og:title" content="Create avatar · three.ws">
+ <meta property="og:description" content="Create a 3D avatar. Use our web editor, upload a GLB, or generate from a selfie.">
<meta property="og:image" content="https://three.ws/assets/og-image.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="Create avatar · three.ws">
+ <meta name="twitter:description" content="Create a 3D avatar. Use our web editor, upload a GLB, or generate from a selfie.">
<meta name="twitter:image" content="https://three.ws/assets/og-image.png">
<style>
diff --git a/home.css b/home.css
index 637689633..8ac3a221a 100644
--- a/home.css
+++ b/home.css
@@ -985,6 +985,28 @@
border-radius: 0 24px 24px 0;
}
+/* ── Hero avatar traversing mode (falling animation) ────────────────────── */
+
+.h-avatar-wrap--traversing {
+ position: absolute !important;
+ inset: 0 !important;
+ width: 100% !important;
+ height: 100% !important;
+ aspect-ratio: unset !important;
+ border-radius: 0 !important;
+ pointer-events: none;
+}
+
+.h-avatar-wrap--traversing #hero-avatar {
+ border-radius: 0 !important;
+}
+
+.h-avatar-wrap--traversing .h-avatar-ring,
+.h-avatar-wrap--traversing .h-avatar-glow,
+.h-avatar-wrap--traversing .h-avatar-badge {
+ display: none;
+}
+
/* ── Ghost avatar (Act 3, depth 1) ──────────────────────────────────────── */
.h-avatar-wrap--ghost {
diff --git a/home.html b/home.html
index e69dd1d56..507e39a6e 100644
--- a/home.html
+++ b/home.html
@@ -13,14 +13,23 @@
<meta name="theme-color" content="#000000" />
<meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
<meta property="og:title" content="three.ws — Give Your AI a Body" />
<meta
property="og:description"
- content="Drop any GLB model into three.ws — view it, animate it, embed it anywhere."
+ content="Drop any GLB model into three.ws — view it, animate it, embed it anywhere, and give it a verifiable on-chain identity."
/>
- <meta property="og:url" content="https://three.ws/home" />
+ <meta property="og:url" content="https://three.ws/" />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content="three.ws — Give Your AI a Body" />
+ <meta name="twitter:description" content="Drop any GLB model into three.ws — view it, animate it, embed it anywhere, and give it a verifiable on-chain identity." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
- <link rel="canonical" href="https://three.ws/home" />
+ <link rel="canonical" href="https://three.ws/" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/pwa-192x192.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
@@ -531,7 +540,7 @@
if (!scrollEl || !canvas || !heroAct) return;
let mouseX = 0, mouseY = 0, scrollProgress = 0;
- const BASE_THETA = -45, BASE_PHI = 80, BASE_R = 8.5;
+ const BASE_THETA = -45, BASE_PHI = 80, BASE_R = 14;
let curTheta = BASE_THETA, curPhi = BASE_PHI, curR = BASE_R;
window.addEventListener('mousemove', (e) => {
@@ -550,27 +559,57 @@
whenReady(() => {
const viewer = new window.Act2Viewer(canvas, { fov: 18 });
+ let orbitActive = false;
- /* cursor + scroll orbit loop — matches original model-viewer camera-orbit params */
+ /* cursor + scroll orbit loop — starts after model loads to avoid camera snap */
(function tick() {
- const scrollTheta = scrollProgress * 90;
- const scrollPhi = -scrollProgress * 8;
- const scrollR = scrollProgress * 0.8;
- curTheta += (BASE_THETA + scrollTheta + mouseX * 16 - curTheta) * 0.07;
- curPhi += (BASE_PHI + scrollPhi + mouseY * 6 - curPhi) * 0.07;
- curR += (BASE_R + scrollR - curR) * 0.12;
- viewer.setOrbit(curTheta, curPhi, curR);
+ if (orbitActive) {
+ const scrollTheta = scrollProgress * 90;
+ const scrollPhi = -scrollProgress * 8;
+ const scrollR = scrollProgress * 0.8;
+ curTheta += (BASE_THETA + scrollTheta + mouseX * 16 - curTheta) * 0.07;
+ curPhi += (BASE_PHI + scrollPhi + mouseY * 6 - curPhi) * 0.07;
+ curR += (BASE_R + scrollR - curR) * 0.12;
+ viewer.setOrbit(curTheta, curPhi, curR);
+ }
requestAnimationFrame(tick);
})();
- viewer.loadModel('/avatars/cz.glb')
- .then(async () => {
- await viewer.playClip('falling').catch(() => {});
- setTimeout(() => viewer.playClip('dance').catch(() => {}), 2600);
+ const wrap = canvas.closest('.h-avatar-wrap');
+
+ /* falling: expand to full hero width and slide model across the scene */
+ function doFalling() {
+ wrap.classList.add('h-avatar-wrap--traversing');
+ viewer.playClip('falling').catch(() => {});
+ const dur = 2800;
+ const t0 = performance.now();
+ (function step(now) {
+ const t = Math.min((now - t0) / dur, 1);
+ const ease = t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
+ const x = -4.5 + 9 * ease;
+ if (viewer.model) viewer.model.position.x = x;
+ viewer._focusX = x;
+ if (t < 1) {
+ requestAnimationFrame(step);
+ } else {
+ if (viewer.model) viewer.model.position.x = 0;
+ viewer._focusX = 0;
+ wrap.classList.remove('h-avatar-wrap--traversing');
+ viewer.playClip('dance').catch(() => {});
+ }
+ })(performance.now());
+ }
+
+ viewer.loadModel('/avatars/cz.glb', { autoPlay: false })
+ .then(() => {
+ /* snap camera to orbit position before first render — no jump */
+ viewer.setOrbit(curTheta, curPhi, curR);
+ orbitActive = true;
+ doFalling();
})
.catch(console.error);
- /* click → random manifest animation; non-looping ones return to dance */
+ /* click → random manifest animation; falling gets full traverse treatment */
const FUN = ['falling', 'wave', 'dance', 'celebrate', 'jump', 'rumba', 'capoeira', 'thriller', 'kiss', 'taunt', 'pray'];
let lastAnim = null;
canvas.style.cursor = 'pointer';
@@ -578,6 +617,10 @@
const pool = FUN.filter(a => a !== lastAnim);
const name = pool[Math.floor(Math.random() * pool.length)];
lastAnim = name;
+ if (name === 'falling') {
+ doFalling();
+ return;
+ }
try {
await viewer.playClip(name);
const def = viewer._manifest.find(d => d.name === name);
@@ -633,8 +676,8 @@
viewer.onClipsReady = rebuildChips;
- /* default avatar */
- viewer.loadModel('/avatars/cz.glb').catch(console.error);
+ /* default avatar — Robot (matches aria-pressed="true" in HTML) */
+ viewer.loadModel('/animations/robotexpressive.glb').catch(console.error);
/* avatar picker */
opts.forEach((btn) => {
@@ -644,12 +687,6 @@
try { await viewer.loadModel(btn.dataset.src); } catch (e) { console.error(e); }
});
});
- /* highlight CZ as default */
- const czBtn = Array.from(opts).find((b) => b.dataset.src === '/avatars/cz.glb');
- if (czBtn) {
- opts.forEach((b) => b.setAttribute('aria-pressed', 'false'));
- czBtn.setAttribute('aria-pressed', 'true');
- }
/* click on canvas to toggle zoom (default → extra-wide) */
let wider = false;
diff --git a/index.html b/index.html
index a0cebe99e..b052615f1 100644
--- a/index.html
+++ b/index.html
@@ -16,9 +16,17 @@
<meta property="og:title" content="three.ws — Give Your AI a Body" />
<meta
property="og:description"
- content="Drop any GLB model into three.ws — view it, animate it, embed it anywhere."
+ content="Drop any GLB model into three.ws — view it, animate it, embed it anywhere, and give it a verifiable on-chain identity."
/>
<meta property="og:url" content="https://three.ws/" />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content="three.ws — Give Your AI a Body" />
+ <meta name="twitter:description" content="Drop any GLB model into three.ws — view it, animate it, embed it anywhere, and give it a verifiable on-chain identity." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
<link rel="canonical" href="https://three.ws/" />
<link rel="shortcut icon" href="/favicon.ico" />
diff --git a/profile.html b/profile.html
index b3b7502a6..b3d107b1e 100644
--- a/profile.html
+++ b/profile.html
@@ -21,14 +21,17 @@
></script>
<meta property="og:type" content="profile" />
- <meta property="og:url" content="https://three.ws/profile">
+ <meta property="og:site_name" content="three.ws">
+ <meta property="og:url" content="" id="og-url">
<meta property="og:title" content="Agent Profile" id="og-title" />
<meta property="og:description" content="On-chain agent identity." id="og-description" />
- <meta property="og:image" content="https://three.ws/assets/og-image.png">
+ <meta property="og:image" content="https://three.ws/assets/og-image.png" id="og-image">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:image" content="https://three.ws/assets/og-image.png">
+ <meta name="twitter:title" content="Agent Profile" id="tw-title">
+ <meta name="twitter:description" content="On-chain agent identity." id="tw-description">
+ <meta name="twitter:image" content="https://three.ws/assets/og-image.png" id="tw-image">
<style>
body {
@@ -345,11 +348,12 @@
// Update page title and OG
const short = address.slice(0, 6) + '…' + address.slice(-4);
document.title = `${short} — Agents`;
+ const profileUrl = `${location.origin}/u/${address}`;
document.querySelector('#og-title')?.setAttribute('content', `${short} — Agents`);
- document.querySelector('#og-description')?.setAttribute(
- 'content',
- `On-chain agent identity profile for ${address}`,
- );
+ document.querySelector('#og-description')?.setAttribute('content', `On-chain agent identity profile for ${address}`);
+ document.querySelector('#og-url')?.setAttribute('content', profileUrl);
+ document.querySelector('#tw-title')?.setAttribute('content', `${short} — Agents`);
+ document.querySelector('#tw-description')?.setAttribute('content', `On-chain agent identity profile for ${address}`);
mountUserProfile(root, address).catch((err) => {
root.innerHTML = `<div class="up-error">Could not load profile: ${err.message}</div>`;
diff --git a/public/og-image.png b/public/og-image.png
index c8d017dcf..3ed7bc860 100644
Binary files a/public/og-image.png and b/public/og-image.png differ
diff --git a/src/home-act2-viewer.js b/src/home-act2-viewer.js
index f98d9c6aa..86bb79bcd 100644
--- a/src/home-act2-viewer.js
+++ b/src/home-act2-viewer.js
@@ -66,6 +66,7 @@ export class Act2Viewer {
this._clock = new Clock();
this._modelYaw = 0;
this._modelFocusY = 1.0;
+ this._focusX = 0;
this._externalOrbit = false;
/** Optional callback when the chip list changes (manifest + GLB-baked combined). */
@@ -118,28 +119,39 @@ export class Act2Viewer {
return this._manifestPromise;
}
- /** Returns combined: GLB-baked clips + project animation manifest, deduped by name. */
+ /** Returns combined: GLB-baked clips + project animation manifest, deduped by name.
+ * When the model ships its own rich animation set (robot, etc.) those are shown
+ * exclusively — manifest clips are Mixamo-retargeted and won't work on a different skeleton.
+ */
listAvailableClips() {
+ const IDLE_RE = /idle/i;
+ const glbGoodNames = [...this.clips.keys()].filter((n) => !IDLE_RE.test(n));
+
+ /* Model has its own animations — skip manifest entirely */
+ if (glbGoodNames.length >= 3) {
+ return [...this.clips.keys()].map((name) => ({
+ name,
+ label: name,
+ icon: '✨',
+ loop: true,
+ source: 'glb',
+ }));
+ }
+
const out = [];
const seen = new Set();
- /* manifest first (these are the "preset" controls /app shows) */
+ /* manifest first (humanoid / Mixamo models like CZ) */
for (const def of this._manifest) {
if (!seen.has(def.name)) {
out.push({ ...def, source: 'manifest' });
seen.add(def.name);
}
}
- /* then GLB-baked names not already in manifest */
+ /* then any extra GLB clips not already in manifest */
for (const name of this.clips.keys()) {
if (seen.has(name)) continue;
seen.add(name);
- out.push({
- name,
- label: name,
- icon: '✨',
- loop: true,
- source: 'glb',
- });
+ out.push({ name, label: name, icon: '✨', loop: true, source: 'glb' });
}
return out;
}
@@ -151,7 +163,7 @@ export class Act2Viewer {
return AnimationClip.parse(json);
}
- async loadModel(url) {
+ async loadModel(url, { autoPlay = true } = {}) {
/* swap out previous model */
if (this.model) {
if (this.mixer) this.mixer.stopAllAction();
@@ -197,21 +209,33 @@ export class Act2Viewer {
this.onClipsReady(this.listAvailableClips());
}
- /* auto-play first idle if available */
- const startName = this._pickStartName();
- if (startName) await this.playClip(startName);
+ /* auto-play first clip unless caller wants to handle it */
+ if (autoPlay) {
+ const startName = this._pickStartName();
+ if (startName) await this.playClip(startName);
+ }
return this.model;
}
_pickStartName() {
- const SKIP = ['idle', 'silly'];
+ const SKIP_RE = /idle|silly/i;
const all = this.listAvailableClips();
+ /* When model uses its own GLB clips, pick a lively one from those */
+ if (all.length && all[0].source === 'glb') {
+ const PREFERRED = ['Dance', 'Wave', 'Jump', 'Punch', 'Running', 'ThumbsUp'];
+ for (const p of PREFERRED) {
+ const match = all.find((c) => c.name === p);
+ if (match) return match.name;
+ }
+ return all.find((c) => !SKIP_RE.test(c.name))?.name || all[0]?.name || null;
+ }
+ /* Humanoid / manifest models */
for (const preferred of ['dance', 'rumba', 'capoeira', 'wave', 'thriller']) {
const match = all.find((c) => c.name === preferred);
if (match) return match.name;
}
- return all.find((c) => !SKIP.some(s => c.name.toLowerCase().includes(s)))?.name || all[0]?.name || null;
+ return all.find((c) => !SKIP_RE.test(c.name))?.name || all[0]?.name || null;
}
async playClip(name) {
@@ -254,7 +278,7 @@ export class Act2Viewer {
this._modelFocusY + radius * cosPhi,
radius * sinPhi * Math.cos(theta),
);
- this.camera.lookAt(0, this._modelFocusY, 0);
+ this.camera.lookAt(this._focusX, this._modelFocusY, 0);
}
setExposure(v) {
diff --git a/src/viewer.js b/src/viewer.js
index 39400f7b6..085c0e444 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -312,6 +312,10 @@ export class Viewer {
const target = new Vector3(bbCenter.x, focusY, bbCenter.z);
const pos = new Vector3(bbCenter.x + dist * 0.12, focusY, bbCenter.z + dist);
+ const bias = this._panelBiasY(dist);
+ target.y -= bias;
+ pos.y -= bias;
+
if (animate) {
this._tweenCamera(pos, target, durationMs);
} else {
@@ -322,6 +326,17 @@ export class Viewer {
}
}
+ /** Returns the Y world-space shift needed to keep the model above the animation panel. */
+ _panelBiasY(dist) {
+ if (!this._animPanelEl) return 0;
+ const panelH = this._animPanelEl.offsetHeight;
+ const bottom = parseFloat(getComputedStyle(this._animPanelEl).bottom) || 0;
+ const canvasH = this.renderer.domElement.clientHeight;
+ if (!canvasH) return 0;
+ const frac = (panelH + bottom) / canvasH;
+ return frac * Math.tan((this.defaultCamera.fov / 2) * (Math.PI / 180)) * dist;
+ }
+
// Smooth ease-out camera tween. Both position and OrbitControls.target
// are interpolated together so the framing stays correct mid-flight.
_tweenCamera(toPos, toTarget, durationMs = 600) {
@@ -606,6 +621,19 @@ export class Viewer {
this.animationManager.attach(this.content);
this._setupAnimationPanel();
+ // Shift camera down to offset the animation panel overlay so the model
+ // isn't clipped by the panel on first load and after each model swap.
+ const panelBias = this._panelBiasY(dist);
+ if (panelBias > 0) {
+ this.controls.target.y -= panelBias;
+ this.defaultCamera.position.y -= panelBias;
+ if (this._pendingReveal) {
+ this._pendingReveal.framedPos.y -= panelBias;
+ this._pendingReveal.target.y -= panelBias;
+ }
+ this.controls.update();
+ }
+
this.updateLights();
this.updateGUI();
this.updateEnvironment();
diff --git a/vercel.json b/vercel.json
index a6d7aa53b..af20e3ac7 100644
--- a/vercel.json
+++ b/vercel.json
@@ -88,7 +88,7 @@
},
"dest": "/agent-embed.html"
},
- { "src": "/agent/([^/]+)", "dest": "/agent-home.html" },
+ { "src": "/agent/([^/]+)", "dest": "/api/agent-page?id=$1" },
{ "src": "/agent", "dest": "/agent-home.html" },
{ "src": "/api/widgets/oembed", "dest": "/api/widgets/oembed" },
@@ -201,7 +201,8 @@
{ "src": "/features/(.*)", "dest": "/features/$1" },
{ "src": "/create", "dest": "/create.html" },
{ "src": "/create/", "dest": "/create.html" },
- { "src": "/home", "dest": "/home.html" },
+ { "src": "/", "dest": "/home.html" },
+ { "src": "/home", "status": 301, "headers": { "Location": "/" } },
{ "src": "/explore", "status": 301, "headers": { "Location": "/discover" } },
{ "src": "/explore/", "status": 301, "headers": { "Location": "/discover" } },
{