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.

9.1 KB
Raw Blame
<!doctype html>
<html lang="en">
	<head>
		<style>/* three.ws hidden-guard — make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
		<meta charset="utf-8" />
		<link rel="icon" href="/favicon.ico" sizes="any" />
		<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
		<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
		<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
		<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
		<link rel="manifest" href="/manifest.webmanifest" />
		<title data-i18n="avatar_embed.meta_title">Avatar</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta name="description" content="Embedded three.ws avatar."  data-i18n-attr="content:avatar_embed.meta_description"/>
		<meta name="robots" content="noindex" />
		<style>
			html,
			body {
				margin: 0;
				padding: 0;
				height: 100%;
				width: 100%;
				background: transparent;
				overflow: hidden;
				font-family: system-ui, sans-serif;
			}
			#stage {
				position: absolute;
				inset: 0;
			}
			#stage canvas {
				display: block;
				width: 100% !important;
				height: 100% !important;
			}
			#stage .gui-wrap,
			#stage .gui-toggle,
			#stage .annotation-canvas,
			#stage .model-info {
				display: none !important;
			}
			#name-plate {
				position: absolute;
				left: 12px;
				bottom: 10px;
				z-index: 2;
				pointer-events: none;
				font-size: 11px;
				color: rgba(255, 255, 255, 0.55);
				letter-spacing: 0.04em;
				text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
			}
			#error {
				position: absolute;
				inset: 0;
				display: none;
				align-items: center;
				justify-content: center;
				color: rgba(255, 255, 255, 0.4);
				font-size: 12px;
				padding: 1rem;
				text-align: center;
			}
			#mocap-pill {
				position: absolute;
				right: 10px;
				top: 10px;
				z-index: 3;
				display: none;
				align-items: center;
				gap: 6px;
				padding: 6px 10px;
				border-radius: 999px;
				background: rgba(0, 0, 0, 0.55);
				color: #fff;
				font-size: 11px;
				letter-spacing: 0.04em;
				border: 1px solid rgba(255, 255, 255, 0.18);
				cursor: pointer;
				user-select: none;
			}
			#mocap-pill .dot {
				width: 6px;
				height: 6px;
				border-radius: 50%;
				background: #f55;
			}
			#mocap-pill.on .dot {
				background: #5fce6a;
			}
			body.bg-dark {
				background: #0d0d0d;
			}
			body.bg-light {
				background: #f5f5f5;
			}
			body.bg-light #name-plate {
				color: rgba(0, 0, 0, 0.55);
				text-shadow: none;
			}
			body.bg-light #mocap-pill {
				background: rgba(255, 255, 255, 0.85);
				color: #111;
				border-color: rgba(0, 0, 0, 0.12);
			}

			/* Overlay mode — OBS Browser Source target. Strips all chrome so
			 * the canvas is the only renderable surface. Space-bar toggles
			 * the panel for in-stream emote control while keeping the canvas
			 * clean. */
			body.overlay-mode #name-plate,
			body.overlay-mode #mocap-pill,
			body.overlay-mode #error {
				display: none !important;
			}
			body.overlay-mode.panel-open #emote-panel {
				display: grid;
			}

			#emote-panel {
				position: absolute;
				left: 50%;
				bottom: 16px;
				transform: translateX(-50%);
				z-index: 5;
				display: none;
				grid-template-columns: repeat(10, auto);
				gap: 6px;
				padding: 8px;
				border-radius: 12px;
				background: rgba(0, 0, 0, 0.55);
				border: 1px solid rgba(255, 255, 255, 0.16);
				backdrop-filter: blur(6px);
				font-family: ui-monospace, SFMono-Regular, monospace;
				font-size: 11px;
				color: #fff;
				user-select: none;
			}
			body.panel-open #emote-panel {
				display: grid;
			}
			#emote-panel .slot {
				display: flex;
				flex-direction: column;
				align-items: center;
				min-width: 48px;
				padding: 6px 8px;
				border-radius: 8px;
				border: 1px solid rgba(255, 255, 255, 0.12);
				background: rgba(255, 255, 255, 0.04);
				cursor: pointer;
				line-height: 1;
			}
			#emote-panel .slot:hover,
			#emote-panel .slot.active {
				background: rgba(255, 255, 255, 0.12);
				border-color: rgba(255, 255, 255, 0.3);
			}
			#emote-panel .slot .k {
				font-weight: 600;
				font-size: 12px;
				color: #fff;
			}
			#emote-panel .slot .l {
				font-size: 9px;
				margin-top: 3px;
				color: rgba(255, 255, 255, 0.7);
				letter-spacing: 0.04em;
			}

			#state-pill {
				position: absolute;
				left: 12px;
				top: 10px;
				z-index: 4;
				display: none;
				padding: 4px 10px;
				border-radius: 999px;
				background: rgba(0, 0, 0, 0.55);
				color: #fff;
				font-size: 10px;
				letter-spacing: 0.05em;
				text-transform: uppercase;
				border: 1px solid rgba(255, 255, 255, 0.16);
				pointer-events: none;
			}
			body.show-state #state-pill {
				display: inline-block;
			}

			/* ── Animation picker ─────────────────────────────────────── */
			#anim-toggle {
				position: absolute;
				right: 10px;
				bottom: 10px;
				z-index: 5;
				display: none;
				align-items: center;
				gap: 5px;
				padding: 5px 10px;
				border-radius: 999px;
				background: rgba(0, 0, 0, 0.55);
				color: #fff;
				font-size: 11px;
				letter-spacing: 0.04em;
				border: 1px solid rgba(255, 255, 255, 0.18);
				cursor: pointer;
				user-select: none;
				font-family: system-ui, sans-serif;
				transition: background 0.15s;
			}
			#anim-toggle:hover { background: rgba(0, 0, 0, 0.75); }
			#anim-toggle .anim-toggle-icon { font-size: 12px; }

			#anim-picker {
				position: absolute;
				bottom: 42px;
				right: 10px;
				z-index: 5;
				display: none;
				width: 252px;
				max-height: 320px;
				overflow-y: auto;
				background: rgba(10, 10, 10, 0.88);
				border: 1px solid rgba(255, 255, 255, 0.16);
				border-radius: 10px;
				padding: 8px;
				backdrop-filter: blur(8px);
				-webkit-backdrop-filter: blur(8px);
				scrollbar-width: thin;
				scrollbar-color: rgba(255,255,255,0.15) transparent;
			}
			body.anim-picker-open #anim-picker { display: block; }

			#anim-picker .anim-picker-header {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 7px;
				padding: 0 2px;
			}
			#anim-picker .anim-picker-title {
				font-size: 10px;
				text-transform: uppercase;
				letter-spacing: 0.06em;
				color: rgba(255, 255, 255, 0.45);
				font-family: system-ui, sans-serif;
			}
			#anim-picker .anim-stop-btn {
				background: rgba(255,255,255,0.07);
				border: 1px solid rgba(255,255,255,0.14);
				color: rgba(255,255,255,0.6);
				border-radius: 4px;
				font-size: 10px;
				padding: 2px 7px;
				cursor: pointer;
				font-family: system-ui, sans-serif;
			}
			#anim-picker .anim-stop-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

			.anim-chip-grid {
				display: grid;
				grid-template-columns: 1fr 1fr;
				gap: 5px;
			}
			.anim-chip {
				display: flex;
				align-items: center;
				gap: 5px;
				padding: 5px 7px;
				border-radius: 6px;
				border: 1px solid rgba(255, 255, 255, 0.1);
				background: rgba(255, 255, 255, 0.04);
				color: rgba(255, 255, 255, 0.8);
				font-size: 10px;
				font-family: system-ui, sans-serif;
				cursor: pointer;
				text-align: left;
				line-height: 1.2;
				transition: background 0.1s, border-color 0.1s;
				overflow: hidden;
			}
			.anim-chip:hover {
				background: rgba(255, 255, 255, 0.1);
				border-color: rgba(255, 255, 255, 0.25);
				color: #fff;
			}
			.anim-chip.active {
				background: rgba(74, 158, 255, 0.2);
				border-color: rgba(74, 158, 255, 0.5);
				color: #fff;
			}
			.anim-chip .anim-chip-icon { font-size: 14px; flex-shrink: 0; }
			.anim-chip .anim-chip-label {
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			body.overlay-mode #anim-toggle,
			body.overlay-mode #anim-picker { display: none !important; }
		</style>
	</head>
	<!-- No floating language picker: this shell is a chrome-less widget that
	     always renders inside a host page, and i18n.js's bottom-right fallback
	     parked a stray "English" pill on top of the avatar in every embed. The
	     copy still translates from the detected locale and ?lang; the host page
	     owns the picker. -->
	<body data-no-lang-switcher>
		<div id="stage"></div>
		<div id="name-plate"></div>
		<div id="state-pill" aria-live="polite">idle</div>
		<div id="mocap-pill" role="button" tabindex="0" aria-label="Toggle webcam mocap">
			<span class="dot"></span><span class="label" data-i18n="avatar_embed.webcam_mocap">webcam mocap</span>
		</div>
		<div id="emote-panel" role="toolbar" aria-label="Emote hotkeys"></div>
		<button id="anim-toggle" aria-label="Toggle animation picker" aria-expanded="false" data-i18n-html="avatar_embed.animations" data-i18n-attr="aria-label:avatar_embed.toggle_animation_picker_arialabel">
			<span class="anim-toggle-icon">▶</span> Animations
		</button>
		<div id="anim-picker" role="region" aria-label="Animation picker"></div>
		<div id="error"></div>

		<script type="module" src="/src/avatar-embed.js"></script>
		<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
	<script type="module" src="/i18n.js"></script>
</body>
</html>