3D Avatar Companion — a walking, talking 3D avatar for your website

A diverse, animated 3D avatar that walks and talks over your web pages — a corner web mascot plus a full‑page stroll/platformer playground, with a built‑in avatar picker. Powered by Three.js. On npm as @three-ws/walk.
Drop a character onto any site. It idles in the corner, turns to follow the
cursor, waves when the visitor navigates, and greets each page. Click it and it
detaches into a full‑page playground the visitor can steer with the keyboard
or an on‑screen d‑pad — strolling across the page from a gentle aerial view, or
platforming across your real DOM with gravity and jumps. Walk onto a link and
it opens like a doorway into the next page.
https://github.com/user-attachments/assets/5b3c0b79-726a-48f7-964d-d62ba2a111e8
Every visitor can choose who walks with them from a built‑in roster of
avatars — a robot mascot, humanoids, photoreal people, a fox, dancers,
showpieces — or you can supply your own GLB. Whatever they pick is animated
correctly whether the rig ships its own clips or needs the shared retargeting
library, so nothing ever freezes in a bind/T‑pose.
This is the engine behind the walking companion on three.ws.
Install
npm install @three-ws/walk three
three is a peer dependency — bring your own copy (>= 0.150).
You also need to serve two sets of assets from your origin (or a CDN you point
assetBase at):
- the avatar GLBs the roster references (e.g.
/avatars/*.glb), and
- the shared animation manifest + clips (
/animations/manifest.json + clips),
used to retarget motion onto rigs that ship no locomotion.
The defaults match the three.ws asset layout. Override them with assetBase,
apiBase, and manifestUrl, or pass your own avatars roster.
Don't want to host the assets? Point both at the three.ws CDN —
assetBase: 'https://three.ws' and
manifestUrl: 'https://three.ws/animations/manifest.json' (CORS is open).
Relative clip URLs inside the manifest resolve against the manifest's
origin, so a cross-origin manifest just works (v0.1.1+).
Quick start
The whole experience, app‑style (auto‑mounts when enabled, honors ?walk= deep
links, resumes the playground after a "dive"):
import { createWalkCompanion } from '@three-ws/walk';
const walk = createWalkCompanion();
walk.bootstrap();
Or drive it yourself:
const walk = createWalkCompanion({ defaultAvatarId: 'fox' });
walk.enable(); // mount the corner companion
walk.openPicker(); // let the visitor choose an avatar
walk.setAvatar('michelle'); // swap the live avatar
walk.disable(); // remove it
createWalkCompanion is side‑effect free on import — nothing touches the
DOM until you call enable() or bootstrap().
How avatars are animated
Each roster entry declares a rig strategy so it always moves:
rig | Used for | How it animates |
|---|
embedded | self‑animated or non‑humanoid GLBs (robot, fox) | plays the clips baked into the GLB; falls back to the first clip so it never freezes |
shared | humanoids with no locomotion (or only a T‑pose) | retargets the shared clip library (idle/walk/run/wave/jump) onto the rig |
The same unified loader powers both the corner companion and the playground, so
adding an avatar makes it work everywhere at once.
Custom roster
import { createWalkCompanion, WALK_AVATARS } from '@three-ws/walk';
createWalkCompanion({
avatars: [
...WALK_AVATARS,
{
id: 'mascot',
name: 'Our Mascot',
category: 'Brand',
asset: '/brand/mascot.glb',
source: 'static',
rig: 'shared', // retarget the shared library onto it
accent: '#ff0066',
},
],
defaultAvatarId: 'mascot',
}).bootstrap();
User‑generated avatars served by a GLB proxy (/api/avatars/<id>/glb) work via
makeApiAvatarEntry(id) and resolve at runtime — no need to list them.