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.

Walk avatars perform on command: emote rail in the playground, SDK 0.3.0

nirholas85dfebffc40f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 370eedbe4..9471b56d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Object Library** (`/objects`) — Hundreds of free CC0 3D objects and props: furniture, lighting, electronics, decor. Public domain, no attribution required. Preview live, place it in your room with AR, or download the GLB.
- **3D viewers now hold the angle you choose** — Dragging a model in any 3D viewer now stops the auto-spin for good, so you can actually study the back of a model instead of watching the turntable carry it away from you. Every viewer across the site (model pages, avatar pages, the marketplace, creation previews) picks up the fix, keyboard orbiting counts too, and display-only showcase turntables keep their idle spin. `[fix, improvement]`
- **A free CC0 object library: hundreds of props, ready to drop in** — A new Object Library brings hundreds of free 3D objects and props to three.ws - furniture, lighting, electronics, containers, decor. Every one is CC0 public domain: free to use commercially with no attribution. Browse them at /objects, preview any one live in your browser, or download the GLB to use anywhere. (`/objects`) `[feature]`
+- **Emote buttons: your walking avatar performs on command** — The avatar that walks over three.ws pages just got a performance kit. Round buttons on the right edge of the screen (or the 1-4 keys) make it dance, throw a muay thai combo, backflip, or wave, mid-stroll, mid-platforming, anywhere on the page. Every avatar in the cast supports it, including your own generated ones, and the buttons adapt to what each character can actually do. Site owners get the same feature free in the @three-ws/walk SDK 0.3.0, so any website's companion can now put on a show. (`/?walk=play`) `[feature, sdk]`
- **Installing a marketplace skill now actually teaches your agent** — Skills from the marketplace used to install into the void: you clicked Install, a badge flipped, and nothing changed. Now every knowledge skill you install loads its playbook into your agent's context in every signed-in chat, so an install visibly changes how your agent answers (install whale-wallet-tracking and ask about a token's whales to see it). Skill pages also explain what installing does up front and, once installed, hand you a 'Chat with your agent' shortcut. Developers can pull their full installed set, playbooks included, from GET /api/skills?installed=true. (`/marketplace?tab=skills`) `[feature, improvement]`
- **Marketplace: submitting an agent no longer means typing a form** — The Submit Agent flow on /marketplace is now a chooser instead of a wall of text fields. The primary path sends you to the guided agent builder (3D avatar, persona, publish); a second path lists the agents you already have, with drafts publishable in one click right from the dialog; the old manual form and JSON import stay available behind an Advanced toggle. The featured hero is more compact so search and listings are visible without scrolling, the signed-out My Agents view got a proper call to action, and related agents on detail pages now show their 3D thumbnails. (`/marketplace`) `[improvement]`
- **Object Library props now place straight into AR Studio** — The CC0 Object Library and AR Studio are now wired together. Every prop card on /objects has an AR button that opens the model in AR Studio, ready to place in your room through your camera. Inside AR Studio, a new Objects tab in the model tray lets you search all the CC0 props by name or category and tap any of them into your scene alongside your forged models. (`/ar/studio`) `[improvement, feature]`
diff --git a/data/changelog.json b/data/changelog.json
index 9e54e622a..e2185e3ab 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -15337,6 +15337,16 @@
],
"link": "/play"
},
+ {
+ "date": "2026-07-21",
+ "title": "Emote buttons: your walking avatar performs on command",
+ "summary": "The avatar that walks over three.ws pages just got a performance kit. Round buttons on the right edge of the screen (or the 1-4 keys) make it dance, throw a muay thai combo, backflip, or wave, mid-stroll, mid-platforming, anywhere on the page. Every avatar in the cast supports it, including your own generated ones, and the buttons adapt to what each character can actually do. Site owners get the same feature free in the @three-ws/walk SDK 0.3.0, so any website's companion can now put on a show.",
+ "tags": [
+ "feature",
+ "sdk"
+ ],
+ "link": "/?walk=play"
+ },
{
"date": "2026-07-21",
"title": "The sniper fleet gets a BOOST-window arm",
diff --git a/public/changelog.json b/public/changelog.json
index c1d0ef714..aa59e8726 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-21T18:46:52.807Z",
+ "generated_at": "2026-07-21T19:30:32.066Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -57,6 +57,17 @@
"feature"
]
},
+ {
+ "date": "2026-07-21",
+ "type": "update",
+ "title": "Emote buttons: your walking avatar performs on command",
+ "summary": "The avatar that walks over three.ws pages just got a performance kit. Round buttons on the right edge of the screen (or the 1-4 keys) make it dance, throw a muay thai combo, backflip, or wave, mid-stroll, mid-platforming, anywhere on the page. Every avatar in the cast supports it, including your own generated ones, and the buttons adapt to what each character can actually do. Site owners get the same feature free in the @three-ws/walk SDK 0.3.0, so any website's companion can now put on a show.",
+ "link": "/?walk=play",
+ "tags": [
+ "feature",
+ "sdk"
+ ]
+ },
{
"date": "2026-07-21",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index a6e6ca36c..6522facaf 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -46,6 +46,14 @@
<category>feature</category>
<description>A new Object Library brings hundreds of free 3D objects and props to three.ws - furniture, lighting, electronics, containers, decor. Every one is CC0 public domain: free to use commercially with no attribution. Browse them at /objects, preview any one live in your browser, or download the GLB to use anywhere.</description>
</item>
+ <item>
+ <title>Emote buttons: your walking avatar performs on command</title>
+ <link>https://three.ws/?walk=play</link>
+ <guid isPermaLink="false">2026-07-21:Emote buttons: your walking avatar performs on command</guid>
+ <pubDate>Tue, 21 Jul 2026 12:00:00 GMT</pubDate>
+ <category>feature</category>
+ <description>The avatar that walks over three.ws pages just got a performance kit. Round buttons on the right edge of the screen (or the 1-4 keys) make it dance, throw a muay thai combo, backflip, or wave, mid-stroll, mid-platforming, anywhere on the page. Every avatar in the cast supports it, including your own generated ones, and the buttons adapt to what each character can actually do. Site owners get the same feature free in the @three-ws/walk SDK 0.3.0, so any website's companion can now put on a show.</description>
+ </item>
<item>
<title>Installing a marketplace skill now actually teaches your agent</title>
<link>https://three.ws/marketplace?tab=skills</link>
diff --git a/public/features.json b/public/features.json
index 1aa0ebebc..6ab330fea 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-21T14:12:39.541Z",
+ "generated_at": "2026-07-21T19:30:32.051Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/walk-sdk/README.md b/walk-sdk/README.md
index 21bd76a75..a7b23ba20 100644
--- a/walk-sdk/README.md
+++ b/walk-sdk/README.md
@@ -85,6 +85,27 @@ Each roster entry declares a rig strategy so it always moves:
The same unified loader powers both the corner companion and the playground, so
adding an avatar makes it work everywhere at once.
+### Emotes
+
+In the playground, big round buttons pinned to the right edge make the
+character **perform on command**: dance, punch (a muay thai combo), backflip,
+and wave, with the number keys `1`-`4` as shortcuts. Only emotes the current rig
+can actually play get a button: shared rigs resolve them against the animation
+manifest (`DEFAULT_EMOTES`, overridable per entry with `emotes`), embedded rigs
+match their baked clip names (`Dance`, `Punch`, `Wave`, …). Looping clips
+perform one capped pass, then the character settles back into whatever it was
+doing. The rail rebuilds automatically when the visitor swaps avatars.
+
+```js
+// Give a custom shared-rig avatar its own dance:
+{ id: 'mascot', rig: 'shared', asset: '/brand/mascot.glb', source: 'static',
+ emotes: { dance: 'av-dance-shuffle' } }
+
+// Or drive emotes programmatically from a loaded controller:
+controller.emotes(); // e.g. ['dance', 'punch', 'wave']
+controller.playEmote('dance'); // true if it played, false if unsupported
+```
+
### Custom roster
```js
@@ -202,6 +223,7 @@ import { loadWalkAvatar, getAvatar } from '@three-ws/walk';
const { model, controller } = await loadWalkAvatar(getAvatar('xbot'));
scene.add(model);
+controller.playEmote('punch'); // one-shot performance, then back to base
// each frame:
controller.setState('walk'); // 'idle' | 'walk' | 'run' | 'jump'
controller.update(dt);
diff --git a/walk-sdk/package.json b/walk-sdk/package.json
index a0bcbf888..671699898 100644
--- a/walk-sdk/package.json
+++ b/walk-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@three-ws/walk",
- "version": "0.2.1",
+ "version": "0.3.0",
"description": "A diverse, animated 3D avatar that walks and talks over your web pages — corner companion + full-page playground, with a built-in avatar picker. Powered by Three.js.",
"keywords": [
"3d",
diff --git a/walk-sdk/src/index.js b/walk-sdk/src/index.js
index 575ceeefd..643f6906e 100644
--- a/walk-sdk/src/index.js
+++ b/walk-sdk/src/index.js
@@ -19,7 +19,7 @@
//
// `three` is a peer dependency — bring your own copy.
-export const VERSION = '0.2.0';
+export const VERSION = '0.3.0';
// Companion (corner mascot) — the main entry point.
export { createWalkCompanion } from './companion.js';
@@ -41,6 +41,7 @@ export {
WALK_AVATARS,
DEFAULT_AVATAR_ID,
DEFAULT_SHARED_CLIPS,
+ DEFAULT_EMOTES,
getAvatar,
defaultAvatar,
listCategories,
@@ -52,5 +53,5 @@ export {
export { createAvatarPicker } from './picker.js';
// Low-level building blocks for advanced integrations.
-export { loadWalkAvatar } from './internal/load-avatar.js';
+export { loadWalkAvatar, resolveEmotes } from './internal/load-avatar.js';
export { resolveConfig, resolveAvatarEntry, DEFAULT_EXCLUDED_PREFIXES } from './config.js';
diff --git a/walk-sdk/src/internal/load-avatar.js b/walk-sdk/src/internal/load-avatar.js
index 92baebdab..9774840d8 100644
--- a/walk-sdk/src/internal/load-avatar.js
+++ b/walk-sdk/src/internal/load-avatar.js
@@ -3,8 +3,9 @@
// One entry point used by BOTH the corner companion and the full-page
// playground, so adding an avatar to the roster makes it work everywhere at
// once. Given a roster entry it loads the GLB and returns a controller with a
-// single interface — setState('idle'|'walk'|'run'|'jump') + playWave() — no
-// matter how the rig is animated underneath:
+// single interface, setState('idle'|'walk'|'run'|'jump') + playWave() plus
+// emotes() / playEmote(name) for on-command performances, no matter how the
+// rig is animated underneath:
//
// • embedded rigs play the clips baked into the GLB (robot, fox, showpieces),
// with loose name matching that always falls back to the model's first clip
@@ -20,10 +21,40 @@ import { getMeshoptDecoder } from './meshopt.js';
import { AnimationManager } from './runtime.js';
import { resolveClipUrls } from './manifest.js';
import { log } from './log.js';
-import { resolveAvatarUrl, DEFAULT_SHARED_CLIPS } from '../roster.js';
+import { resolveAvatarUrl, DEFAULT_SHARED_CLIPS, DEFAULT_EMOTES } from '../roster.js';
const DEFAULT_WAVE_MS = 1500;
+// A looping emote clip (dance, headbang) performs one capped pass before the
+// controller settles back to its base state: a tap is a performance, not a
+// permanent mode switch.
+const EMOTE_MAX_MS = 8000;
+
+// Baked-clip name candidates per emote for embedded rigs, matched with the same
+// loose case-insensitive lookup as the locomotion states. RobotExpressive (the
+// default mascot) ships Dance/Punch/Wave; rigs missing a clip simply don't
+// list that emote, and the UI hides its button.
+const EMBEDDED_EMOTE_CANDIDATES = {
+ dance: ['Dance'],
+ punch: ['Punch'],
+ backflip: ['Backflip', 'BackFlip', 'Back Flip', 'back_flip'],
+ wave: ['Wave'],
+};
+
+/**
+ * Resolve an emote map ({name: clip}) against the set of clips that actually
+ * exist, dropping emotes whose clip is missing so a UI can render only buttons
+ * that work. Pure; exported for tests.
+ */
+export function resolveEmotes(availableClipNames, emotes = DEFAULT_EMOTES) {
+ const available = new Set(availableClipNames);
+ const out = {};
+ for (const [name, clip] of Object.entries(emotes)) {
+ if (clip && available.has(clip)) out[name] = clip;
+ }
+ return out;
+}
+
// Thrown by buildSharedController when the attached rig can't be driven by the
// shared clip library (no skinned humanoid skeleton). loadWalkAvatar catches it
// to recover to baked clips or the default rig — never a frozen T-pose.
@@ -88,6 +119,7 @@ export async function loadWalkAvatar(entry, opts = {}) {
controller = await buildSharedController(model, active.clips || DEFAULT_SHARED_CLIPS, {
manifestUrl,
waveMs,
+ emotes: active.emotes,
});
} else {
controller = makeEmbeddedController(model, gltf.animations || [], active.clips || {}, {
@@ -176,6 +208,14 @@ function makeEmbeddedController(root, clips, overrides, { waveMs }) {
wave: pick([...ov('wave'), 'Wave', 'wave']) || null,
};
+ // Emotes resolve against the same baked clips; a rig without a matching clip
+ // simply doesn't list that emote, so UIs can hide dead buttons.
+ const emoteClip = {};
+ for (const [name, cands] of Object.entries(EMBEDDED_EMOTE_CANDIDATES)) {
+ const clip = pick([...ov(name), ...cands]);
+ if (clip) emoteClip[name] = clip;
+ }
+
const action = {};
for (const [state, clip] of Object.entries(map)) {
if (!clip) continue;
@@ -183,14 +223,19 @@ function makeEmbeddedController(root, clips, overrides, { waveMs }) {
a.enabled = true;
action[state] = a;
}
+ const emoteAction = {};
+ for (const [name, clip] of Object.entries(emoteClip)) {
+ const a = mixer.clipAction(clip);
+ a.enabled = true;
+ emoteAction[name] = a;
+ }
let base = 'idle';
let requested = 'idle';
let current = null;
let oneShot = false;
- function crossfade(name, { once = false, dur = 0.3 } = {}) {
- const a = action[name] || action.idle;
+ function fadeTo(a, { once = false, dur = 0.3 } = {}) {
if (!a) return;
a.reset();
a.setLoop(once ? LoopOnce : LoopRepeat, once ? 1 : Infinity);
@@ -200,6 +245,10 @@ function makeEmbeddedController(root, clips, overrides, { waveMs }) {
current = a;
}
+ function crossfade(name, opts) {
+ fadeTo(action[name] || action.idle, opts);
+ }
+
mixer.addEventListener('finished', () => {
if (oneShot) {
oneShot = false;
@@ -223,20 +272,32 @@ function makeEmbeddedController(root, clips, overrides, { waveMs }) {
base = next;
if (!oneShot) crossfade(base, { dur: 0.22 });
},
- playWave() {
- if (!action.wave || oneShot) return;
+ // Names this rig can actually perform; render only these as buttons.
+ emotes() {
+ return Object.keys(emoteAction);
+ },
+ // Play an emote once, then settle back to the current base state. A tap
+ // mid-emote switches to the new one. Returns false when unsupported.
+ playEmote(name) {
+ const a = emoteAction[name];
+ if (!a) return false;
oneShot = true;
- crossfade('wave', { once: true, dur: 0.25 });
+ fadeTo(a, { once: true, dur: 0.2 });
// Safety net: if the 'finished' event is missed (clip stripped of its
// end key, etc.), still fall back to the base after the clip's length.
- const len = action.wave.getClip().duration * 1000 || waveMs;
- clearTimeout(this._waveGuard);
- this._waveGuard = setTimeout(() => {
+ const len = a.getClip().duration * 1000 || waveMs;
+ clearTimeout(this._emoteGuard);
+ this._emoteGuard = setTimeout(() => {
if (oneShot) {
oneShot = false;
crossfade(base, { dur: 0.25 });
}
- }, len + 250);
+ }, Math.min(len, EMOTE_MAX_MS) + 250);
+ return true;
+ },
+ playWave() {
+ if (oneShot) return;
+ this.playEmote('wave');
},
// Scale playback rate of every action (global mixer multiplier) so a walk
// cycle can be sped up/slowed to match actual travel speed and keep feet
@@ -248,7 +309,7 @@ function makeEmbeddedController(root, clips, overrides, { waveMs }) {
mixer.update(dt);
},
dispose() {
- clearTimeout(this._waveGuard);
+ clearTimeout(this._emoteGuard);
mixer.stopAllAction();
mixer.uncacheRoot(root);
},
@@ -256,7 +317,7 @@ function makeEmbeddedController(root, clips, overrides, { waveMs }) {
}
// ── Shared retargeted-clip controller (rig: 'shared') ────────────────────────
-async function buildSharedController(model, clips, { manifestUrl, waveMs }) {
+async function buildSharedController(model, clips, { manifestUrl, waveMs, emotes }) {
const manager = new AnimationManager();
manager.attach(model);
@@ -274,12 +335,15 @@ async function buildSharedController(model, clips, { manifestUrl, waveMs }) {
}
const resolved = {};
+ let resolvedEmotes = {};
+ const clipMs = new Map();
try {
const manifest = await fetch(manifestUrl, { cache: 'force-cache' }).then((r) => {
if (!r.ok) throw new Error(`HTTP ${r.status} fetching animation manifest`);
return r.json();
}).then((defs) => resolveClipUrls(defs, manifestUrl));
const available = new Set(manifest.map((d) => d.name));
+ for (const d of manifest) clipMs.set(d.name, (Number(d.duration) || 0) * 1000);
// Resolve each requested clip to one that actually exists; unknown names fall
// back to idle so the controller never asks the manager for a missing clip.
@@ -290,7 +354,11 @@ async function buildSharedController(model, clips, { manifestUrl, waveMs }) {
if (!resolved.idle) throw new Error('animation manifest missing an idle clip');
for (const k of Object.keys(resolved)) if (!resolved[k]) resolved[k] = resolved.idle;
- const wanted = new Set(Object.values(resolved));
+ // Emotes never fall back to idle: a missing clip drops the emote instead,
+ // so every rendered emote button visibly performs.
+ resolvedEmotes = resolveEmotes(available, { ...DEFAULT_EMOTES, ...(emotes || {}) });
+
+ const wanted = new Set([...Object.values(resolved), ...Object.values(resolvedEmotes)]);
manager.setAnimationDefs(manifest.filter((d) => wanted.has(d.name)));
await manager.loadAll();
} catch (err) {
@@ -312,10 +380,31 @@ async function buildSharedController(model, clips, { manifestUrl, waveMs }) {
base = next;
if (!waveTimer) fade(clipFor(next), next === 'jump' ? 0.12 : 0.3);
},
+ // Names this rig can actually perform; render only these as buttons.
+ emotes() {
+ return Object.keys(resolvedEmotes);
+ },
+ // Play an emote once (loops get one capped pass), then settle back to the
+ // base state. A tap mid-emote switches to the new one. False = unsupported.
+ playEmote(name) {
+ const clip = resolvedEmotes[name];
+ if (!clip || clip === resolved.idle) return false;
+ clearTimeout(waveTimer);
+ fade(clip, 0.25);
+ const len = clipMs.get(clip) || waveMs;
+ waveTimer = setTimeout(() => {
+ waveTimer = null;
+ fade(clipFor(base), 0.3);
+ }, Math.min(len, EMOTE_MAX_MS) + 150);
+ return true;
+ },
playWave() {
if (waveTimer) return;
+ if (this.playEmote('wave')) return;
+ // No wave emote resolved (host stripped it): fall back to the state
+ // map's wave clip so nav-waves keep working exactly as before.
const w = resolved.wave;
- if (!w || w === resolved.idle) return; // no distinct wave clip → skip
+ if (!w || w === resolved.idle) return;
fade(w, 0.25);
waveTimer = setTimeout(() => {
waveTimer = null;
diff --git a/walk-sdk/src/playground.js b/walk-sdk/src/playground.js
index 8411a492b..6a1b569aa 100644
--- a/walk-sdk/src/playground.js
+++ b/walk-sdk/src/playground.js
@@ -257,6 +257,61 @@ function pickButtonHTML() {
return `<button type="button" class="walk-pg-pick" data-walk-picker-toggle aria-label="Choose your avatar" title="Choose avatar (C)"><span class="walk-pg-pick-ic" aria-hidden="true">🧑</span><span class="walk-pg-pick-tx">Avatar</span></button>`;
}
+// ── Emote rail (shared by both movement modes) ───────────────────────────────
+// The big round tap-to-perform buttons pinned to the right edge: dance, punch,
+// backflip, wave. Rendered only for emotes the CURRENT rig actually supports
+// (controller.emotes()), so every visible button performs; rebuilt on avatar
+// swap. Number keys 1-4 mirror the buttons.
+const EMOTE_BUTTONS = [
+ { name: 'dance', icon: '🕺', label: 'Dance', key: '1' },
+ { name: 'punch', icon: '👊', label: 'Punch', key: '2' },
+ { name: 'backflip', icon: '🤸', label: 'Backflip', key: '3' },
+ { name: 'wave', icon: '👋', label: 'Wave', key: '4' },
+];
+
+function buildEmoteRail(pg) {
+ if (!pg.host) return;
+ pg.host.querySelector('.walk-pg-emotes')?.remove();
+ const supported = pg.controller?.emotes?.() || [];
+ const buttons = EMOTE_BUTTONS.filter((b) => supported.includes(b.name));
+ if (!buttons.length) return;
+ const rail = document.createElement('div');
+ rail.className = 'walk-pg-emotes';
+ rail.setAttribute('role', 'toolbar');
+ rail.setAttribute('aria-label', 'Emotes: make the character perform');
+ rail.innerHTML = buttons
+ .map(
+ (b) =>
+ `<button type="button" class="walk-pg-emote" data-emote="${b.name}" aria-label="${b.label}" title="${b.label} (${b.key})"><span aria-hidden="true">${b.icon}</span></button>`,
+ )
+ .join('');
+ rail.addEventListener('click', (e) => {
+ const btn = e.target.closest('.walk-pg-emote');
+ if (btn) triggerEmote(pg, btn.getAttribute('data-emote'));
+ });
+ pg.host.appendChild(rail);
+}
+
+function triggerEmote(pg, name) {
+ if (pg._diving || pg._narrating) return;
+ if (!pg.controller?.playEmote?.(name)) return;
+ const btn = pg.host?.querySelector(`.walk-pg-emote[data-emote="${name}"]`);
+ if (btn) {
+ btn.classList.remove('is-playing');
+ void btn.offsetWidth; // restart the pop on a repeat tap
+ btn.classList.add('is-playing');
+ }
+}
+
+// Number-key shortcut shared by both modes' keydown handlers. Returns true when
+// the key mapped to a rendered emote (so the caller preventDefaults it).
+function emoteHotkey(pg, key) {
+ const btn = EMOTE_BUTTONS.find((b) => b.key === key);
+ if (!btn || !pg.host?.querySelector(`.walk-pg-emote[data-emote="${btn.name}"]`)) return false;
+ triggerEmote(pg, btn.name);
+ return true;
+}
+
// Free a model's GPU resources (geometries, materials, textures) when it leaves
// the rig after a live avatar swap. Mirrors the per-mesh disposal in teardown.
function disposeModel(model) {
@@ -321,6 +376,7 @@ async function swapAvatar(pg, idOrEntry) {
pg.controller = next.controller;
pg.modelHalfW = next.halfW;
if (typeof pg._shadowR === 'number') pg._shadowR = Math.max(22, next.halfW * 1.15);
+ buildEmoteRail(pg); // the new rig may support a different emote set
pg._say?.(`Say hi to ${entry.name}!`);
} catch (err) {
log.warn('avatar swap failed:', err?.message || err);
@@ -457,6 +513,7 @@ class StrollPlayground {
return;
}
if (!this.mounted) { this._teardown(); return; }
+ buildEmoteRail(this);
this._placeStart(startScreen, dropIn);
questBuild(this);
this._spawnGuardUntil = performance.now() + SPAWN_GUARD_MS;
@@ -680,6 +737,10 @@ class StrollPlayground {
openAvatarPicker(this);
return;
}
+ if (emoteHotkey(this, k)) {
+ e.preventDefault();
+ return;
+ }
let handled = true;
if (k === 'ArrowLeft' || k === 'a' || k === 'A') this.input.left = true;
else if (k === 'ArrowRight' || k === 'd' || k === 'D') this.input.right = true;
@@ -974,6 +1035,7 @@ class PlatformerPlayground {
return;
}
if (!this.mounted) { this._teardown(); return; }
+ buildEmoteRail(this);
this._scrollY = window.scrollY || 0;
this._scan(true);
this._placeStart(startScreen, dropIn);
@@ -1232,6 +1294,10 @@ class PlatformerPlayground {
openAvatarPicker(this);
return;
}
+ if (emoteHotkey(this, k)) {
+ e.preventDefault();
+ return;
+ }
let handled = true;
if (k === 'ArrowLeft' || k === 'a' || k === 'A') this.input.left = true;
else if (k === 'ArrowRight' || k === 'd' || k === 'D') this.input.right = true;
@@ -1559,13 +1625,21 @@ function ensureStyles() {
.walk-pg--plat .walk-pg-pad{position:fixed;left:0;right:0;bottom:18px;z-index:3;display:none;justify-content:center;gap:12px;pointer-events:none}
.walk-pg--plat .walk-pg-btn{width:60px;height:60px;border-radius:50%;font-size:22px}
.walk-pg-jump{background:rgba(122,162,255,.32)}
+.walk-pg-emotes{position:fixed;right:14px;top:50%;transform:translateY(-50%);z-index:3;display:flex;flex-direction:column;gap:10px;pointer-events:none}
+.walk-pg-emote{pointer-events:auto;width:54px;height:54px;border-radius:50%;border:1px solid rgba(255,255,255,.18);background:rgba(16,18,26,.78);color:#fff;font-size:24px;line-height:1;display:grid;place-items:center;cursor:pointer;backdrop-filter:blur(6px);transition:background .2s ease,transform .15s ease;-webkit-user-select:none;user-select:none;touch-action:manipulation;padding:0}
+.walk-pg-emote:hover{background:rgba(122,162,255,.55);transform:scale(1.06)}
+.walk-pg-emote:active{transform:scale(.92)}
+.walk-pg-emote:focus-visible{outline:2px solid #7aa2ff;outline-offset:2px}
+.walk-pg-emote.is-playing{animation:walk-pg-emote-pop .45s ease}
+@keyframes walk-pg-emote-pop{0%{transform:scale(1)}40%{transform:scale(1.22)}100%{transform:scale(1)}}
+@media (max-width:520px){.walk-pg-emotes{right:10px;gap:8px}.walk-pg-emote{width:46px;height:46px;font-size:20px}}
.walk-pg-flash{position:fixed;inset:0;z-index:2;pointer-events:none;background:radial-gradient(circle at 50% 50%,rgba(122,162,255,0) 0%,rgba(8,10,16,0) 60%);opacity:0;transition:opacity .5s ease}
.walk-pg-flash.is-on{background:radial-gradient(circle at 50% 50%,rgba(122,162,255,.25) 0%,rgba(6,8,14,.96) 70%);opacity:1}
.walk-pg-portal{outline:2px solid rgba(122,162,255,.9)!important;outline-offset:3px;border-radius:6px;box-shadow:0 0 0 4px rgba(122,162,255,.18),0 0 28px rgba(122,162,255,.45)!important;transition:box-shadow .2s ease,transform .25s ease;animation:walk-pg-pulse 1.1s ease-in-out infinite}
.walk-pg-portal.is-open{transform:scale(.94);box-shadow:0 0 0 6px rgba(122,162,255,.3),0 0 48px rgba(122,162,255,.7)!important}
@keyframes walk-pg-pulse{0%,100%{box-shadow:0 0 0 4px rgba(122,162,255,.16),0 0 22px rgba(122,162,255,.35)}50%{box-shadow:0 0 0 6px rgba(122,162,255,.3),0 0 36px rgba(122,162,255,.6)}}
@media (pointer: coarse){.walk-pg--stroll .walk-pg-pad,.walk-pg--plat .walk-pg-pad{display:flex}.walk-pg--stroll .walk-pg-hint{bottom:200px}.walk-pg--plat .walk-pg-hint{bottom:110px}.walk-pg-mode .walk-pg-mode-tx{display:none}.walk-pg-mode{right:84px}.walk-pg-pick .walk-pg-pick-tx{display:none}.walk-pg-pick{right:132px}}
-@media (prefers-reduced-motion:reduce){.walk-pg,.walk-pg-hint,.walk-pg-flash{transition:none}.walk-pg-portal{animation:none}}
+@media (prefers-reduced-motion:reduce){.walk-pg,.walk-pg-hint,.walk-pg-flash{transition:none}.walk-pg-portal,.walk-pg-emote.is-playing{animation:none}}
`;
document.head.appendChild(style);
}
diff --git a/walk-sdk/src/roster.js b/walk-sdk/src/roster.js
index 1c30726df..4c3deca03 100644
--- a/walk-sdk/src/roster.js
+++ b/walk-sdk/src/roster.js
@@ -30,6 +30,17 @@ export const DEFAULT_SHARED_CLIPS = {
jump: 'jump',
};
+// On-command performances for shared-rig avatars: emote name to manifest clip.
+// Verified present in /animations/manifest.json (walk-sdk/test/emotes.test.mjs
+// enforces this against the real manifest). A roster entry can override any of
+// them with its own `emotes` map; embedded rigs match baked clip names instead.
+export const DEFAULT_EMOTES = {
+ dance: 'dance',
+ punch: 'av-muay-thai',
+ backflip: 'av-back-flip',
+ wave: 'wave',
+};
+
export const WALK_AVATARS = [
{
id: 'robot',
@@ -70,6 +81,7 @@ export const WALK_AVATARS = [
// Michelle's GLB ships only a TPose — force the shared library and never
// touch the embedded pose. See the repo's no-T-pose rule.
clips: { ...DEFAULT_SHARED_CLIPS, wave: 'michelle-samba-dance' },
+ emotes: { ...DEFAULT_EMOTES, dance: 'michelle-samba-dance' },
accent: '#ff8fab',
tags: ['humanoid', 'feminine', 'dancer'],
},
diff --git a/walk-sdk/test/emotes.test.mjs b/walk-sdk/test/emotes.test.mjs
new file mode 100644
index 000000000..a424c21d8
--- /dev/null
+++ b/walk-sdk/test/emotes.test.mjs
@@ -0,0 +1,60 @@
+// @three-ws/walk — emote resolution.
+// ===================================
+// The playground's emote rail renders one button per emote the current rig
+// supports; a rendered button must ALWAYS visibly perform. That guarantee
+// rests on two invariants tested here:
+// 1. resolveEmotes drops any emote whose clip doesn't exist (no dead buttons,
+// no silent idle fallback).
+// 2. Every clip named in DEFAULT_EMOTES (and every roster entry's `emotes`
+// override) actually exists in the platform's animation manifest, so the
+// default cast performs out of the box.
+// Pure logic; `node --test`.
+
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { resolveEmotes } from '../src/internal/load-avatar.js';
+import { DEFAULT_EMOTES, WALK_AVATARS } from '../src/roster.js';
+
+const manifestPath = fileURLToPath(
+ new URL('../../public/animations/manifest.json', import.meta.url),
+);
+const manifestNames = new Set(JSON.parse(readFileSync(manifestPath, 'utf8')).map((d) => d.name));
+
+test('resolveEmotes keeps only emotes whose clip exists', () => {
+ const out = resolveEmotes(['dance', 'wave'], {
+ dance: 'dance',
+ punch: 'av-muay-thai',
+ wave: 'wave',
+ });
+ assert.deepEqual(out, { dance: 'dance', wave: 'wave' });
+});
+
+test('resolveEmotes never falls back to another clip for a missing one', () => {
+ const out = resolveEmotes(['idle'], DEFAULT_EMOTES);
+ assert.deepEqual(out, {});
+});
+
+test('resolveEmotes defaults to DEFAULT_EMOTES', () => {
+ const out = resolveEmotes(Object.values(DEFAULT_EMOTES));
+ assert.deepEqual(out, DEFAULT_EMOTES);
+});
+
+test('every DEFAULT_EMOTES clip exists in the shared animation manifest', () => {
+ for (const [emote, clip] of Object.entries(DEFAULT_EMOTES)) {
+ assert.ok(manifestNames.has(clip), `emote "${emote}" names missing clip "${clip}"`);
+ }
+});
+
+test('every roster emote override names a real manifest clip', () => {
+ for (const entry of WALK_AVATARS) {
+ if (!entry.emotes) continue;
+ for (const [emote, clip] of Object.entries(entry.emotes)) {
+ assert.ok(
+ manifestNames.has(clip),
+ `roster "${entry.id}" emote "${emote}" names missing clip "${clip}"`,
+ );
+ }
+ }
+});
diff --git a/walk-sdk/types/index.d.ts b/walk-sdk/types/index.d.ts
index 34c4e217f..d3a812125 100644
--- a/walk-sdk/types/index.d.ts
+++ b/walk-sdk/types/index.d.ts
@@ -9,6 +9,9 @@ export type WalkRig = 'embedded' | 'shared';
/** Logical animation states the controller understands. */
export type WalkState = 'idle' | 'walk' | 'run' | 'jump';
+/** On-command performances the controller can play (when the rig has the clip). */
+export type WalkEmote = 'dance' | 'punch' | 'backflip' | 'wave' | (string & {});
+
/** Mapping of logical states to clip names (shared rig) or candidate name lists (embedded rig). */
export interface WalkClipMap {
idle?: string | string[];
@@ -30,6 +33,8 @@ export interface WalkAvatar {
source: 'static' | 'api';
rig: WalkRig;
clips?: WalkClipMap;
+ /** Shared-rig emote overrides: emote name to manifest clip name. */
+ emotes?: Record<string, string>;
thumb?: string;
accent?: string;
tags?: string[];
@@ -38,6 +43,13 @@ export interface WalkAvatar {
export declare const WALK_AVATARS: WalkAvatar[];
export declare const DEFAULT_AVATAR_ID: string;
export declare const DEFAULT_SHARED_CLIPS: Record<string, string>;
+export declare const DEFAULT_EMOTES: Record<string, string>;
+
+/** Resolve an emote map against the clips that exist, dropping unsupported emotes. */
+export declare function resolveEmotes(
+ availableClipNames: Iterable<string>,
+ emotes?: Record<string, string>,
+): Record<string, string>;
export declare function getAvatar(id: string): WalkAvatar | null;
export declare function defaultAvatar(): WalkAvatar;
@@ -91,10 +103,16 @@ export interface WalkCompanionControl {
export declare function createWalkCompanion(opts?: WalkCompanionOptions): WalkCompanionControl;
-/** A controller exposing setState/playWave for a loaded avatar. */
+/** A controller exposing setState/playWave/emotes for a loaded avatar. */
export interface WalkController {
setState(state: WalkState): void;
playWave(): void;
+ /** Emote names this rig can actually perform; render only these as buttons. */
+ emotes(): WalkEmote[];
+ /** Play an emote once, then settle back to the base state. False = unsupported. */
+ playEmote(name: WalkEmote): boolean;
+ /** Scale playback rate (1 = authored cadence) so walk cycles match travel speed. */
+ setSpeed(scale: number): void;
update(dt: number): void;
dispose(): void;
}