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 avatar behavior with walking animation and improved drag interactions

nirholasc38ce5498e79
diff --git a/chat/src/App.svelte b/chat/src/App.svelte
index b0cbccdb0..7e240de7e 100644
--- a/chat/src/App.svelte
+++ b/chat/src/App.svelte
@@ -2344,73 +2344,74 @@
/>
{/each}
- {#if true}
- <!-- svelte-ignore a11y-no-static-element-interactions -->
- <div
- class="z-[100] flex flex-col items-end gap-2 select-none avatar-floater"
- class:cursor-grabbing={dragging}
- class:avatar-dying={avatarExitAnim === 'dying'}
- class:avatar-falling={avatarExitAnim === 'falling'}
- style={dragPos.x !== null
- ? `position: fixed; left: ${dragPos.x}px; top: ${dragPos.y}px;`
- : 'position: absolute; bottom: 0; right: 0;'}
- on:mousedown={onAvatarDragStart}
- role="none"
- >
- {#if agentPickerOpen}
- <div class="mb-1 w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-xl">
- <AgentPicker on:pick={(e) => { agentPickerOpen = false; if (!e.detail) clearAgentFromConvo(); }} />
- </div>
- {/if}
+ </ul>
+ </div>
- {#if thinkingMessage && agentVisible}
- <div
- class="thought-bubble"
- class:thought-bubble-collapsed={!thoughtBubbleActive}
- role="status"
- aria-live="polite"
- >
- <div class="thought-bubble-header">
- <span class="thought-bubble-dot" class:idle={!thoughtBubbleActive} />
- <span class="thought-bubble-label">
- {thoughtBubbleActive ? 'Thinking' : 'Thought'} for {thoughtBubbleSeconds}s
- </span>
- </div>
- {#if thoughtBubbleActive}
- <div class="thought-bubble-body" bind:this={thoughtBubbleEl}>
- {#if thoughtBubbleText}
- {thoughtBubbleText}
- {:else}
- <span class="thought-bubble-placeholder">Reasoning…</span>
- {/if}
- </div>
- {/if}
- <span class="thought-bubble-tail thought-bubble-tail-1" />
- <span class="thought-bubble-tail thought-bubble-tail-2" />
- </div>
- {/if}
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
+ <div
+ class="z-[100] flex flex-col items-end gap-2 select-none avatar-floater"
+ class:cursor-grabbing={dragging}
+ class:avatar-dying={avatarExitAnim === 'dying'}
+ class:avatar-falling={avatarExitAnim === 'falling'}
+ class:avatar-walking={generating && !thoughtBubbleActive && agentReady && !avatarExitAnim && dragPos.x === null}
+ style={dragPos.x !== null
+ ? `position: fixed; left: ${dragPos.x}px; top: ${dragPos.y}px;`
+ : 'position: absolute; bottom: 128px; right: 0; pointer-events: none;'}
+ on:mousedown={onAvatarDragStart}
+ role="none"
+ >
+ {#if agentPickerOpen}
+ <div class="mb-1 w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-xl" style="pointer-events: auto;">
+ <AgentPicker on:pick={(e) => { agentPickerOpen = false; if (!e.detail) clearAgentFromConvo(); }} />
+ </div>
+ {/if}
- {#if effectiveAgentId && agentVisible}
- <!-- svelte-ignore custom-element-no-implicit-ns -->
- <agent-3d
- bind:this={agentEl}
- agent-id={effectiveAgentId}
- mode="inline"
- width="300"
- height="460"
- background="transparent"
- kiosk
- name-plate="off"
- style="width:300px;height:460px; cursor: grab;"
- ></agent-3d>
- {:else if $talkingHeadEnabled && agentVisible}
- <div style="cursor: grab;">
- <TalkingHead bind:this={talkingHead} on:ready={onTalkingHeadReady} avatarUrl={$talkingHeadAvatarUrl || undefined} />
- </div>
- {/if}
+ {#if thinkingMessage && agentVisible}
+ <div
+ class="thought-bubble"
+ class:thought-bubble-collapsed={!thoughtBubbleActive}
+ role="status"
+ aria-live="polite"
+ style="pointer-events: auto;"
+ >
+ <div class="thought-bubble-header">
+ <span class="thought-bubble-dot" class:idle={!thoughtBubbleActive} />
+ <span class="thought-bubble-label">
+ {thoughtBubbleActive ? 'Thinking' : 'Thought'} for {thoughtBubbleSeconds}s
+ </span>
</div>
- {/if}
- </ul>
+ {#if thoughtBubbleActive}
+ <div class="thought-bubble-body" bind:this={thoughtBubbleEl}>
+ {#if thoughtBubbleText}
+ {thoughtBubbleText}
+ {:else}
+ <span class="thought-bubble-placeholder">Reasoning…</span>
+ {/if}
+ </div>
+ {/if}
+ <span class="thought-bubble-tail thought-bubble-tail-1" />
+ <span class="thought-bubble-tail thought-bubble-tail-2" />
+ </div>
+ {/if}
+
+ {#if effectiveAgentId && agentVisible}
+ <!-- svelte-ignore custom-element-no-implicit-ns -->
+ <agent-3d
+ bind:this={agentEl}
+ agent-id={effectiveAgentId}
+ mode="inline"
+ width="420"
+ height="700"
+ background="transparent"
+ kiosk
+ name-plate="off"
+ style="width:420px;height:700px; cursor: grab; pointer-events: auto;"
+ ></agent-3d>
+ {:else if $talkingHeadEnabled && agentVisible}
+ <div style="cursor: grab; pointer-events: auto;">
+ <TalkingHead bind:this={talkingHead} on:ready={onTalkingHeadReady} avatarUrl={$talkingHeadAvatarUrl || undefined} />
+ </div>
+ {/if}
</div>
<div class="pointer-events-none absolute bottom-[72px] inset-x-0 h-8 z-[98] bg-gradient-to-t from-paper to-transparent" />
@@ -2627,6 +2628,20 @@
.avatar-floater {
transition: transform 1100ms cubic-bezier(0.55, 0, 0.7, 0.2), opacity 1100ms ease-in;
}
+ .avatar-walking {
+ animation: avatar-walk-bob 720ms ease-in-out infinite;
+ transition: none;
+ }
+ @keyframes avatar-walk-bob {
+ 0% { transform: translateY(0) rotate(-1.2deg); }
+ 25% { transform: translateY(-6px) rotate(0deg); }
+ 50% { transform: translateY(0) rotate(1.2deg); }
+ 75% { transform: translateY(-6px) rotate(0deg); }
+ 100% { transform: translateY(0) rotate(-1.2deg); }
+ }
+ @media (prefers-reduced-motion: reduce) {
+ .avatar-walking { animation: none; }
+ }
.avatar-dying {
transform: translateY(120vh) rotate(35deg);
opacity: 0;
diff --git a/public/chat/index.html b/public/chat/index.html
index a2571cd48..a9156935c 100644
--- a/public/chat/index.html
+++ b/public/chat/index.html
@@ -43,8 +43,8 @@
}
}
</script>
- <script type="module" crossorigin src="/chat/assets/index-CX9MqNAG.js"></script>
- <link rel="stylesheet" crossorigin href="/chat/assets/index-DApZtL3z.css">
+ <script type="module" crossorigin src="/chat/assets/index-Dj9gh9YN.js"></script>
+ <link rel="stylesheet" crossorigin href="/chat/assets/index-D1vNZkK2.css">
</head>
<body>
<div id="app"></div>
diff --git a/src/viewer.js b/src/viewer.js
index 0d3c542fd..e267e32dd 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -315,8 +315,8 @@ export class Viewer {
const panelFrac = this._panelFrac();
const usableFrac = Math.max(1 - panelFrac, 0.55);
- // Fit full avatar into usable area with 5% breathing room.
- const extentV = (bbSize.y / 2) / usableFrac * 1.05;
+ // Fit full avatar into usable area with breathing room above/below.
+ const extentV = (bbSize.y / 2) / usableFrac * 1.10;
const distV = extentV / Math.tan(vFovRad / 2);
const distH = (bbSize.x / 2 * 1.05) / Math.tan(hFovRad / 2);
const dist = Math.max(distV, distH);
@@ -643,13 +643,13 @@ export class Viewer {
const usableFrac = Math.max(1 - panelFrac, 0.55);
// Compute camera distance so the full avatar fits in the usable viewport
- // area (above the animation panel) with 2% breathing room.
+ // area (above the animation panel) with breathing room above/below.
const bbSize = box.getSize(new Vector3());
const vFovRad = this.defaultCamera.fov * (Math.PI / 180);
const aspect = Math.max(this.defaultCamera.aspect, 0.01);
const hFovRad = 2 * Math.atan(Math.tan(vFovRad / 2) * aspect);
- const extentV = (bbSize.y / 2) / usableFrac * 1.02;
+ const extentV = (bbSize.y / 2) / usableFrac * 1.10;
const distV = extentV / Math.tan(vFovRad / 2);
const distH = (bbSize.x / 2) / Math.tan(hFovRad / 2);
const dist = Math.max(distV, distH);