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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(sign): text to ASL API, MCP tools, grading, and motion signatures
nirholasbea460821f24
diff --git a/api/_mcp/catalog.js b/api/_mcp/catalog.jsindex c70c989f5..a7cbcd5c0 100644--- a/api/_mcp/catalog.js+++ b/api/_mcp/catalog.js@@ -16,12 +16,14 @@ import { toolDefs as traderDefs } from './tools/trader.js';import { toolDefs as tokenizeDefs } from './tools/tokenize.js';import { toolDefs as cryptoDataDefs } from './tools/crypto-data.js';import { toolDefs as garmentDefs } from './tools/garments.js';+import { toolDefs as signDefs } from './tools/sign.js';const baseDefs = [...avatarDefs,...embedDefs,...modelDefs,...animationDefs,+ ...signDefs,...solanaDefs,...pumpfunDefs,...agentDefs,@@ -42,7 +44,7 @@ const gettingStarted = {...buildGettingStartedTool({server: 'three.ws',tagline:- 'The main three.ws MCP server: render and manage 3D avatars and models, animations, an agent registry, agent memory, live pump.fun market data, Oracle conviction signals, and the trader leaderboard + copy-trading system.',+ 'The main three.ws MCP server: render and manage 3D avatars and models, animations, American Sign Language, an agent registry, agent memory, live pump.fun market data, Oracle conviction signals, and the trader leaderboard + copy-trading system.',tools: baseDefs,priceFor,access: [diff --git a/api/_mcp/tools/sign.js b/api/_mcp/tools/sign.jsnew file mode 100644index 000000000..45adf15ec--- /dev/null+++ b/api/_mcp/tools/sign.js@@ -0,0 +1,191 @@+// MCP tools for American Sign Language.+//+// • list_sign_vocabulary (free) — the words that have a real sign, with the+// handshape/place/movement each one performs.+// • sign_text (free) — compile text into a signed utterance: the+// performed timeline, and on request the+// retargetable animation clip itself.+//+// Both run the same platform-free compiler the browser runs (src/sign-speech.js+// via api/sign.js), so an agent asking for a signed utterance gets exactly what+// /sign-language would perform. Nothing here touches the network, the database,+// or the filesystem: it is pure computation over an in-process lexicon.+//+// The clip is deliberately opt-in. A short sentence compiles to tens of+// thousands of numbers, which is worth fetching over HTTP and worthless inside+// a chat transcript, so the default answer is the timeline plus the URL that+// returns the bytes.++import { compile, descriptor, readParams } from '../../sign.js';+import { resolveOrigin } from '../origin.js';+import { SIGNABLE_WORDS } from '../../../src/sign-dictionary.js';++function rpcError(code, message) {+ const e = new Error(message);+ e.code = code;+ return e;+}++/** `HAPPY (1.9s) · T-O spelled (1.3s)` — the utterance as one readable line. */+function describeTimeline(timeline) {+ return timeline+ .map((s) => {+ const secs = `${(s.end - s.start).toFixed(1)}s`;+ if (s.signed) return ` ${s.word.padEnd(12)} signed ${secs.padStart(6)} ${s.gloss}`;+ const letters = s.letters?.map((l) => l.letter).join('-') ?? s.word;+ return ` ${s.word.padEnd(12)} spelled ${secs.padStart(6)} ${letters}`;+ })+ .join('\n');+}++export const toolDefs = [+ {+ name: 'list_sign_vocabulary',+ title: 'List the ASL vocabulary',+ // Reads a frozen in-process lexicon: deterministic and closed-world.+ annotations: {+ readOnlyHint: true,+ destructiveHint: false,+ idempotentHint: true,+ openWorldHint: false,+ },+ description:+ 'List every word three.ws avatars have a real American Sign Language sign for, with a plain description of the handshape, place on the body, and movement each one performs. Words outside this list are fingerspelled letter by letter instead. Use it to know in advance what a phrase will sign versus spell.',+ inputSchema: {+ type: 'object',+ properties: {+ search: {+ type: 'string',+ description: 'Optional substring filter over the words and their descriptions.',+ },+ },+ additionalProperties: false,+ },+ async handler(args) {+ const { vocabulary } = descriptor('https://three.ws');+ const q = String(args.search ?? '').trim().toLowerCase();+ const matched = q+ ? vocabulary.filter(+ (v) => v.word.toLowerCase().includes(q) || v.gloss.toLowerCase().includes(q),+ )+ : vocabulary;+ const lines = matched.map((v) => ` ${v.word.padEnd(10)} ${v.gloss}`).join('\n');+ return {+ content: [+ {+ type: 'text',+ text:+ `${matched.length} signed word${matched.length === 1 ? '' : 's'}` ++ `${q ? ` matching "${q}"` : ''} (everything else fingerspells):\n${lines}`,+ },+ ],+ structuredContent: {+ count: matched.length,+ vocabulary: matched,+ // Aliases resolve onto the same signs (THANKS → THANK), so the set a+ // caller can rely on signing is wider than the sign list itself.+ recognized_words: SIGNABLE_WORDS,+ },+ };+ },+ },+ {+ name: 'sign_text',+ title: 'Sign text in ASL',+ // Pure computation over a frozen lexicon: same input, same clip, every time.+ annotations: {+ readOnlyHint: true,+ destructiveHint: false,+ idempotentHint: true,+ openWorldHint: false,+ },+ description:+ 'Compile English text into one continuous American Sign Language performance for a 3D avatar. Words with a real sign are signed; everything else is fingerspelled, in the same clip. Returns the performed timeline (every word, whether it signed or spelled, the seconds it occupies, and where each spelled letter lands) plus a link that plays it on a live avatar. Set include_clip to also get the three.js AnimationClip document, keyed to the canonical humanoid skeleton, to retarget onto any rigged avatar and play.',+ inputSchema: {+ type: 'object',+ properties: {+ text: {+ type: 'string',+ description: 'The text to sign. Letters, digits and spaces are performed; punctuation is dropped.',+ },+ hand: {+ type: 'string',+ enum: ['right', 'left'],+ default: 'right',+ description: 'Dominant signing hand. The whole sign mirrors, not just the hand.',+ },+ speed: {+ type: 'number',+ default: 1,+ description: 'Playback rate, 0.25–1.5. Below 1 is a signer taking longer over the same signs.',+ },+ max_seconds: {+ type: 'number',+ default: 45,+ description: 'Cap the utterance length; longer text truncates at a word boundary and is flagged.',+ },+ include_clip: {+ type: 'boolean',+ default: false,+ description:+ 'Include the full animation clip document. It is large (tens of thousands of numbers); leave it off and fetch clip_url when you need the bytes.',+ },+ },+ required: ['text'],+ additionalProperties: false,+ },+ async handler(args, auth, req) {+ const origin = resolveOrigin(req);+ const params = readParams({+ text: args.text,+ hand: args.hand,+ speed: args.speed,+ max_seconds: args.max_seconds,+ format: args.include_clip ? 'clip' : 'timeline',+ });+ if (!params.text.trim()) throw rpcError(-32602, 'text is required');++ let result;+ try {+ result = compile(params, origin);+ } catch (err) {+ // The compiler throws only when nothing in the text is performable.+ throw rpcError(-32602, `${err.message} (fingerspelling covers A-Z and 0-9)`);+ }++ const clipUrl = `${origin}/api/sign?text=${encodeURIComponent(params.text)}${+ params.hand === 'Left' ? '&hand=left' : ''+ }${params.speed === 1 ? '' : `&speed=${params.speed}`}`;++ const headline =+ `"${result.text}" signs in ${result.duration.toFixed(1)}s: ` ++ `${result.signed.length} signed, ${result.spelled.length} fingerspelled` ++ `${result.truncated ? ' (truncated to fit max_seconds)' : ''}.`;++ return {+ content: [+ {+ type: 'text',+ text:+ `${headline}\n\n${describeTimeline(result.timeline)}\n\n` ++ `Watch it: ${result.viewer}\nClip JSON: ${clipUrl}`,+ },+ ],+ structuredContent: {+ ok: true,+ text: result.text,+ duration: result.duration,+ hand: result.hand,+ speed: result.speed,+ signed: result.signed,+ spelled: result.spelled,+ truncated: result.truncated,+ timeline: result.timeline,+ viewer_url: result.viewer,+ clip_url: clipUrl,+ ...(result.clip ? { clip: result.clip } : {}),+ },+ };+ },+ },+];diff --git a/api/sign.js b/api/sign.jsnew file mode 100644index 000000000..347bc6dd3--- /dev/null+++ b/api/sign.js@@ -0,0 +1,206 @@+/**+ * /api/sign — text → American Sign Language, as a retargetable animation clip.+ *+ * GET /api/sign+ * → the descriptor: parameters, limits, and the full lexical vocabulary+ * with each sign's gloss. Call this to discover what will sign vs spell.+ *+ * GET /api/sign?text=happy+to+meet+you[&hand=left][&speed=0.75][&format=timeline]+ * POST /api/sign { text, hand, speed, max_seconds, format }+ * → { text, duration, words, signed, spelled, timeline, clip, viewer }+ *+ * This is the writing half of the signing stack; /api/asl-recognition is the+ * reading half. The compiler (src/sign-speech.js) is the same one the browser+ * runs, and it is platform-free by design — no three.js, no DOM — so the server+ * produces a byte-identical clip to the one /sign-language plays. `clip` is a+ * three.js AnimationClip document keyed to the canonical skeleton: load it+ * alongside any rigged humanoid, retarget it (src/animation-retarget.js, or+ * @three-ws/retarget), and play. Nothing here needs an account or a key.+ *+ * `timeline` is the part a UI wants: one entry per word with the seconds it+ * occupies, whether it was signed or spelled, the sign's gloss, and for a+ * spelled word where every letter lands. That is enough to caption an utterance+ * in sync without re-deriving the cadence it was compiled from.+ */++import { cors, json, method, readJson, wrap, rateLimited } from './_lib/http.js';+import { limits, clientIp } from './_lib/rate-limit.js';+import { env } from './_lib/env.js';+import { compileUtterance, scaledTiming, utteranceWords } from '../src/sign-speech.js';+import { SIGNS, signLookup } from '../src/sign-dictionary.js';++// Long enough for a paragraph, short enough that one call stays a few tens of+// milliseconds of CPU. Past this the caller should split the text themselves,+// which is also what produces watchable signing.+const MAX_TEXT_CHARS = 600;+const MAX_BODY_BYTES = 16_000;++// Clip coordinates are quaternion components and seconds; five decimals is well+// under a millimetre at arm's length and halves the payload before gzip.+const PRECISION = 1e5;++const SPEED_RANGE = { min: 0.25, max: 1.5 };+const SECONDS_RANGE = { min: 1, max: 60, default: 45 };++function round(n) {+ return Math.round(n * PRECISION) / PRECISION;+}++/** Round every number in a compiled clip document, in place. */+function compactClip(clip) {+ return {+ name: clip.name,+ duration: round(clip.duration),+ blendMode: clip.blendMode,+ tracks: clip.tracks.map((t) => ({+ type: t.type,+ name: t.name,+ times: t.times.map(round),+ values: t.values.map(round),+ })),+ };+}++function clampNumber(raw, { min, max, fallback }) {+ const n = Number(raw);+ if (!Number.isFinite(n)) return fallback;+ return Math.min(max, Math.max(min, n));+}++/** The one place request params turn into compiler options. */+function readParams(source) {+ const text = String(source.text ?? '').slice(0, MAX_TEXT_CHARS);+ const hand = String(source.hand ?? '').toLowerCase() === 'left' ? 'Left' : 'Right';+ const speed = clampNumber(source.speed, { ...SPEED_RANGE, fallback: 1 });+ const maxSeconds = clampNumber(source.max_seconds ?? source.maxSeconds, {+ min: SECONDS_RANGE.min,+ max: SECONDS_RANGE.max,+ fallback: SECONDS_RANGE.default,+ });+ const format = String(source.format ?? 'clip').toLowerCase() === 'timeline' ? 'timeline' : 'clip';+ return { text, hand, speed, maxSeconds, format };+}++function descriptor(origin) {+ const vocabulary = Object.entries(SIGNS)+ .map(([word, sign]) => ({ word, gloss: sign.gloss }))+ .sort((a, b) => a.word.localeCompare(b.word));+ return {+ service: 'three.ws sign',+ summary:+ 'Compile English text into one continuous American Sign Language animation clip. ' ++ 'Words in the vocabulary are signed; everything else is fingerspelled letter by letter.',+ usage: {+ compile: `${origin}/api/sign?text=happy+to+meet+you`,+ timeline_only: `${origin}/api/sign?text=happy+to+meet+you&format=timeline`,+ left_handed: `${origin}/api/sign?text=hello&hand=left`,+ post: `POST ${origin}/api/sign {"text":"hello","speed":0.75}`,+ },+ parameters: {+ text: `required to compile. Letters, digits and spaces survive; punctuation is dropped. Up to ${MAX_TEXT_CHARS} characters.`,+ hand: 'right (default) or left. The whole sign mirrors, not just the hand.',+ speed: `${SPEED_RANGE.min}-${SPEED_RANGE.max}, default 1. Below 1 is a signer taking longer over the same signs.`,+ max_seconds: `${SECONDS_RANGE.min}-${SECONDS_RANGE.max}, default ${SECONDS_RANGE.default}. Longer text is truncated at a word boundary and flagged.`,+ format: 'clip (default) returns the animation clip plus the timeline; timeline returns only the timeline, which is small and free of clip data.',+ },+ clip_format: {+ description:+ 'A three.js AnimationClip document keyed to the canonical humanoid skeleton, rotation lanes only. Retarget it onto any rigged humanoid, then play it.',+ retarget: 'https://www.npmjs.com/package/@three-ws/retarget',+ engine: 'https://www.npmjs.com/package/@three-ws/sign-language',+ },+ vocabulary_size: vocabulary.length,+ vocabulary,+ reading_direction: `${origin}/api/asl-recognition`,+ docs: `${origin}/docs/sign-language`,+ watch: `${origin}/sign-language`,+ scope:+ 'Citation-form signs in English word order (signed English), not ASL grammar. It makes an avatar legible to signers; it does not replace an interpreter.',+ };+}++function compile(params, origin) {+ const { text, hand, speed, maxSeconds, format } = params;+ const result = compileUtterance(text, {+ signs: signLookup({ dominant: hand, rate: speed }),+ timing: speed === 1 ? undefined : scaledTiming(speed),+ maxSeconds,+ dominant: hand,+ });++ const timeline = result.segments.map((s) => ({+ word: s.word,+ signed: s.signed,+ gloss: s.gloss,+ start: round(s.start),+ end: round(s.end),+ letters: s.letters?.map((l) => ({ letter: l.letter, start: round(l.start), end: round(l.end) })) ?? null,+ }));++ const body = {+ text,+ duration: round(result.clip.duration),+ words: result.words,+ signed: result.signed,+ spelled: result.spelled,+ truncated: result.truncated,+ hand: hand.toLowerCase(),+ speed,+ timeline,+ viewer: `${origin}/sign-language?say=${encodeURIComponent(text)}`,+ };+ if (format === 'clip') body.clip = compactClip(result.clip);+ return body;+}++// Deterministic output: the same text, hand and speed always compile to the same+// clip, so it caches hard at the edge and the compile only ever runs once.+const CACHE_HEADERS = {+ 'cache-control': 'public, max-age=300, s-maxage=86400, stale-while-revalidate=604800',+};++export default wrap(async (req, res) => {+ if (cors(req, res, { origins: '*', methods: 'GET,POST,OPTIONS' })) return;+ if (!method(req, res, ['GET', 'POST'])) return;++ const origin = env.APP_ORIGIN.replace(/\/$/, '');++ let source;+ if (req.method === 'GET') {+ const url = new URL(req.url, 'http://localhost');+ source = Object.fromEntries(url.searchParams);+ // A bare GET is the discovery call: what this does, and what it can sign.+ if (!String(source.text ?? '').trim()) return json(res, 200, descriptor(origin), CACHE_HEADERS);+ } else {+ const body = await readJson(req, MAX_BODY_BYTES).catch(() => null);+ if (!body || typeof body !== 'object') {+ return json(res, 400, {+ error: 'bad_request',+ message: 'Body must be JSON: { "text": "happy to meet you" }.',+ });+ }+ source = body;+ }++ const params = readParams(source);+ if (!params.text.trim()) {+ return json(res, 400, {+ error: 'missing_text',+ message: 'Pass text to sign, for example { "text": "happy to meet you" }.',+ });+ }+ if (!utteranceWords(params.text).length) {+ return json(res, 400, {+ error: 'unsignable_text',+ message:+ 'That text has nothing signable in it. Fingerspelling covers A-Z and 0-9; punctuation and other scripts are dropped.',+ });+ }++ const rl = await limits.signCompileIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl, 'Sign compile limit reached. Try again shortly.');++ return json(res, 200, compile(params, origin), CACHE_HEADERS);+});++export { descriptor, compile, readParams, MAX_TEXT_CHARS };diff --git a/pages/sign-language.html b/pages/sign-language.htmlindex 8157af099..86205137f 100644--- a/pages/sign-language.html+++ b/pages/sign-language.html@@ -150,6 +150,83 @@.sl-btn:active:not(:disabled), .sl-phrase-chip:active { transform: none; }}+ /* The sign API console */+ .sl-api { margin-top: clamp(48px, 6vw, 76px); border: 1px solid var(--stroke); border-radius: 20px; padding: clamp(24px, 4vw, 40px); background: var(--surface-1); }+ .sl-api-head h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 10px; letter-spacing: -.02em; }+ .sl-api-head p { color: var(--ink-dim); font-size: 15px; line-height: 1.65; max-width: 68ch; margin: 0 0 24px; }+ .sl-api-form .sl-input-row { max-width: 640px; }+ .sl-api-form .sl-settings { margin-top: 14px; }+ .sl-api-form .sl-chips { margin-top: 12px; }++ .sl-api-out { margin-top: 26px; }+ .sl-api-out[data-state='idle'] .sl-api-actions,+ .sl-api-out[data-state='idle'] .sl-api-code,+ .sl-api-out[data-state='error'] .sl-api-actions,+ .sl-api-out[data-state='error'] .sl-api-code { display: none; }+ .sl-api-out[data-state='loading'] { opacity: .55; }+ .sl-api-out[data-state='loading'] .sl-api-timeline-wrap { animation: sl-api-pulse 1.1s ease-in-out infinite; }+ @keyframes sl-api-pulse { 0%, 100% { opacity: .5 } 50% { opacity: .85 } }++ .sl-api-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; padding: 0; }+ .sl-api-stat { border: 1px solid var(--stroke); border-radius: 12px; padding: 10px 14px; background: var(--surface-2); min-width: 92px; }+ .sl-api-stat dt { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-dim); }+ .sl-api-stat dd { margin: 3px 0 0; font-family: var(--font-mono); font-size: 16px; color: var(--ink); }++ .sl-api-timeline-wrap { position: relative; }+ .sl-api-timeline { display: flex; gap: 3px; align-items: stretch; min-height: 74px; }+ .sl-api-timeline:empty { border: 1px dashed var(--stroke); border-radius: 12px; }+ .sl-api-seg {+ position: relative; flex: 1 1 0; min-width: 0; appearance: none; cursor: pointer;+ display: flex; flex-direction: column; justify-content: space-between; gap: 6px;+ border: 1px solid rgba(167,139,250,.35); border-radius: 10px; padding: 9px 8px 7px;+ background: rgba(167,139,250,.10); color: var(--ink); font: inherit; text-align: left;+ transition: background .14s ease, border-color .14s ease, transform .14s ease;+ }+ .sl-api-seg[data-kind='spelled'] { border-color: var(--stroke); background: var(--surface-2); }+ .sl-api-seg:hover { transform: translateY(-2px); border-color: rgba(167,139,250,.75); }+ .sl-api-seg:focus-visible { outline: 2px solid rgba(167,139,250,.9); outline-offset: 2px; }+ .sl-api-seg[data-active] { background: rgba(167,139,250,.32); border-color: rgba(167,139,250,.95); }+ .sl-api-seg-word { font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .sl-api-seg[data-kind='spelled'] .sl-api-seg-word { color: var(--ink-dim); }+ .sl-api-seg-letters { display: flex; gap: 2px; }+ .sl-api-letter {+ flex: 1 1 0; min-width: 0; text-align: center; border-radius: 4px; padding: 3px 0;+ background: rgba(127,127,127,.16); font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim);+ overflow: hidden;+ }+ .sl-api-letter[data-active] { background: rgba(167,139,250,.55); color: var(--ink); }++ .sl-api-playhead { position: absolute; top: -4px; bottom: 20px; width: 2px; background: #a78bfa; box-shadow: 0 0 8px rgba(167,139,250,.9); pointer-events: none; border-radius: 2px; }+ .sl-api-ruler { position: relative; height: 18px; margin-top: 4px; }+ .sl-api-tick { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); }++ .sl-api-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }+ .sl-btn-quiet { font-size: 13px; padding: 8px 14px; background: var(--surface-2); border-color: var(--stroke); text-decoration: none; }+ .sl-btn-quiet:hover:not(:disabled) { background: rgba(167,139,250,.16); border-color: rgba(167,139,250,.6); }+ .sl-api-note { margin: 14px 0 0; color: var(--ink-dim); font-size: 14px; line-height: 1.6; min-height: 22px; }++ .sl-api-code { margin-top: 18px; border-top: 1px solid var(--stroke); padding-top: 14px; }+ .sl-api-code summary { cursor: pointer; font-size: 14px; color: var(--ink-dim); }+ .sl-api-code summary:hover { color: var(--ink); }+ .sl-api-code summary:focus-visible { outline: 2px solid rgba(167,139,250,.9); outline-offset: 2px; border-radius: 4px; }+ .sl-api-code-h { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-dim); margin: 16px 0 6px; }+ .sl-api-pre { margin: 0; padding: 14px; border: 1px solid var(--stroke); border-radius: 12px; background: var(--surface-2); overflow-x: auto; max-height: 340px; }+ .sl-api-pre code { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; color: var(--ink); white-space: pre; }+ .sl-api-foot { margin: 22px 0 0; color: var(--ink-dim); font-size: 13px; line-height: 1.7; }+ .sl-api-foot a { color: var(--ink); }+ .sl-api-foot code { font-family: var(--font-mono); font-size: 12px; }++ @media (max-width: 700px) {+ /* Below this the blocks stop being readable side by side, so the+ timeline becomes a scrollable strip rather than a row of slivers. */+ .sl-api-timeline { overflow-x: auto; }+ .sl-api-seg { min-width: 76px; flex-basis: 76px; }+ }+ @media (prefers-reduced-motion: reduce) {+ .sl-api-seg:hover { transform: none; }+ .sl-api-out[data-state='loading'] .sl-api-timeline-wrap { animation: none; }+ }+/* Honest scope note */.sl-note { margin-top: clamp(36px, 5vw, 56px); border-left: 2px solid rgba(167,139,250,.5); padding: 4px 0 4px 18px; color: var(--ink-dim); font-size: 14px; line-height: 1.65; max-width: 72ch; }@@ -297,6 +374,27 @@</div></section>+ <section class="sl-api" id="sl-api" aria-label="The sign API, live">+ <div class="sl-api-head">+ <h2 data-i18n="sign_language.the_same_signing_over_http">The same signing, over HTTP</h2>+ <p data-i18n="sign_language.api_lede">+ Everything above compiles in the browser. The same compiler runs on the server,+ so any app, agent or engine can ask for a signed utterance and get one back:+ a three.js animation clip keyed to a canonical humanoid skeleton, plus the+ timeline it performs on. No account, no key, no SDK. Type below and watch the+ real endpoint answer.+ </p>+ </div>+ <div id="sl-api-console"></div>+ <p class="sl-api-foot" data-i18n-html="sign_language.api_foot">+ Full reference: <a href="/docs/sign-language#the-sign-api">the sign API</a> ·+ <a href="/docs/api-reference"><code>/api/sign</code> in the API reference</a> ·+ the reverse direction is <a href="/docs/sign-language#reading-signing-the-recognition-api"><code>/api/asl-recognition</code></a>.+ Agents can call it as the <code>sign_text</code> tool on the+ <a href="/mcp-tools">three.ws MCP server</a>.+ </p>+ </section>+<p class="sl-note" data-i18n-html="sign_language.honest_scope_words_with_a_sign_are">Honest scope: words with a sign are signed, everything else is fingerspelled letter by letter. Signs are strung together in English word order, which is signed English,not ASL grammar: real ASL reorders sentences, inflects verbs through space, anddiff --git a/public/animations/signatures.json b/public/animations/signatures.jsonnew file mode 100644index 000000000..8755ce7aa--- /dev/null+++ b/public/animations/signatures.json@@ -0,0 +1,3254 @@+{+ "version": 1,+ "count": 112,+ "clips": {+ "angry": {+ "clip": "angry",+ "duration": 19.17,+ "frames": 576,+ "energy": 0.246,+ "speed": 0.338,+ "regions": {+ "head": 0.068,+ "arms": 0.454,+ "torso": 0.039,+ "root": 0.115,+ "legs": 0.325+ },+ "lead": "arms",+ "upperShare": 0.561,+ "balance": 0.956,+ "travel": 0,+ "path": 2.429,+ "rise": 0.029,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-arm-flex": {+ "clip": "av-arm-flex",+ "duration": 4.37,+ "frames": 131,+ "energy": 0.526,+ "speed": 0.895,+ "regions": {+ "head": 0.033,+ "arms": 0.563,+ "torso": 0.031,+ "root": 0.121,+ "legs": 0.252+ },+ "lead": "arms",+ "upperShare": 0.627,+ "balance": 0.998,+ "travel": 0,+ "path": 0.738,+ "rise": 0.155,+ "tempo": 90,+ "beat": 0.382,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "av-back-flip": {+ "clip": "av-back-flip",+ "duration": 2.17,+ "frames": 130,+ "energy": 0.932,+ "speed": 3.222,+ "regions": {+ "head": 0.015,+ "arms": 0.412,+ "torso": 0.04,+ "root": 0.189,+ "legs": 0.343+ },+ "lead": "arms",+ "upperShare": 0.467,+ "balance": 0.996,+ "travel": 0,+ "path": 0.933,+ "rise": 0.813,+ "tempo": 0,+ "beat": 0.074,+ "seam": 0.005,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-banging-tunes": {+ "clip": "av-banging-tunes",+ "duration": 6.77,+ "frames": 203,+ "energy": 0.54,+ "speed": 0.931,+ "regions": {+ "head": 0.083,+ "arms": 0.499,+ "torso": 0.043,+ "root": 0.132,+ "legs": 0.243+ },+ "lead": "arms",+ "upperShare": 0.625,+ "balance": 0.754,+ "travel": 0.002,+ "path": 1.432,+ "rise": 0.089,+ "tempo": 0,+ "beat": 0.193,+ "seam": 0.031,+ "seamRoot": 0.002,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "av-boxer-dance": {+ "clip": "av-boxer-dance",+ "duration": 9.87,+ "frames": 296,+ "energy": 0.755,+ "speed": 1.688,+ "regions": {+ "head": 0.05,+ "arms": 0.55,+ "torso": 0.03,+ "root": 0.076,+ "legs": 0.294+ },+ "lead": "arms",+ "upperShare": 0.63,+ "balance": 0.998,+ "travel": 0,+ "path": 3.124,+ "rise": 0.202,+ "tempo": 35,+ "beat": 0.273,+ "seam": 0.002,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "av-brag-claps": {+ "clip": "av-brag-claps",+ "duration": 10,+ "frames": 300,+ "energy": 0.721,+ "speed": 1.531,+ "regions": {+ "head": 0.044,+ "arms": 0.4,+ "torso": 0.073,+ "root": 0.146,+ "legs": 0.337+ },+ "lead": "arms",+ "upperShare": 0.517,+ "balance": 0.994,+ "travel": 0,+ "path": 3.753,+ "rise": 0.154,+ "tempo": 26,+ "beat": 0.554,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-call-me": {+ "clip": "av-call-me",+ "duration": 3.77,+ "frames": 113,+ "energy": 0.446,+ "speed": 0.708,+ "regions": {+ "head": 0.04,+ "arms": 0.5,+ "torso": 0.031,+ "root": 0.131,+ "legs": 0.298+ },+ "lead": "arms",+ "upperShare": 0.571,+ "balance": 0.697,+ "travel": 0,+ "path": 0.781,+ "rise": 0.036,+ "tempo": 78,+ "beat": 0.294,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-celebrating": {+ "clip": "av-celebrating",+ "duration": 4.53,+ "frames": 136,+ "energy": 0.609,+ "speed": 1.128,+ "regions": {+ "head": 0.029,+ "arms": 0.466,+ "torso": 0.058,+ "root": 0.117,+ "legs": 0.33+ },+ "lead": "arms",+ "upperShare": 0.553,+ "balance": 0.981,+ "travel": 0,+ "path": 0.763,+ "rise": 0.078,+ "tempo": 164,+ "beat": 0.601,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-cheering": {+ "clip": "av-cheering",+ "duration": 6.77,+ "frames": 203,+ "energy": 0.488,+ "speed": 0.803,+ "regions": {+ "head": 0.021,+ "arms": 0.576,+ "torso": 0.028,+ "root": 0.069,+ "legs": 0.305+ },+ "lead": "arms",+ "upperShare": 0.625,+ "balance": 0.9,+ "travel": 0,+ "path": 1.236,+ "rise": 0.209,+ "tempo": 150,+ "beat": 0.495,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "av-chest-bump": {+ "clip": "av-chest-bump",+ "duration": 5.67,+ "frames": 170,+ "energy": 0.734,+ "speed": 1.59,+ "regions": {+ "head": 0.02,+ "arms": 0.649,+ "torso": 0.023,+ "root": 0.1,+ "legs": 0.208+ },+ "lead": "arms",+ "upperShare": 0.692,+ "balance": 0.887,+ "travel": 0.002,+ "path": 0.921,+ "rise": 0.1,+ "tempo": 113,+ "beat": 0.661,+ "seam": 0,+ "seamRoot": 0.002,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "av-chilling": {+ "clip": "av-chilling",+ "duration": 10,+ "frames": 300,+ "energy": 0.593,+ "speed": 1.08,+ "regions": {+ "head": 0.039,+ "arms": 0.37,+ "torso": 0.039,+ "root": 0.099,+ "legs": 0.454+ },+ "lead": "legs",+ "upperShare": 0.448,+ "balance": 0.983,+ "travel": 0.006,+ "path": 1.74,+ "rise": 0.844,+ "tempo": 86,+ "beat": 0.421,+ "seam": 0,+ "seamRoot": 0.006,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-conductor": {+ "clip": "av-conductor",+ "duration": 6.27,+ "frames": 188,+ "energy": 0.701,+ "speed": 1.448,+ "regions": {+ "head": 0.068,+ "arms": 0.735,+ "torso": 0.038,+ "root": 0.058,+ "legs": 0.101+ },+ "lead": "arms",+ "upperShare": 0.841,+ "balance": 0.901,+ "travel": 0,+ "path": 0.445,+ "rise": 0.086,+ "tempo": 75,+ "beat": 0.337,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "av-dance-shuffle": {+ "clip": "av-dance-shuffle",+ "duration": 22.57,+ "frames": 677,+ "energy": 0.754,+ "speed": 1.684,+ "regions": {+ "head": 0.042,+ "arms": 0.362,+ "torso": 0.062,+ "root": 0.145,+ "legs": 0.389+ },+ "lead": "legs",+ "upperShare": 0.466,+ "balance": 0.998,+ "travel": 0.901,+ "path": 10.208,+ "rise": 0.197,+ "tempo": 112,+ "beat": 0.34,+ "seam": 0.509,+ "seamRoot": 0.903,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-flexing-arm": {+ "clip": "av-flexing-arm",+ "duration": 6.93,+ "frames": 208,+ "energy": 0.413,+ "speed": 0.64,+ "regions": {+ "head": 0.109,+ "arms": 0.518,+ "torso": 0.046,+ "root": 0.099,+ "legs": 0.228+ },+ "lead": "arms",+ "upperShare": 0.673,+ "balance": 0.979,+ "travel": 0.001,+ "path": 0.805,+ "rise": 0.042,+ "tempo": 0,+ "beat": 0,+ "seam": 0.042,+ "seamRoot": 0.001,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "av-gymnastics-aerial": {+ "clip": "av-gymnastics-aerial",+ "duration": 3.87,+ "frames": 116,+ "energy": 0.761,+ "speed": 1.719,+ "regions": {+ "head": 0.036,+ "arms": 0.32,+ "torso": 0.06,+ "root": 0.197,+ "legs": 0.387+ },+ "lead": "legs",+ "upperShare": 0.416,+ "balance": 0.994,+ "travel": 4.628,+ "path": 5.049,+ "rise": 0.375,+ "tempo": 0,+ "beat": 0,+ "seam": 0.136,+ "seamRoot": 4.628,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-headbang": {+ "clip": "av-headbang",+ "duration": 23.63,+ "frames": 710,+ "energy": 0.872,+ "speed": 2.465,+ "regions": {+ "head": 0.093,+ "arms": 0.466,+ "torso": 0.038,+ "root": 0.104,+ "legs": 0.298+ },+ "lead": "arms",+ "upperShare": 0.597,+ "balance": 0.986,+ "travel": 0.811,+ "path": 8.97,+ "rise": 0.351,+ "tempo": 164,+ "beat": 0.593,+ "seam": 0.2,+ "seamRoot": 0.812,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-idle-anim": {+ "clip": "av-idle-anim",+ "duration": 10.02,+ "frames": 301,+ "energy": 0.03,+ "speed": 0.037,+ "regions": {+ "head": 0.037,+ "arms": 0.635,+ "torso": 0.032,+ "root": 0.032,+ "legs": 0.264+ },+ "lead": "arms",+ "upperShare": 0.704,+ "balance": 0.826,+ "travel": 0,+ "path": 0.107,+ "rise": 0.005,+ "tempo": 30,+ "beat": 0.868,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "av-idle-breath": {+ "clip": "av-idle-breath",+ "duration": 8.07,+ "frames": 116,+ "energy": 0.018,+ "speed": 0.022,+ "regions": {+ "head": 0.13,+ "arms": 0.475,+ "torso": 0.102,+ "root": 0.047,+ "legs": 0.247+ },+ "lead": "arms",+ "upperShare": 0.707,+ "balance": 0.951,+ "travel": 0,+ "path": 0.066,+ "rise": 0,+ "tempo": 38,+ "beat": 0.699,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "av-idle-female": {+ "clip": "av-idle-female",+ "duration": 0.04,+ "frames": 1,+ "energy": 0,+ "speed": 0,+ "regions": {+ "head": 0,+ "arms": 0,+ "torso": 0,+ "root": 0,+ "legs": 0+ },+ "lead": "head",+ "upperShare": 0,+ "balance": 1,+ "travel": 0,+ "path": 0,+ "rise": 0,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": false,+ "anchored": true,+ "overlay": false,+ "static": true,+ "declaredLoop": true+ },+ "av-idle-male": {+ "clip": "av-idle-male",+ "duration": 0.04,+ "frames": 1,+ "energy": 0,+ "speed": 0,+ "regions": {+ "head": 0,+ "arms": 0,+ "torso": 0,+ "root": 0,+ "legs": 0+ },+ "lead": "head",+ "upperShare": 0,+ "balance": 1,+ "travel": 0,+ "path": 0,+ "rise": 0,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": false,+ "anchored": true,+ "overlay": false,+ "static": true,+ "declaredLoop": true+ },+ "av-joy": {+ "clip": "av-joy",+ "duration": 5.93,+ "frames": 178,+ "energy": 0.847,+ "speed": 2.254,+ "regions": {+ "head": 0.05,+ "arms": 0.493,+ "torso": 0.031,+ "root": 0.082,+ "legs": 0.344+ },+ "lead": "arms",+ "upperShare": 0.574,+ "balance": 0.989,+ "travel": 0.001,+ "path": 1.391,+ "rise": 0.365,+ "tempo": 75,+ "beat": 0.759,+ "seam": 0,+ "seamRoot": 0.001,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-leaning-wall": {+ "clip": "av-leaning-wall",+ "duration": 1.92,+ "frames": 116,+ "energy": 0.199,+ "speed": 0.266,+ "regions": {+ "head": 0.192,+ "arms": 0.318,+ "torso": 0.039,+ "root": 0.062,+ "legs": 0.388+ },+ "lead": "legs",+ "upperShare": 0.549,+ "balance": 0.552,+ "travel": 0,+ "path": 0.065,+ "rise": 0.006,+ "tempo": 127,+ "beat": 0.776,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-listening-music": {+ "clip": "av-listening-music",+ "duration": 4.47,+ "frames": 269,+ "energy": 0.251,+ "speed": 0.346,+ "regions": {+ "head": 0.128,+ "arms": 0.283,+ "torso": 0.101,+ "root": 0.169,+ "legs": 0.319+ },+ "lead": "legs",+ "upperShare": 0.512,+ "balance": 0.953,+ "travel": 0,+ "path": 0.778,+ "rise": 0.018,+ "tempo": 67,+ "beat": 0.518,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-muay-thai": {+ "clip": "av-muay-thai",+ "duration": 5.7,+ "frames": 171,+ "energy": 0.78,+ "speed": 1.818,+ "regions": {+ "head": 0.039,+ "arms": 0.46,+ "torso": 0.048,+ "root": 0.141,+ "legs": 0.311+ },+ "lead": "arms",+ "upperShare": 0.547,+ "balance": 0.925,+ "travel": 0,+ "path": 1.841,+ "rise": 0.111,+ "tempo": 72,+ "beat": 0.357,+ "seam": 0.001,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-offabean-dance": {+ "clip": "av-offabean-dance",+ "duration": 16.1,+ "frames": 484,+ "energy": 0.798,+ "speed": 1.921,+ "regions": {+ "head": 0.027,+ "arms": 0.456,+ "torso": 0.007,+ "root": 0.082,+ "legs": 0.428+ },+ "lead": "arms",+ "upperShare": 0.49,+ "balance": 0.955,+ "travel": 0.218,+ "path": 6.282,+ "rise": 0.405,+ "tempo": 90,+ "beat": 0.333,+ "seam": 0.516,+ "seamRoot": 0.251,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-pose1": {+ "clip": "av-pose1",+ "duration": 0,+ "frames": 1,+ "energy": 0,+ "speed": 0,+ "regions": {+ "head": 0,+ "arms": 0,+ "torso": 0,+ "root": 0,+ "legs": 0+ },+ "lead": "head",+ "upperShare": 0,+ "balance": 1,+ "travel": 0,+ "path": 0,+ "rise": 0,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": false,+ "anchored": true,+ "overlay": false,+ "static": true,+ "declaredLoop": true+ },+ "av-push-block": {+ "clip": "av-push-block",+ "duration": 9.37,+ "frames": 281,+ "energy": 0.442,+ "speed": 0.7,+ "regions": {+ "head": 0.045,+ "arms": 0.309,+ "torso": 0.047,+ "root": 0.118,+ "legs": 0.481+ },+ "lead": "legs",+ "upperShare": 0.401,+ "balance": 0.974,+ "travel": 3.543,+ "path": 4.157,+ "rise": 0.229,+ "tempo": 37,+ "beat": 0.5,+ "seam": 0.08,+ "seamRoot": 3.543,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-rap-dance": {+ "clip": "av-rap-dance",+ "duration": 18.55,+ "frames": 1114,+ "energy": 0.624,+ "speed": 1.174,+ "regions": {+ "head": 0.05,+ "arms": 0.385,+ "torso": 0.108,+ "root": 0.152,+ "legs": 0.304+ },+ "lead": "arms",+ "upperShare": 0.543,+ "balance": 0.97,+ "travel": 0,+ "path": 3.216,+ "rise": 0.163,+ "tempo": 100,+ "beat": 0.366,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-smoking": {+ "clip": "av-smoking",+ "duration": 16.47,+ "frames": 494,+ "energy": 0.122,+ "speed": 0.157,+ "regions": {+ "head": 0.068,+ "arms": 0.504,+ "torso": 0.035,+ "root": 0.129,+ "legs": 0.264+ },+ "lead": "arms",+ "upperShare": 0.607,+ "balance": 0.647,+ "travel": 0.01,+ "path": 1,+ "rise": 0.021,+ "tempo": 0,+ "beat": 0.008,+ "seam": 0.047,+ "seamRoot": 0.01,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "av-spy": {+ "clip": "av-spy",+ "duration": 4.27,+ "frames": 128,+ "energy": 0.619,+ "speed": 1.159,+ "regions": {+ "head": 0.093,+ "arms": 0.413,+ "torso": 0.055,+ "root": 0.14,+ "legs": 0.299+ },+ "lead": "arms",+ "upperShare": 0.561,+ "balance": 0.98,+ "travel": 0.006,+ "path": 0.863,+ "rise": 0.393,+ "tempo": 0,+ "beat": 0.124,+ "seam": 0.049,+ "seamRoot": 0.006,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-stand-crouch-stand": {+ "clip": "av-stand-crouch-stand",+ "duration": 4.2,+ "frames": 126,+ "energy": 0.364,+ "speed": 0.543,+ "regions": {+ "head": 0.036,+ "arms": 0.258,+ "torso": 0.07,+ "root": 0.117,+ "legs": 0.52+ },+ "lead": "legs",+ "upperShare": 0.364,+ "balance": 0.975,+ "travel": 0.038,+ "path": 0.765,+ "rise": 0.641,+ "tempo": 0,+ "beat": 0,+ "seam": 0.015,+ "seamRoot": 0.038,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "av-superhero-jump": {+ "clip": "av-superhero-jump",+ "duration": 2,+ "frames": 60,+ "energy": 0.652,+ "speed": 1.267,+ "regions": {+ "head": 0.051,+ "arms": 0.524,+ "torso": 0.062,+ "root": 0.082,+ "legs": 0.282+ },+ "lead": "arms",+ "upperShare": 0.637,+ "balance": 0.989,+ "travel": 0.665,+ "path": 0.823,+ "rise": 2.228,+ "tempo": 0,+ "beat": 0,+ "seam": 0.754,+ "seamRoot": 2.21,+ "loopClean": false,+ "anchored": false,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "av-vtubing": {+ "clip": "av-vtubing",+ "duration": 16.2,+ "frames": 486,+ "energy": 0.575,+ "speed": 1.026,+ "regions": {+ "head": 0.072,+ "arms": 0.258,+ "torso": 0.042,+ "root": 0.238,+ "legs": 0.391+ },+ "lead": "legs",+ "upperShare": 0.372,+ "balance": 0.976,+ "travel": 0.209,+ "path": 3.563,+ "rise": 0.187,+ "tempo": 29,+ "beat": 0.267,+ "seam": 0.18,+ "seamRoot": 0.209,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-waiting": {+ "clip": "av-waiting",+ "duration": 44.77,+ "frames": 1343,+ "energy": 0.141,+ "speed": 0.182,+ "regions": {+ "head": 0.131,+ "arms": 0.253,+ "torso": 0.046,+ "root": 0.139,+ "legs": 0.431+ },+ "lead": "legs",+ "upperShare": 0.43,+ "balance": 0.884,+ "travel": 0.095,+ "path": 5.065,+ "rise": 0.112,+ "tempo": 120,+ "beat": 0.33,+ "seam": 0.056,+ "seamRoot": 0.095,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-walk-crouching": {+ "clip": "av-walk-crouching",+ "duration": 1.37,+ "frames": 41,+ "energy": 0.389,+ "speed": 0.59,+ "regions": {+ "head": 0.015,+ "arms": 0.079,+ "torso": 0.042,+ "root": 0.092,+ "legs": 0.773+ },+ "lead": "legs",+ "upperShare": 0.136,+ "balance": 0.986,+ "travel": 1.485,+ "path": 1.507,+ "rise": 0.033,+ "tempo": 0,+ "beat": 0.177,+ "seam": 0.01,+ "seamRoot": 1.485,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "av-walk-feminine": {+ "clip": "av-walk-feminine",+ "duration": 1.17,+ "frames": 35,+ "energy": 0.749,+ "speed": 1.658,+ "regions": {+ "head": 0.02,+ "arms": 0.381,+ "torso": 0.053,+ "root": 0.112,+ "legs": 0.434+ },+ "lead": "legs",+ "upperShare": 0.454,+ "balance": 0.998,+ "travel": 0,+ "path": 0.525,+ "rise": 0.041,+ "tempo": 0,+ "beat": 0.079,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "capoeira": {+ "clip": "capoeira",+ "duration": 3.43,+ "frames": 104,+ "energy": 0.681,+ "speed": 1.369,+ "regions": {+ "head": 0.033,+ "arms": 0.302,+ "torso": 0.11,+ "root": 0.119,+ "legs": 0.437+ },+ "lead": "legs",+ "upperShare": 0.445,+ "balance": 0.971,+ "travel": 0,+ "path": 3.754,+ "rise": 0.161,+ "tempo": 35,+ "beat": 0.825,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "celebrate": {+ "clip": "celebrate",+ "duration": 1.87,+ "frames": 57,+ "energy": 0.784,+ "speed": 1.841,+ "regions": {+ "head": 0.035,+ "arms": 0.368,+ "torso": 0.064,+ "root": 0.058,+ "legs": 0.475+ },+ "lead": "legs",+ "upperShare": 0.467,+ "balance": 0.998,+ "travel": 0,+ "path": 0.235,+ "rise": 0.394,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "covereyes": {+ "clip": "covereyes",+ "duration": 7.3,+ "frames": 220,+ "energy": 0.218,+ "speed": 0.295,+ "regions": {+ "head": 0.16,+ "arms": 0.635,+ "torso": 0.037,+ "root": 0.058,+ "legs": 0.11+ },+ "lead": "arms",+ "upperShare": 0.832,+ "balance": 0.994,+ "travel": 0,+ "path": 0.254,+ "rise": 0.018,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "coverstand": {+ "clip": "coverstand",+ "duration": 1.5,+ "frames": 46,+ "energy": 0.708,+ "speed": 1.479,+ "regions": {+ "head": 0.054,+ "arms": 0.331,+ "torso": 0.046,+ "root": 0.2,+ "legs": 0.369+ },+ "lead": "legs",+ "upperShare": 0.431,+ "balance": 0.918,+ "travel": 0.976,+ "path": 1.133,+ "rise": 0.381,+ "tempo": 0,+ "beat": 0,+ "seam": 0.576,+ "seamRoot": 1.048,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "dance": {+ "clip": "dance",+ "duration": 4.47,+ "frames": 135,+ "energy": 0.867,+ "speed": 2.417,+ "regions": {+ "head": 0.027,+ "arms": 0.451,+ "torso": 0.06,+ "root": 0.088,+ "legs": 0.374+ },+ "lead": "arms",+ "upperShare": 0.538,+ "balance": 0.966,+ "travel": 0,+ "path": 2.021,+ "rise": 0.119,+ "tempo": 27,+ "beat": 0.911,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "defeated": {+ "clip": "defeated",+ "duration": 6.73,+ "frames": 203,+ "energy": 0.232,+ "speed": 0.317,+ "regions": {+ "head": 0.096,+ "arms": 0.52,+ "torso": 0.07,+ "root": 0.081,+ "legs": 0.233+ },+ "lead": "arms",+ "upperShare": 0.686,+ "balance": 0.892,+ "travel": 0,+ "path": 0.581,+ "rise": 0.047,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "digging": {+ "clip": "digging",+ "duration": 4.83,+ "frames": 314,+ "energy": 0.432,+ "speed": 0.678,+ "regions": {+ "head": 0.027,+ "arms": 0.527,+ "torso": 0.064,+ "root": 0.137,+ "legs": 0.245+ },+ "lead": "arms",+ "upperShare": 0.618,+ "balance": 0.918,+ "travel": 0,+ "path": 0.434,+ "rise": 0.104,+ "tempo": 0,+ "beat": 0.164,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "dodge": {+ "clip": "dodge",+ "duration": 1.43,+ "frames": 44,+ "energy": 0.576,+ "speed": 1.029,+ "regions": {+ "head": 0.092,+ "arms": 0.416,+ "torso": 0.063,+ "root": 0.113,+ "legs": 0.316+ },+ "lead": "arms",+ "upperShare": 0.571,+ "balance": 0.889,+ "travel": 0.002,+ "path": 0.349,+ "rise": 0.144,+ "tempo": 0,+ "beat": 0.13,+ "seam": 0,+ "seamRoot": 0.002,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "downdog": {+ "clip": "downdog",+ "duration": 3,+ "frames": 91,+ "energy": 0.023,+ "speed": 0.028,+ "regions": {+ "head": 0.067,+ "arms": 0.596,+ "torso": 0.05,+ "root": 0.068,+ "legs": 0.219+ },+ "lead": "arms",+ "upperShare": 0.713,+ "balance": 0.993,+ "travel": 0,+ "path": 0.016,+ "rise": 0.004,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "dying": {+ "clip": "dying",+ "duration": 4.4,+ "frames": 174,+ "energy": 0.566,+ "speed": 1.003,+ "regions": {+ "head": 0.093,+ "arms": 0.414,+ "torso": 0.065,+ "root": 0.14,+ "legs": 0.289+ },+ "lead": "arms",+ "upperShare": 0.572,+ "balance": 0.97,+ "travel": 0.344,+ "path": 1.943,+ "rise": 0.905,+ "tempo": 0,+ "beat": 0,+ "seam": 0.726,+ "seamRoot": 0.958,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "facepalm": {+ "clip": "facepalm",+ "duration": 4.2,+ "frames": 126,+ "energy": 0.271,+ "speed": 0.379,+ "regions": {+ "head": 0.054,+ "arms": 0.671,+ "torso": 0.076,+ "root": 0.088,+ "legs": 0.111+ },+ "lead": "arms",+ "upperShare": 0.801,+ "balance": 0.538,+ "travel": 0.001,+ "path": 0.271,+ "rise": 0.01,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0.001,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "falling": {+ "clip": "falling",+ "duration": 11.37,+ "frames": 342,+ "energy": 0.492,+ "speed": 0.812,+ "regions": {+ "head": 0.057,+ "arms": 0.464,+ "torso": 0.045,+ "root": 0.123,+ "legs": 0.312+ },+ "lead": "arms",+ "upperShare": 0.566,+ "balance": 0.963,+ "travel": 2.102,+ "path": 3.88,+ "rise": 0.982,+ "tempo": 0,+ "beat": 0,+ "seam": 0.414,+ "seamRoot": 2.148,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "falltolanding": {+ "clip": "falltolanding",+ "duration": 1.62,+ "frames": 98,+ "energy": 0.643,+ "speed": 1.237,+ "regions": {+ "head": 0.06,+ "arms": 0.273,+ "torso": 0.069,+ "root": 0.117,+ "legs": 0.48+ },+ "lead": "legs",+ "upperShare": 0.402,+ "balance": 0.967,+ "travel": 0.094,+ "path": 0.258,+ "rise": 0.936,+ "tempo": 0,+ "beat": 0.145,+ "seam": 0.603,+ "seamRoot": 0.588,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-box-idle": {+ "clip": "farm-box-idle",+ "duration": 6.3,+ "frames": 379,+ "energy": 0.063,+ "speed": 0.079,+ "regions": {+ "head": 0.017,+ "arms": 0.231,+ "torso": 0.067,+ "root": 0.144,+ "legs": 0.542+ },+ "lead": "legs",+ "upperShare": 0.315,+ "balance": 0.905,+ "travel": 0,+ "path": 0.126,+ "rise": 0.017,+ "tempo": 0,+ "beat": 0.216,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "farm-box-turn": {+ "clip": "farm-box-turn",+ "duration": 1.53,+ "frames": 105,+ "energy": 0.327,+ "speed": 0.475,+ "regions": {+ "head": 0.004,+ "arms": 0.138,+ "torso": 0.029,+ "root": 0.386,+ "legs": 0.443+ },+ "lead": "legs",+ "upperShare": 0.171,+ "balance": 0.94,+ "travel": 0.2,+ "path": 0.313,+ "rise": 0.014,+ "tempo": 0,+ "beat": 0.037,+ "seam": 0.109,+ "seamRoot": 0.2,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-box-walk": {+ "clip": "farm-box-walk",+ "duration": 1.22,+ "frames": 74,+ "energy": 0.485,+ "speed": 0.796,+ "regions": {+ "head": 0.005,+ "arms": 0.085,+ "torso": 0.048,+ "root": 0.116,+ "legs": 0.745+ },+ "lead": "legs",+ "upperShare": 0.138,+ "balance": 0.993,+ "travel": 1.325,+ "path": 1.335,+ "rise": 0.053,+ "tempo": 96,+ "beat": 0.975,+ "seam": 0.024,+ "seamRoot": 1.325,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "farm-cow-milking": {+ "clip": "farm-cow-milking",+ "duration": 4.53,+ "frames": 273,+ "energy": 0.172,+ "speed": 0.226,+ "regions": {+ "head": 0.02,+ "arms": 0.838,+ "torso": 0.053,+ "root": 0.013,+ "legs": 0.077+ },+ "lead": "arms",+ "upperShare": 0.911,+ "balance": 0.981,+ "travel": 0,+ "path": 0.008,+ "rise": 0.01,+ "tempo": 42,+ "beat": 0.432,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "farm-dig-plant": {+ "clip": "farm-dig-plant",+ "duration": 5.48,+ "frames": 330,+ "energy": 0.338,+ "speed": 0.496,+ "regions": {+ "head": 0.012,+ "arms": 0.595,+ "torso": 0.09,+ "root": 0.113,+ "legs": 0.191+ },+ "lead": "arms",+ "upperShare": 0.697,+ "balance": 0.789,+ "travel": 0,+ "path": 0.423,+ "rise": 0.033,+ "tempo": 0,+ "beat": 0.007,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "farm-holding-turn-left": {+ "clip": "farm-holding-turn-left",+ "duration": 1.2,+ "frames": 73,+ "energy": 0.478,+ "speed": 0.78,+ "regions": {+ "head": 0.006,+ "arms": 0.16,+ "torso": 0.031,+ "root": 0.379,+ "legs": 0.424+ },+ "lead": "legs",+ "upperShare": 0.197,+ "balance": 0.915,+ "travel": 0.264,+ "path": 0.353,+ "rise": 0.012,+ "tempo": 100,+ "beat": 0.35,+ "seam": 0.137,+ "seamRoot": 0.264,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-holding-turn-right": {+ "clip": "farm-holding-turn-right",+ "duration": 1.28,+ "frames": 78,+ "energy": 0.398,+ "speed": 0.609,+ "regions": {+ "head": 0.031,+ "arms": 0.158,+ "torso": 0.019,+ "root": 0.385,+ "legs": 0.406+ },+ "lead": "legs",+ "upperShare": 0.208,+ "balance": 0.973,+ "travel": 0.173,+ "path": 0.266,+ "rise": 0.014,+ "tempo": 0,+ "beat": 0,+ "seam": 0.118,+ "seamRoot": 0.173,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-holding-walk": {+ "clip": "farm-holding-walk",+ "duration": 1.37,+ "frames": 83,+ "energy": 0.497,+ "speed": 0.825,+ "regions": {+ "head": 0.006,+ "arms": 0.173,+ "torso": 0.067,+ "root": 0.089,+ "legs": 0.666+ },+ "lead": "legs",+ "upperShare": 0.246,+ "balance": 0.942,+ "travel": 1.549,+ "path": 1.558,+ "rise": 0.059,+ "tempo": 90,+ "beat": 0.847,+ "seam": 0.018,+ "seamRoot": 1.549,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "farm-kneeling-idle": {+ "clip": "farm-kneeling-idle",+ "duration": 4.25,+ "frames": 256,+ "energy": 0.02,+ "speed": 0.024,+ "regions": {+ "head": 0.047,+ "arms": 0.595,+ "torso": 0.201,+ "root": 0,+ "legs": 0.157+ },+ "lead": "arms",+ "upperShare": 0.843,+ "balance": 0.843,+ "travel": 0,+ "path": 0.005,+ "rise": 0.001,+ "tempo": 56,+ "beat": 0.507,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "farm-pick-fruit": {+ "clip": "farm-pick-fruit",+ "duration": 8,+ "frames": 497,+ "energy": 0.373,+ "speed": 0.56,+ "regions": {+ "head": 0.015,+ "arms": 0.613,+ "torso": 0.036,+ "root": 0.113,+ "legs": 0.223+ },+ "lead": "arms",+ "upperShare": 0.664,+ "balance": 0.422,+ "travel": 0,+ "path": 1.204,+ "rise": 0.043,+ "tempo": 27,+ "beat": 0.267,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "farm-plant-a-plant": {+ "clip": "farm-plant-a-plant",+ "duration": 7.55,+ "frames": 454,+ "energy": 0.363,+ "speed": 0.542,+ "regions": {+ "head": 0.017,+ "arms": 0.538,+ "torso": 0.067,+ "root": 0.154,+ "legs": 0.224+ },+ "lead": "arms",+ "upperShare": 0.622,+ "balance": 0.944,+ "travel": 0,+ "path": 0.722,+ "rise": 0.073,+ "tempo": 43,+ "beat": 0.47,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "farm-plant-tree": {+ "clip": "farm-plant-tree",+ "duration": 9.27,+ "frames": 557,+ "energy": 0.364,+ "speed": 0.543,+ "regions": {+ "head": 0.014,+ "arms": 0.322,+ "torso": 0.058,+ "root": 0.182,+ "legs": 0.425+ },+ "lead": "legs",+ "upperShare": 0.394,+ "balance": 0.887,+ "travel": 0,+ "path": 0.933,+ "rise": 0.211,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-pull-plant": {+ "clip": "farm-pull-plant",+ "duration": 4.65,+ "frames": 334,+ "energy": 0.52,+ "speed": 0.881,+ "regions": {+ "head": 0.031,+ "arms": 0.482,+ "torso": 0.078,+ "root": 0.133,+ "legs": 0.276+ },+ "lead": "arms",+ "upperShare": 0.591,+ "balance": 0.875,+ "travel": 0,+ "path": 0.498,+ "rise": 0.242,+ "tempo": 28,+ "beat": 0.444,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-watering": {+ "clip": "farm-watering",+ "duration": 5.58,+ "frames": 336,+ "energy": 0.235,+ "speed": 0.322,+ "regions": {+ "head": 0.014,+ "arms": 0.456,+ "torso": 0.107,+ "root": 0.164,+ "legs": 0.259+ },+ "lead": "arms",+ "upperShare": 0.577,+ "balance": 0.868,+ "travel": 0,+ "path": 0.589,+ "rise": 0.022,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-wheelbarrow-dump": {+ "clip": "farm-wheelbarrow-dump",+ "duration": 6.23,+ "frames": 390,+ "energy": 0.475,+ "speed": 0.773,+ "regions": {+ "head": 0.044,+ "arms": 0.562,+ "torso": 0.051,+ "root": 0.074,+ "legs": 0.27+ },+ "lead": "arms",+ "upperShare": 0.657,+ "balance": 0.901,+ "travel": 0,+ "path": 1.034,+ "rise": 0.099,+ "tempo": 0,+ "beat": 0.109,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "farm-wheelbarrow-idle": {+ "clip": "farm-wheelbarrow-idle",+ "duration": 1.5,+ "frames": 91,+ "energy": 0.032,+ "speed": 0.039,+ "regions": {+ "head": 0.077,+ "arms": 0.511,+ "torso": 0.115,+ "root": 0,+ "legs": 0.297+ },+ "lead": "arms",+ "upperShare": 0.703,+ "balance": 0.974,+ "travel": 0,+ "path": 0.009,+ "rise": 0.003,+ "tempo": 82,+ "beat": 0.742,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "farm-wheelbarrow-turn": {+ "clip": "farm-wheelbarrow-turn",+ "duration": 1.07,+ "frames": 65,+ "energy": 0.624,+ "speed": 1.175,+ "regions": {+ "head": 0.008,+ "arms": 0.137,+ "torso": 0.049,+ "root": 0.1,+ "legs": 0.706+ },+ "lead": "legs",+ "upperShare": 0.194,+ "balance": 0.979,+ "travel": 1.586,+ "path": 1.602,+ "rise": 0.068,+ "tempo": 112,+ "beat": 0.706,+ "seam": 0.022,+ "seamRoot": 1.586,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "farm-wheelbarrow-walk": {+ "clip": "farm-wheelbarrow-walk",+ "duration": 0.97,+ "frames": 59,+ "energy": 0.626,+ "speed": 1.179,+ "regions": {+ "head": 0.02,+ "arms": 0.198,+ "torso": 0.055,+ "root": 0.069,+ "legs": 0.658+ },+ "lead": "legs",+ "upperShare": 0.273,+ "balance": 0.997,+ "travel": 1.488,+ "path": 1.49,+ "rise": 0.088,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 1.488,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "goalkeeper": {+ "clip": "goalkeeper",+ "duration": 2.6,+ "frames": 79,+ "energy": 0.751,+ "speed": 1.669,+ "regions": {+ "head": 0.034,+ "arms": 0.338,+ "torso": 0.044,+ "root": 0.121,+ "legs": 0.463+ },+ "lead": "legs",+ "upperShare": 0.416,+ "balance": 0.962,+ "travel": 4.101,+ "path": 4.297,+ "rise": 0.25,+ "tempo": 0,+ "beat": 0,+ "seam": 0.27,+ "seamRoot": 4.101,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "header": {+ "clip": "header",+ "duration": 1.9,+ "frames": 58,+ "energy": 0.493,+ "speed": 0.816,+ "regions": {+ "head": 0.068,+ "arms": 0.388,+ "torso": 0.033,+ "root": 0.114,+ "legs": 0.398+ },+ "lead": "legs",+ "upperShare": 0.489,+ "balance": 0.994,+ "travel": 0,+ "path": 0.309,+ "rise": 0.125,+ "tempo": 106,+ "beat": 0.332,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "idle": {+ "clip": "idle",+ "duration": 15.8,+ "frames": 475,+ "energy": 0.087,+ "speed": 0.109,+ "regions": {+ "head": 0.054,+ "arms": 0.382,+ "torso": 0.151,+ "root": 0.135,+ "legs": 0.278+ },+ "lead": "arms",+ "upperShare": 0.587,+ "balance": 0.991,+ "travel": 0,+ "path": 0.67,+ "rise": 0.027,+ "tempo": 0,+ "beat": 0,+ "seam": 0.008,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "jog": {+ "clip": "jog",+ "duration": 0.83,+ "frames": 24,+ "energy": 0.807,+ "speed": 1.973,+ "regions": {+ "head": 0.007,+ "arms": 0.329,+ "torso": 0.06,+ "root": 0.068,+ "legs": 0.536+ },+ "lead": "legs",+ "upperShare": 0.396,+ "balance": 0.935,+ "travel": 1.973,+ "path": 1.974,+ "rise": 0.082,+ "tempo": 150,+ "beat": 0.76,+ "seam": 0,+ "seamRoot": 1.973,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "jump": {+ "clip": "jump",+ "duration": 1.87,+ "frames": 57,+ "energy": 0.784,+ "speed": 1.841,+ "regions": {+ "head": 0.035,+ "arms": 0.368,+ "torso": 0.064,+ "root": 0.058,+ "legs": 0.475+ },+ "lead": "legs",+ "upperShare": 0.467,+ "balance": 0.998,+ "travel": 0,+ "path": 0.235,+ "rise": 0.394,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "jumpdown": {+ "clip": "jumpdown",+ "duration": 3.83,+ "frames": 116,+ "energy": 0.641,+ "speed": 1.229,+ "regions": {+ "head": 0.045,+ "arms": 0.439,+ "torso": 0.059,+ "root": 0.114,+ "legs": 0.343+ },+ "lead": "arms",+ "upperShare": 0.543,+ "balance": 0.898,+ "travel": 1,+ "path": 1.331,+ "rise": 1.66,+ "tempo": 0,+ "beat": 0,+ "seam": 0.362,+ "seamRoot": 1.783,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "jumpdown2": {+ "clip": "jumpdown2",+ "duration": 2.83,+ "frames": 86,+ "energy": 0.441,+ "speed": 0.698,+ "regions": {+ "head": 0.047,+ "arms": 0.226,+ "torso": 0.055,+ "root": 0.139,+ "legs": 0.532+ },+ "lead": "legs",+ "upperShare": 0.328,+ "balance": 0.975,+ "travel": 1.726,+ "path": 1.834,+ "rise": 0.871,+ "tempo": 0,+ "beat": 0,+ "seam": 0.156,+ "seamRoot": 1.85,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "jumpdown3": {+ "clip": "jumpdown3",+ "duration": 2.93,+ "frames": 89,+ "energy": 0.803,+ "speed": 1.947,+ "regions": {+ "head": 0.044,+ "arms": 0.402,+ "torso": 0.072,+ "root": 0.085,+ "legs": 0.395+ },+ "lead": "arms",+ "upperShare": 0.518,+ "balance": 0.983,+ "travel": 2.094,+ "path": 2.142,+ "rise": 1.669,+ "tempo": 0,+ "beat": 0.073,+ "seam": 0.392,+ "seamRoot": 2.255,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "kiss": {+ "clip": "kiss",+ "duration": 7.07,+ "frames": 213,+ "energy": 0.132,+ "speed": 0.169,+ "regions": {+ "head": 0.121,+ "arms": 0.626,+ "torso": 0.054,+ "root": 0.057,+ "legs": 0.142+ },+ "lead": "arms",+ "upperShare": 0.801,+ "balance": 0.934,+ "travel": 0,+ "path": 0.152,+ "rise": 0.015,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "lookdown": {+ "clip": "lookdown",+ "duration": 4.77,+ "frames": 144,+ "energy": 0.154,+ "speed": 0.201,+ "regions": {+ "head": 0.121,+ "arms": 0.248,+ "torso": 0.032,+ "root": 0.19,+ "legs": 0.41+ },+ "lead": "legs",+ "upperShare": 0.401,+ "balance": 0.968,+ "travel": 0,+ "path": 0.332,+ "rise": 0.037,+ "tempo": 51,+ "beat": 0.257,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "michelle-samba-dance": {+ "clip": "michelle-samba-dance",+ "duration": 18.23,+ "frames": 547,+ "energy": 0.854,+ "speed": 2.305,+ "regions": {+ "head": 0.047,+ "arms": 0.443,+ "torso": 0.084,+ "root": 0.125,+ "legs": 0.302+ },+ "lead": "arms",+ "upperShare": 0.574,+ "balance": 0.971,+ "travel": 0,+ "path": 7.814,+ "rise": 0.281,+ "tempo": 200,+ "beat": 0.441,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "nod": {+ "clip": "nod",+ "duration": 1.73,+ "frames": 53,+ "energy": 0.132,+ "speed": 0.17,+ "regions": {+ "head": 0.207,+ "arms": 0.62,+ "torso": 0.016,+ "root": 0.05,+ "legs": 0.107+ },+ "lead": "arms",+ "upperShare": 0.843,+ "balance": 0.986,+ "travel": 0,+ "path": 0.022,+ "rise": 0.004,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "point": {+ "clip": "point",+ "duration": 2.77,+ "frames": 84,+ "energy": 0.18,+ "speed": 0.239,+ "regions": {+ "head": 0.065,+ "arms": 0.647,+ "torso": 0.056,+ "root": 0.096,+ "legs": 0.135+ },+ "lead": "arms",+ "upperShare": 0.768,+ "balance": 0.457,+ "travel": 0,+ "path": 0.083,+ "rise": 0.002,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "pray": {+ "clip": "pray",+ "duration": 6.87,+ "frames": 207,+ "energy": 0.259,+ "speed": 0.359,+ "regions": {+ "head": 0.056,+ "arms": 0.405,+ "torso": 0.073,+ "root": 0.114,+ "legs": 0.352+ },+ "lead": "arms",+ "upperShare": 0.534,+ "balance": 0.927,+ "travel": 0.075,+ "path": 0.676,+ "rise": 0.476,+ "tempo": 0,+ "beat": 0.02,+ "seam": 0.501,+ "seamRoot": 0.474,+ "loopClean": false,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "reaction": {+ "clip": "reaction",+ "duration": 1.83,+ "frames": 86,+ "energy": 0.548,+ "speed": 0.954,+ "regions": {+ "head": 0.097,+ "arms": 0.305,+ "torso": 0.084,+ "root": 0.201,+ "legs": 0.314+ },+ "lead": "legs",+ "upperShare": 0.486,+ "balance": 0.878,+ "travel": 0.001,+ "path": 0.567,+ "rise": 0.064,+ "tempo": 150,+ "beat": 0.462,+ "seam": 0.005,+ "seamRoot": 0.001,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "removing": {+ "clip": "removing",+ "duration": 10.37,+ "frames": 312,+ "energy": 0.431,+ "speed": 0.676,+ "regions": {+ "head": 0.069,+ "arms": 0.412,+ "torso": 0.036,+ "root": 0.126,+ "legs": 0.357+ },+ "lead": "arms",+ "upperShare": 0.517,+ "balance": 0.998,+ "travel": 0.952,+ "path": 1.92,+ "rise": 0.259,+ "tempo": 0,+ "beat": 0,+ "seam": 0.618,+ "seamRoot": 0.98,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "rumba": {+ "clip": "rumba",+ "duration": 2.37,+ "frames": 72,+ "energy": 0.72,+ "speed": 1.529,+ "regions": {+ "head": 0.028,+ "arms": 0.31,+ "torso": 0.136,+ "root": 0.212,+ "legs": 0.314+ },+ "lead": "legs",+ "upperShare": 0.474,+ "balance": 0.974,+ "travel": 0,+ "path": 0.586,+ "rise": 0.063,+ "tempo": 51,+ "beat": 0.763,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "shoved": {+ "clip": "shoved",+ "duration": 4.53,+ "frames": 268,+ "energy": 0.614,+ "speed": 1.141,+ "regions": {+ "head": 0.054,+ "arms": 0.395,+ "torso": 0.052,+ "root": 0.157,+ "legs": 0.341+ },+ "lead": "arms",+ "upperShare": 0.501,+ "balance": 0.993,+ "travel": 2.214,+ "path": 2.717,+ "rise": 0.108,+ "tempo": 0,+ "beat": 0,+ "seam": 0.282,+ "seamRoot": 2.214,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "shrug": {+ "clip": "shrug",+ "duration": 2,+ "frames": 61,+ "energy": 0.351,+ "speed": 0.519,+ "regions": {+ "head": 0.04,+ "arms": 0.781,+ "torso": 0.03,+ "root": 0.05,+ "legs": 0.098+ },+ "lead": "arms",+ "upperShare": 0.851,+ "balance": 0.987,+ "travel": 0,+ "path": 0.044,+ "rise": 0.004,+ "tempo": 67,+ "beat": 0.55,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "silly": {+ "clip": "silly",+ "duration": 3.83,+ "frames": 116,+ "energy": 0.738,+ "speed": 1.608,+ "regions": {+ "head": 0.05,+ "arms": 0.518,+ "torso": 0.075,+ "root": 0.11,+ "legs": 0.247+ },+ "lead": "arms",+ "upperShare": 0.643,+ "balance": 0.982,+ "travel": 0,+ "path": 1.071,+ "rise": 0.115,+ "tempo": 129,+ "beat": 0.699,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "sitclap": {+ "clip": "sitclap",+ "duration": 5.67,+ "frames": 171,+ "energy": 0.412,+ "speed": 0.637,+ "regions": {+ "head": 0.034,+ "arms": 0.917,+ "torso": 0.015,+ "root": 0.013,+ "legs": 0.021+ },+ "lead": "arms",+ "upperShare": 0.966,+ "balance": 0.87,+ "travel": 0,+ "path": 0.078,+ "rise": 0.004,+ "tempo": 0,+ "beat": 0.223,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "sitidle": {+ "clip": "sitidle",+ "duration": 1,+ "frames": 2,+ "energy": 0,+ "speed": 0,+ "regions": {+ "head": 0.125,+ "arms": 0.225,+ "torso": 0.106,+ "root": 0,+ "legs": 0.544+ },+ "lead": "legs",+ "upperShare": 0.456,+ "balance": 0.918,+ "travel": 0,+ "path": 0,+ "rise": 0,+ "tempo": 150,+ "beat": 0.84,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": false,+ "anchored": true,+ "overlay": false,+ "static": true,+ "declaredLoop": true+ },+ "sitlaugh": {+ "clip": "sitlaugh",+ "duration": 8.33,+ "frames": 251,+ "energy": 0.195,+ "speed": 0.26,+ "regions": {+ "head": 0.131,+ "arms": 0.501,+ "torso": 0.063,+ "root": 0.149,+ "legs": 0.157+ },+ "lead": "arms",+ "upperShare": 0.695,+ "balance": 0.964,+ "travel": 0,+ "path": 0.305,+ "rise": 0.032,+ "tempo": 0,+ "beat": 0.208,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "sitloop": {+ "clip": "sitloop",+ "duration": 4.3,+ "frames": 130,+ "energy": 0.025,+ "speed": 0.03,+ "regions": {+ "head": 0.105,+ "arms": 0.546,+ "torso": 0.159,+ "root": 0.085,+ "legs": 0.106+ },+ "lead": "arms",+ "upperShare": 0.81,+ "balance": 0.933,+ "travel": 0,+ "path": 0.007,+ "rise": 0,+ "tempo": 0,+ "beat": 0.096,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "soldier-idle": {+ "clip": "soldier-idle",+ "duration": 1.97,+ "frames": 60,+ "energy": 0.034,+ "speed": 0.041,+ "regions": {+ "head": 0.126,+ "arms": 0.581,+ "torso": 0.033,+ "root": 0.056,+ "legs": 0.205+ },+ "lead": "arms",+ "upperShare": 0.74,+ "balance": 0.782,+ "travel": 0,+ "path": 0.022,+ "rise": 0.005,+ "tempo": 60,+ "beat": 0.576,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "soldier-run": {+ "clip": "soldier-run",+ "duration": 0.7,+ "frames": 22,+ "energy": 0.938,+ "speed": 3.344,+ "regions": {+ "head": 0.053,+ "arms": 0.282,+ "torso": 0.095,+ "root": 0.074,+ "legs": 0.497+ },+ "lead": "legs",+ "upperShare": 0.43,+ "balance": 0.971,+ "travel": 0,+ "path": 0.158,+ "rise": 0.104,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "soldier-walk": {+ "clip": "soldier-walk",+ "duration": 1.03,+ "frames": 32,+ "energy": 0.727,+ "speed": 1.559,+ "regions": {+ "head": 0.03,+ "arms": 0.27,+ "torso": 0.069,+ "root": 0.052,+ "legs": 0.578+ },+ "lead": "legs",+ "upperShare": 0.369,+ "balance": 0.948,+ "travel": 0,+ "path": 0.213,+ "rise": 0.085,+ "tempo": 113,+ "beat": 0.869,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "standup": {+ "clip": "standup",+ "duration": 2.57,+ "frames": 78,+ "energy": 0.301,+ "speed": 0.43,+ "regions": {+ "head": 0.072,+ "arms": 0.297,+ "torso": 0.064,+ "root": 0.13,+ "legs": 0.437+ },+ "lead": "legs",+ "upperShare": 0.433,+ "balance": 0.952,+ "travel": 0.299,+ "path": 0.546,+ "rise": 0.523,+ "tempo": 0,+ "beat": 0,+ "seam": 0.612,+ "seamRoot": 0.598,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "stepback": {+ "clip": "stepback",+ "duration": 1.83,+ "frames": 56,+ "energy": 0.298,+ "speed": 0.424,+ "regions": {+ "head": 0.03,+ "arms": 0.166,+ "torso": 0.089,+ "root": 0.172,+ "legs": 0.543+ },+ "lead": "legs",+ "upperShare": 0.285,+ "balance": 0.961,+ "travel": 0.529,+ "path": 0.586,+ "rise": 0.056,+ "tempo": 164,+ "beat": 0.299,+ "seam": 0,+ "seamRoot": 0.529,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "taunt": {+ "clip": "taunt",+ "duration": 2.83,+ "frames": 86,+ "energy": 0.303,+ "speed": 0.433,+ "regions": {+ "head": 0.124,+ "arms": 0.585,+ "torso": 0.056,+ "root": 0.072,+ "legs": 0.162+ },+ "lead": "arms",+ "upperShare": 0.765,+ "balance": 0.995,+ "travel": 0,+ "path": 0.281,+ "rise": 0.04,+ "tempo": 0,+ "beat": 0.052,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "think": {+ "clip": "think",+ "duration": 2.93,+ "frames": 89,+ "energy": 0.108,+ "speed": 0.138,+ "regions": {+ "head": 0.166,+ "arms": 0.538,+ "torso": 0.023,+ "root": 0.11,+ "legs": 0.163+ },+ "lead": "arms",+ "upperShare": 0.727,+ "balance": 0.988,+ "travel": 0,+ "path": 0.046,+ "rise": 0.001,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "thriller": {+ "clip": "thriller",+ "duration": 25.57,+ "frames": 1167,+ "energy": 0.804,+ "speed": 1.955,+ "regions": {+ "head": 0.072,+ "arms": 0.419,+ "torso": 0.061,+ "root": 0.168,+ "legs": 0.281+ },+ "lead": "arms",+ "upperShare": 0.552,+ "balance": 0.975,+ "travel": 4.286,+ "path": 12.306,+ "rise": 0.53,+ "tempo": 120,+ "beat": 0.4,+ "seam": 0.587,+ "seamRoot": 4.286,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "torch-light-wall": {+ "clip": "torch-light-wall",+ "duration": 4.42,+ "frames": 266,+ "energy": 0.261,+ "speed": 0.363,+ "regions": {+ "head": 0.017,+ "arms": 0.26,+ "torso": 0.082,+ "root": 0.149,+ "legs": 0.493+ },+ "lead": "legs",+ "upperShare": 0.359,+ "balance": 0.887,+ "travel": 0,+ "path": 1.204,+ "rise": 0.038,+ "tempo": 0,+ "beat": 0,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "torch-light": {+ "clip": "torch-light",+ "duration": 4.42,+ "frames": 266,+ "energy": 0.324,+ "speed": 0.469,+ "regions": {+ "head": 0.021,+ "arms": 0.34,+ "torso": 0.103,+ "root": 0.155,+ "legs": 0.381+ },+ "lead": "legs",+ "upperShare": 0.464,+ "balance": 0.921,+ "travel": 0,+ "path": 1.206,+ "rise": 0.101,+ "tempo": 0,+ "beat": 0,+ "seam": 0.007,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "turn": {+ "clip": "turn",+ "duration": 1.63,+ "frames": 50,+ "energy": 0.504,+ "speed": 0.842,+ "regions": {+ "head": 0.039,+ "arms": 0.23,+ "torso": 0.026,+ "root": 0.286,+ "legs": 0.419+ },+ "lead": "legs",+ "upperShare": 0.295,+ "balance": 0.993,+ "travel": 0.029,+ "path": 0.704,+ "rise": 0.021,+ "tempo": 78,+ "beat": 0.445,+ "seam": 0.14,+ "seamRoot": 0.029,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "twerk": {+ "clip": "twerk",+ "duration": 5,+ "frames": 301,+ "energy": 0.69,+ "speed": 1.407,+ "regions": {+ "head": 0.039,+ "arms": 0.35,+ "torso": 0.106,+ "root": 0.196,+ "legs": 0.308+ },+ "lead": "arms",+ "upperShare": 0.495,+ "balance": 0.967,+ "travel": 0.089,+ "path": 1.412,+ "rise": 0.301,+ "tempo": 200,+ "beat": 0.407,+ "seam": 0.518,+ "seamRoot": 0.214,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "walk": {+ "clip": "walk",+ "duration": 0.97,+ "frames": 30,+ "energy": 0.715,+ "speed": 1.508,+ "regions": {+ "head": 0.02,+ "arms": 0.345,+ "torso": 0.054,+ "root": 0.086,+ "legs": 0.495+ },+ "lead": "legs",+ "upperShare": 0.419,+ "balance": 0.985,+ "travel": 0,+ "path": 0.17,+ "rise": 0.044,+ "tempo": 129,+ "beat": 0.446,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "wave": {+ "clip": "wave",+ "duration": 1,+ "frames": 31,+ "energy": 0.51,+ "speed": 0.856,+ "regions": {+ "head": 0.133,+ "arms": 0.264,+ "torso": 0.04,+ "root": 0.175,+ "legs": 0.388+ },+ "lead": "legs",+ "upperShare": 0.437,+ "balance": 0.971,+ "travel": 0.291,+ "path": 0.302,+ "rise": 0.03,+ "tempo": 0,+ "beat": 0,+ "seam": 0.479,+ "seamRoot": 0.291,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": false+ },+ "xbot-agree": {+ "clip": "xbot-agree",+ "duration": 1.83,+ "frames": 56,+ "energy": 0.095,+ "speed": 0.119,+ "regions": {+ "head": 0.165,+ "arms": 0.433,+ "torso": 0.03,+ "root": 0.101,+ "legs": 0.271+ },+ "lead": "arms",+ "upperShare": 0.628,+ "balance": 0.803,+ "travel": 0,+ "path": 0.033,+ "rise": 0.01,+ "tempo": 129,+ "beat": 0.337,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "xbot-head-shake": {+ "clip": "xbot-head-shake",+ "duration": 2.57,+ "frames": 78,+ "energy": 0.089,+ "speed": 0.111,+ "regions": {+ "head": 0.432,+ "arms": 0.392,+ "torso": 0.01,+ "root": 0.057,+ "legs": 0.11+ },+ "lead": "head",+ "upperShare": 0.834,+ "balance": 0.482,+ "travel": 0,+ "path": 0.036,+ "rise": 0.001,+ "tempo": 100,+ "beat": 0.397,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": false+ },+ "xbot-idle": {+ "clip": "xbot-idle",+ "duration": 2.5,+ "frames": 76,+ "energy": 0.01,+ "speed": 0.012,+ "regions": {+ "head": 0.061,+ "arms": 0.715,+ "torso": 0.034,+ "root": 0.057,+ "legs": 0.133+ },+ "lead": "arms",+ "upperShare": 0.81,+ "balance": 0.383,+ "travel": 0,+ "path": 0.014,+ "rise": 0,+ "tempo": 120,+ "beat": 0.266,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "xbot-run": {+ "clip": "xbot-run",+ "duration": 0.7,+ "frames": 22,+ "energy": 0.93,+ "speed": 3.2,+ "regions": {+ "head": 0.043,+ "arms": 0.345,+ "torso": 0.06,+ "root": 0.078,+ "legs": 0.474+ },+ "lead": "legs",+ "upperShare": 0.448,+ "balance": 0.998,+ "travel": 0,+ "path": 0.063,+ "rise": 0.094,+ "tempo": 164,+ "beat": 0.736,+ "seam": 0.005,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "xbot-sad-pose": {+ "clip": "xbot-sad-pose",+ "duration": 0.07,+ "frames": 2,+ "energy": 0.796,+ "speed": 1.908,+ "regions": {+ "head": 0.169,+ "arms": 0.531,+ "torso": 0.3,+ "root": 0,+ "legs": 0+ },+ "lead": "arms",+ "upperShare": 1,+ "balance": 1,+ "travel": 0,+ "path": 0,+ "rise": 0,+ "tempo": 0,+ "beat": 0,+ "seam": 0.127,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": true,+ "static": false,+ "declaredLoop": true+ },+ "xbot-sneak-pose": {+ "clip": "xbot-sneak-pose",+ "duration": 0.07,+ "frames": 2,+ "energy": 0.99,+ "speed": 5.544,+ "regions": {+ "head": 0.037,+ "arms": 0.441,+ "torso": 0.107,+ "root": 0.023,+ "legs": 0.392+ },+ "lead": "arms",+ "upperShare": 0.585,+ "balance": 0.976,+ "travel": 0.147,+ "path": 0.147,+ "rise": 0.079,+ "tempo": 0,+ "beat": 0,+ "seam": 0.37,+ "seamRoot": 0.166,+ "loopClean": false,+ "anchored": false,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ },+ "xbot-walk": {+ "clip": "xbot-walk",+ "duration": 0.97,+ "frames": 30,+ "energy": 0.715,+ "speed": 1.507,+ "regions": {+ "head": 0.019,+ "arms": 0.345,+ "torso": 0.054,+ "root": 0.086,+ "legs": 0.495+ },+ "lead": "legs",+ "upperShare": 0.418,+ "balance": 0.985,+ "travel": 0,+ "path": 0.097,+ "rise": 0.044,+ "tempo": 129,+ "beat": 0.446,+ "seam": 0,+ "seamRoot": 0,+ "loopClean": true,+ "anchored": true,+ "overlay": false,+ "static": false,+ "declaredLoop": true+ }+ }+}diff --git a/scripts/build-motion-signatures.mjs b/scripts/build-motion-signatures.mjsnew file mode 100644index 000000000..3ef469c5b--- /dev/null+++ b/scripts/build-motion-signatures.mjs@@ -0,0 +1,87 @@+#!/usr/bin/env node+// Measure every baked clip and write public/animations/signatures.json.+//+// The index is a static artifact on purpose. Analysing 112 clips takes a couple+// of seconds and the answer only changes when a clip is rebaked, so paying that+// cost per page view (or per API call) would be waste. Everything downstream+// reads the JSON: the /gestures page, the /animations gallery, and the tests+// that hold the walk-layer table to what the motion actually does.+//+// Usage:+// node scripts/build-motion-signatures.mjs write the index+// node scripts/build-motion-signatures.mjs --check fail if it is stale+//+// Wired into `npm run build:animations`, so rebaking a clip regenerates it.++import fs from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { analyzeClip, SIGNATURE_VERSION } from '../src/runtime/motion-signature.js';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const CLIPS_DIR = path.join(ROOT, 'public/animations/clips');+const MANIFEST = path.join(ROOT, 'public/animations/manifest.json');+const OUT = path.join(ROOT, 'public/animations/signatures.json');++/**+ * Analyse every clip on disk, keyed by clip name.+ * @returns {{version:number, count:number, clips:Object}}+ */+export function buildIndex() {+ const files = fs+ .readdirSync(CLIPS_DIR)+ .filter((f) => f.endsWith('.json') && !f.startsWith('.'))+ .sort();++ const manifest = JSON.parse(fs.readFileSync(MANIFEST, 'utf8'));+ const declaredLoop = new Map(manifest.map((entry) => [entry.name, !!entry.loop]));++ const clips = {};+ for (const file of files) {+ const clip = JSON.parse(fs.readFileSync(path.join(CLIPS_DIR, file), 'utf8'));+ const sig = analyzeClip(clip);+ if (!sig.clip) sig.clip = path.basename(file, '.json');+ // The manifest's loop flag is the authoring intent; `loopClean` is what+ // the keyframes support. Carrying both is what lets a report say "this+ // one is declared as a loop but does not close".+ sig.declaredLoop = declaredLoop.get(sig.clip) ?? false;+ clips[sig.clip] = sig;+ }++ return { version: SIGNATURE_VERSION, count: Object.keys(clips).length, clips };+}++/** Stable serialisation, so an unchanged library produces an unchanged file. */+function serialize(index) {+ return `${JSON.stringify(index, null, '\t')}\n`;+}++function main() {+ const check = process.argv.includes('--check');+ const index = buildIndex();+ const next = serialize(index);++ if (check) {+ const current = fs.existsSync(OUT) ? fs.readFileSync(OUT, 'utf8') : '';+ if (current !== next) {+ console.error('signatures.json is stale. Run: npm run build:motion-signatures');+ process.exit(1);+ }+ console.log(`signatures.json is current (${index.count} clips).`);+ return;+ }++ fs.writeFileSync(OUT, next);++ const all = Object.values(index.clips);+ const still = all.filter((s) => s.static);+ const brokenLoops = all.filter((s) => s.declaredLoop && !s.loopClean);+ const overlays = all.filter((s) => s.overlay);++ console.log(`Wrote ${path.relative(ROOT, OUT)} (${index.count} clips, v${index.version}).`);+ console.log(` overlay-safe: ${overlays.length}`);+ console.log(` held poses: ${still.length}${still.length ? ` (${still.map((s) => s.clip).join(', ')})` : ''}`);+ console.log(` loops with a visible seam: ${brokenLoops.length}${brokenLoops.length ? ` (${brokenLoops.map((s) => s.clip).join(', ')})` : ''}`);+}++if (process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) main();diff --git a/src/asl-alphabet-page.js b/src/asl-alphabet-page.jsindex 63ea498c3..c01dca04b 100644--- a/src/asl-alphabet-page.js+++ b/src/asl-alphabet-page.js@@ -411,6 +411,18 @@ async function boot() {});// ── Deep links ───────────────────────────────────────────────────────────+ // The stage crossfades to its idle clip asynchronously after mounting, so a+ // letter played the instant boot finishes is overwritten the moment that+ // idle lands: the shared link opened on an avatar standing at rest. Wait for+ // the idle to take before honoring the link.+ const waitForIdleClip = async () => {+ for (let i = 0; i < 60; i++) {+ if (!stage?.anim || stage.anim.currentName) return;+ await new Promise((resolve) => setTimeout(resolve, 50));+ }+ };+ if (canSign) await waitForIdleClip();+const params = new URLSearchParams(location.search);const wanted = (params.get('letter') || '').toUpperCase().slice(0, 1);const wantedWord = params.get('spell') || '';diff --git a/src/runtime/arkit52.js b/src/runtime/arkit52.jsindex 6143ea638..535a894c4 100644--- a/src/runtime/arkit52.js+++ b/src/runtime/arkit52.js@@ -132,6 +132,73 @@ const SYMMETRIC_PAIRS = Object.freeze({noseSneerLeft: 'noseSneerRight',});+/**+ * Separator- and case-insensitive lookup: normalized spelling → canonical name.+ * Exporters disagree about case and separators far more often than they+ * disagree about the word itself (`MouthSmile_L`, `mouth-smile-left`,+ * `Mouth Smile Left` are all the same shape), so normalizing before the lookup+ * resolves rigs an exact-match table silently drops.+ */+const _normalizedMorphIndex = (() => {+ const m = new Map();+ const put = (spelling, canonical) => {+ const key = normalizeToken(spelling);+ if (key && !m.has(key)) m.set(key, canonical);+ };+ for (const name of ARKIT_52) put(name, name);+ for (const name of ARKIT_VISEMES) put(name, name);+ for (const [alias, canonical] of Object.entries(MORPH_ALIASES)) put(alias, canonical);+ return m;+})();++function normalizeToken(name) {+ return String(name || '').replace(/[\s_\-.:]/g, '').toLowerCase();+}++/**+ * Resolve one GLB morph-target name to its canonical ARKit-52 / viseme name.+ * Pure and string-only, so the same mapping runs in the browser (over a loaded+ * Three.js mesh) and on the server (over names read straight out of a glTF+ * JSON chunk, with no scene graph and no GPU).+ *+ * @param {string} glbName — the morph target name as authored in the GLB+ * @returns {string | null} canonical name, or null when it is not an ARKit shape+ */+export function canonicalMorphName(glbName) {+ if (!glbName) return null;+ const direct = MORPH_ALIASES[glbName] || glbName;+ if (ARKIT_52.includes(direct) || ARKIT_VISEMES.includes(direct)) return direct;+ return _normalizedMorphIndex.get(normalizeToken(glbName)) || null;+}++/**+ * Report ARKit-52 coverage from morph-target NAMES alone.+ * Same contract as conformanceReport() but takes an iterable of strings, so a+ * caller that never loads the mesh (the capability API, an upload validator)+ * gets the identical answer as the runtime.+ *+ * @param {Iterable<string>} names+ * @returns {{ implemented: string[], missing: string[], coverage: number, visemes: string[], unmapped: string[] }}+ */+export function conformanceFromNames(names) {+ const resolved = new Set();+ const unmapped = [];+ for (const raw of names || []) {+ const canonical = canonicalMorphName(raw);+ if (canonical) resolved.add(canonical);+ else if (raw) unmapped.push(String(raw));+ }+ const implemented = ARKIT_52.filter((name) => resolved.has(name));+ const missing = ARKIT_52.filter((name) => !resolved.has(name));+ return {+ implemented,+ missing,+ coverage: implemented.length / ARKIT_52.length,+ visemes: ARKIT_VISEMES.filter((name) => resolved.has(name)),+ unmapped,+ };+}+/*** Walk a Three.js root and build a canonical-name → [{mesh, index}] resolver.* Each canonical ARKit-52 name maps to every mesh slot that implements it,@@ -148,8 +215,8 @@ export function resolveMorphTargets(root) {if (!node.isMesh || !node.morphTargetDictionary || !node.morphTargetInfluences) return;const dict = node.morphTargetDictionary;for (const [glbName, idx] of Object.entries(dict)) {- const canonical = MORPH_ALIASES[glbName] || glbName;- if (!ARKIT_52.includes(canonical) && !ARKIT_VISEMES.includes(canonical)) continue;+ const canonical = canonicalMorphName(glbName);+ if (!canonical) continue;if (!out.has(canonical)) out.set(canonical, []);out.get(canonical).push({ mesh: node, index: idx });}diff --git a/src/runtime/motion-signature.js b/src/runtime/motion-signature.jsnew file mode 100644index 000000000..e76370d15--- /dev/null+++ b/src/runtime/motion-signature.js@@ -0,0 +1,487 @@+// Motion signatures: what a baked clip actually does, measured from its keyframes.+//+// Every clip in public/animations/clips/*.json is a THREE.AnimationClip with+// named bone tracks on the canonical skeleton (src/glb-canonicalize.js maps any+// rig onto it). That means the motion is not opaque: the rotation of every bone+// over time is right there, and questions people keep answering by eye can be+// answered by arithmetic instead.+//+// • Where does this clip move? (head, arms, torso, legs, root)+// • How energetic is it, and does it have a beat?+// • Does it travel across the floor, or stay on the spot?+// • Does its last frame meet its first, i.e. can it loop without a snap?+// • Can it overlay a walk cycle, or does it need the whole body?+//+// Those answers drive real behaviour, not decoration: the /walk gesture layer+// table is checked against measured overlay-safety in tests/motion-signature+// .test.js, and the /gestures override picker refuses to quietly hand a slot a+// clip that cannot do the job that slot is for.+//+// Dependency-free on purpose (no Three.js, no DOM, no fs) for the same reason+// animation-slots.js is: the build script, the tests and the browser all import+// this one file, so they can never disagree about what a signature means.++/** Bumped when a field changes meaning. The build script stamps it into the index. */+export const SIGNATURE_VERSION = 1;++/** Body regions, in head-to-toe order (the order the UI renders them in). */+export const REGIONS = ['head', 'arms', 'torso', 'root', 'legs'];++/** Human labels for the regions, so every surface names them identically. */+export const REGION_LABELS = {+ head: 'Head',+ arms: 'Arms',+ torso: 'Torso',+ root: 'Hips',+ legs: 'Legs',+};++/**+ * Fewer frames than this is a pose, not an animation. Single-frame clips do+ * exist in the library (they were exported from a static pose) and they must be+ * flagged rather than silently scored as "perfectly calm".+ */+const MIN_ANIMATED_FRAMES = 2;++/** Below this mean angular speed (rad/s) nothing visible is happening. */+const STATIC_SPEED = 0.005;++/** Saturation constant for the 0..1 energy scale. A brisk walk lands near 0.7. */+const ENERGY_SCALE = 1.2;++/** Autocorrelation search window for a beat, in seconds. */+const MIN_BEAT_PERIOD = 0.3;+const MAX_BEAT_PERIOD = 2.5;++/** A peak below this is noise, not a beat. */+const BEAT_FLOOR = 0.25;++/** Loop-seam thresholds: mean bone angle (rad) and root offset (metres). */+const SEAM_ANGLE_LIMIT = 0.2;+const SEAM_ROOT_LIMIT = 0.06;++/**+ * Share of motion that must survive an upper-body strip for a clip to still+ * read as itself when played as an overlay. AnimationManager._buildOverlayClip+ * drops every hips/leg/foot track before making the clip additive, so a clip+ * whose motion is mostly in the legs becomes a near no-op on the `upper` layer.+ */+const OVERLAY_UPPER_SHARE = 0.6;++/**+ * Net root displacement (metres) past which a one-shot visibly relocates the+ * avatar. Agent slots play full-body through AnimationManager.play(), root+ * track included, so a clip that ends 30 cm from where it started slides the+ * avatar sideways and snaps back when it crossfades out.+ */+const ANCHOR_TRAVEL = 0.08;++/** Resample grid rate. Every clip in the library is baked at 30fps. */+const GRID_FPS = 30;+const MAX_GRID = 4096;++/**+ * Map a canonical bone name to a region, or null for bones that are excluded.+ *+ * Finger bones are deliberately excluded. Only some clips carry finger tracks+ * (51 vs 156 tracks across the library), so counting them would make two clips+ * with identical body motion score differently purely on export settings.+ *+ * @param {string} bone+ * @returns {string|null}+ */+export function regionOf(bone) {+ if (bone === 'Hips') return 'root';+ if (bone === 'Neck' || bone === 'Head') return 'head';+ if (/^Spine\d*$/.test(bone)) return 'torso';+ if (/^(Left|Right)(Shoulder|Arm|ForeArm|Hand)$/.test(bone)) return 'arms';+ if (/^(Left|Right)(UpLeg|Leg|Foot|ToeBase)$/.test(bone)) return 'legs';+ return null;+}++/** Which side of the body a bone is on, for the balance measure. */+function sideOf(bone) {+ if (bone.startsWith('Left')) return 'left';+ if (bone.startsWith('Right')) return 'right';+ return null;+}++/**+ * Visual mass of a bone: roughly how much of the silhouette its own rotation+ * moves. A shoulder rotation swings the whole arm; a wrist rotation swings a+ * hand. Without this, region shares answer "how many joints rotated" instead of+ * "where did the body move", and a wave reads as head-led because the two neck+ * bones out-average the one arm that is doing the work.+ *+ * Every clip in the library carries the full canonical bone set, so these+ * weights are comparable across clips without further normalisation.+ */+const BONE_MASS = {+ Hips: 3,+ Spine: 1.6,+ Spine1: 1.3,+ Spine2: 1,+ Neck: 0.5,+ Head: 1,+ Shoulder: 0.8,+ Arm: 1.2,+ ForeArm: 0.8,+ Hand: 0.4,+ UpLeg: 1.4,+ Leg: 1,+ Foot: 0.5,+ ToeBase: 0.2,+};++/** Mass of a canonical bone, side prefix stripped. */+function massOf(bone) {+ return BONE_MASS[bone.replace(/^(Left|Right)/, '')] ?? 1;+}++const round = (n, dp = 3) => {+ const f = 10 ** dp;+ return Math.round(n * f) / f;+};++/** Shortest-arc angle between two unit quaternions, in radians. */+function quatAngle(v, a, b) {+ const dot = v[a] * v[b] + v[a + 1] * v[b + 1] + v[a + 2] * v[b + 2] + v[a + 3] * v[b + 3];+ return 2 * Math.acos(Math.min(1, Math.abs(dot)));+}++/**+ * Spread a segment's rotation angle across a uniform time grid.+ * Segments are proportioned by overlap, so a clip sampled off-grid still lands+ * its energy in the right bins instead of being snapped to the nearest one.+ */+function accumulate(grid, gridDt, t0, t1, angle) {+ const span = t1 - t0;+ if (!(span > 0)) return;+ const first = Math.max(0, Math.floor(t0 / gridDt));+ const last = Math.min(grid.length - 1, Math.floor((t1 - 1e-9) / gridDt));+ for (let i = first; i <= last; i++) {+ const lo = Math.max(t0, i * gridDt);+ const hi = Math.min(t1, (i + 1) * gridDt);+ if (hi > lo) grid[i] += angle * ((hi - lo) / span);+ }+}++/** Three-tap moving average. Frame-to-frame jitter autocorrelates; a beat does not need it. */+function smooth(signal) {+ const n = signal.length;+ const out = new Float64Array(n);+ for (let i = 0; i < n; i++) {+ const a = signal[Math.max(0, i - 1)];+ const b = signal[i];+ const c = signal[Math.min(n - 1, i + 1)];+ out[i] = (a + 2 * b + c) / 4;+ }+ return out;+}++/**+ * Find the clip's beat by autocorrelating its motion-energy envelope.+ *+ * Only local maxima count. Autocorrelation decays with lag, so taking the+ * largest value in the window always returns the shortest lag searched, which+ * is how a nod ends up reported at 257 BPM. A real periodic motion puts a peak+ * at its period with troughs either side; that is what this looks for.+ *+ * @returns {{period:number|null, strength:number}} period in seconds+ */+function findBeat(signal, dt, duration) {+ const n = signal.length;+ const maxLagS = Math.min(MAX_BEAT_PERIOD, duration / 2);+ if (n < 12 || maxLagS <= MIN_BEAT_PERIOD) return { period: null, strength: 0 };++ const env = smooth(signal);+ let mean = 0;+ for (let i = 0; i < n; i++) mean += env[i];+ mean /= n;++ const dev = new Float64Array(n);+ let energy = 0;+ for (let i = 0; i < n; i++) {+ dev[i] = env[i] - mean;+ energy += dev[i] * dev[i];+ }+ if (energy <= 0) return { period: null, strength: 0 };++ const minLag = Math.max(2, Math.round(MIN_BEAT_PERIOD / dt));+ const maxLag = Math.min(n - 2, Math.round(maxLagS / dt));+ if (maxLag <= minLag + 1) return { period: null, strength: 0 };++ // Normalised autocorrelation across the whole window, then peak-pick on it.+ const acf = new Float64Array(maxLag + 2);+ for (let lag = minLag - 1; lag <= maxLag + 1 && lag < n - 1; lag++) {+ let sum = 0;+ for (let i = 0; i + lag < n; i++) sum += dev[i] * dev[i + lag];+ acf[lag] = (sum / (n - lag)) / (energy / n);+ }++ let bestLag = 0;+ let best = 0;+ for (let lag = minLag; lag <= maxLag; lag++) {+ if (acf[lag] <= acf[lag - 1] || acf[lag] < acf[lag + 1]) continue;+ if (acf[lag] > best) {+ best = acf[lag];+ bestLag = lag;+ }+ }+ if (bestLag === 0 || best < BEAT_FLOOR) {+ return { period: null, strength: round(Math.max(0, best)) };+ }+ return { period: bestLag * dt, strength: round(Math.min(1, best)) };+}++/**+ * Measure one baked clip.+ *+ * @param {{name:string, duration:number, tracks:Array}} clip — the parsed+ * contents of public/animations/clips/<name>.json+ * @returns {object} signature (see the README table in docs/animations.md)+ */+export function analyzeClip(clip) {+ const name = String(clip?.name || '');+ const duration = Number(clip?.duration) || 0;+ const tracks = Array.isArray(clip?.tracks) ? clip.tracks : [];++ const gridN = Math.min(MAX_GRID, Math.max(2, Math.round(duration * GRID_FPS)));+ const gridDt = duration > 0 ? duration / gridN : 1;+ const grid = new Float64Array(gridN);++ const regionSum = { head: 0, arms: 0, torso: 0, root: 0, legs: 0 };+ const sideSum = { left: 0, right: 0 };+ let seamAngle = 0;+ let seamBones = 0;+ let totalAngle = 0;+ let boneCount = 0;+ let frames = 0;++ for (const track of tracks) {+ const [bone, prop] = String(track?.name || '').split('.');+ if (prop !== 'quaternion') continue;+ const region = regionOf(bone);+ if (!region) continue;+ const times = track.times;+ const values = track.values;+ if (!times?.length || !values?.length) continue;+ frames = Math.max(frames, times.length);++ let sum = 0;+ for (let i = 0; i < times.length - 1; i++) {+ const angle = quatAngle(values, i * 4, (i + 1) * 4);+ sum += angle;+ accumulate(grid, gridDt, times[i], times[i + 1], angle);+ }++ const perSecond = duration > 0 ? sum / duration : 0;+ const mass = massOf(bone);+ regionSum[region] += mass * perSecond;+ totalAngle += sum;+ boneCount += 1;++ const side = sideOf(bone);+ if (side) sideSum[side] += mass * perSecond;++ seamAngle += quatAngle(values, 0, (times.length - 1) * 4);+ seamBones += 1;+ }++ const meanSpeed = boneCount > 0 && duration > 0 ? totalAngle / boneCount / duration : 0;++ // Mass-weighted shares: what fraction of the body's visible movement each+ // region accounts for.+ let regionTotal = 0;+ for (const r of REGIONS) regionTotal += regionSum[r];+ const regions = {};+ for (const r of REGIONS) regions[r] = round(regionTotal > 0 ? regionSum[r] / regionTotal : 0);++ // Root translation. Hips.position is in metres on the canonical rig.+ let travel = 0;+ let path = 0;+ let rise = 0;+ const hips = tracks.find((t) => t?.name === 'Hips.position');+ if (hips?.values?.length >= 3) {+ const v = hips.values;+ const n = Math.floor(v.length / 3);+ let yMin = Infinity;+ let yMax = -Infinity;+ for (let i = 0; i < n; i++) {+ const y = v[i * 3 + 1];+ if (y < yMin) yMin = y;+ if (y > yMax) yMax = y;+ if (i > 0) path += Math.hypot(v[i * 3] - v[(i - 1) * 3], v[i * 3 + 2] - v[(i - 1) * 3 + 2]);+ }+ travel = Math.hypot(v[(n - 1) * 3] - v[0], v[(n - 1) * 3 + 2] - v[2]);+ rise = yMax - yMin;+ }++ const speedSignal = new Float64Array(gridN);+ for (let i = 0; i < gridN; i++) speedSignal[i] = grid[i] / gridDt;+ const beat = findBeat(speedSignal, gridDt, duration);++ const seam = seamBones > 0 ? seamAngle / seamBones : 0;+ const seamRoot = hips?.values?.length >= 3+ ? (() => {+ const v = hips.values;+ const n = Math.floor(v.length / 3);+ return Math.hypot(v[(n - 1) * 3] - v[0], v[(n - 1) * 3 + 1] - v[1], v[(n - 1) * 3 + 2] - v[2]);+ })()+ : 0;++ const balance = sideSum.left + sideSum.right > 0+ ? 1 - Math.abs(sideSum.left - sideSum.right) / (sideSum.left + sideSum.right)+ : 1;++ const isStatic = frames < MIN_ANIMATED_FRAMES || meanSpeed < STATIC_SPEED;+ const upperShare = round(regions.head + regions.arms + regions.torso);++ return {+ clip: name,+ duration: round(duration, 2),+ frames,+ energy: round(1 - Math.exp(-meanSpeed / ENERGY_SCALE)),+ speed: round(meanSpeed),+ regions,+ lead: leadRegion(regions),+ upperShare,+ balance: round(balance),+ travel: round(travel),+ path: round(path),+ rise: round(rise),+ tempo: beat.period ? Math.round(60 / beat.period) : 0,+ beat: beat.strength,+ seam: round(seam),+ seamRoot: round(seamRoot),+ loopClean: !isStatic && seam < SEAM_ANGLE_LIMIT && seamRoot < SEAM_ROOT_LIMIT,+ anchored: travel < ANCHOR_TRAVEL,+ overlay: !isStatic && upperShare >= OVERLAY_UPPER_SHARE,+ static: isStatic,+ };+}++/** The region carrying the most motion. */+export function leadRegion(regions) {+ let best = REGIONS[0];+ for (const r of REGIONS) if ((regions[r] || 0) > (regions[best] || 0)) best = r;+ return best;+}++/**+ * Distance between two signatures in the descriptor space, 0 (identical) to 1.+ * Region shares dominate because "where the motion is" is what people mean by+ * "a clip like this one"; energy and tempo refine the ordering inside a family.+ */+export function distance(a, b) {+ if (!a || !b) return 1;+ let regionDelta = 0;+ for (const r of REGIONS) regionDelta += Math.abs((a.regions?.[r] || 0) - (b.regions?.[r] || 0));+ // Region shares each sum to 1, so the L1 delta is at most 2.+ const regionTerm = regionDelta / 2;+ const energyTerm = Math.abs((a.energy || 0) - (b.energy || 0));+ const tempoTerm = a.tempo && b.tempo+ ? Math.min(1, Math.abs(a.tempo - b.tempo) / 120)+ : (a.tempo || b.tempo ? 0.5 : 0);+ const travelTerm = Math.min(1, Math.abs((a.path || 0) - (b.path || 0)) / 2);+ return round(Math.min(1, 0.55 * regionTerm + 0.25 * energyTerm + 0.12 * tempoTerm + 0.08 * travelTerm));+}++/** Rank an index of signatures by closeness to one clip. */+export function similarTo(clipName, index, limit = 6) {+ const target = index?.[clipName];+ if (!target) return [];+ return Object.values(index)+ .filter((s) => s.clip !== clipName)+ .map((s) => ({ clip: s.clip, distance: distance(target, s), signature: s }))+ .sort((a, b) => a.distance - b.distance)+ .slice(0, limit);+}++/** Plain-language energy band, so the UI and the docs use the same words. */+export function energyBand(sig) {+ if (!sig || sig.static) return 'still';+ if (sig.energy < 0.15) return 'calm';+ if (sig.energy < 0.4) return 'gentle';+ if (sig.energy < 0.65) return 'lively';+ return 'explosive';+}++/**+ * One sentence describing a signature, for card subtitles and screen readers.+ * @param {object} sig+ * @returns {string}+ */+export function describe(sig) {+ if (!sig) return '';+ if (sig.static) return 'A single held pose. Nothing moves.';+ const parts = [`${energyBand(sig)} motion led by the ${REGION_LABELS[sig.lead].toLowerCase()}`];+ if (sig.tempo) parts.push(`on a ${sig.tempo} BPM beat`);+ if (!sig.anchored) parts.push(`ending ${sig.travel.toFixed(2)} m from where it started`);+ else parts.push('anchored on the spot');+ if (sig.overlay) parts.push('readable as an upper-body overlay');+ if (!sig.loopClean) parts.push('with a visible seam if looped');+ return `${parts.join(', ')}.`;+}++/**+ * Slots the walk state machine plays on its `upper` layer, where+ * AnimationManager._buildOverlayClip strips every hips/leg/foot track before+ * blending. tests/motion-signature.test.js holds this list to the real GESTURES+ * table in src/animation-state-machine.js.+ */+export const DEFAULT_OVERLAY_SLOTS = ['wave', 'nod', 'shake', 'point', 'shrug', 'sign'];++/** Slots that run as a continuous loop rather than a one-shot. */+export const DEFAULT_LOOP_SLOTS = ['idle', 'fidget', 'patience'];++/**+ * Whether a clip can actually do the job a slot is for.+ *+ * Three failure modes, each measured rather than guessed:+ *+ * 1. A held pose in an animated slot freezes the avatar (four clips in the+ * library are single-frame exports).+ * 2. A leg-led clip in an overlay slot nearly vanishes, because the overlay+ * path strips the lower body before blending.+ * 3. A clip whose root ends away from where it began slides the avatar across+ * the floor and snaps it back on crossfade out. Agent slots play full-body+ * through AnimationManager.play(), root track included, so this is visible+ * on every agent page.+ *+ * @param {string} slot+ * @param {object} sig+ * @param {{overlaySlots?: string[], loopSlots?: string[]}} [rules]+ * @returns {{level:'ok'|'warn', message:string}|null} null when nothing to say+ */+export function slotFit(slot, sig, rules = {}) {+ if (!sig) return null;+ const overlaySlots = rules.overlaySlots || DEFAULT_OVERLAY_SLOTS;+ const loopSlots = rules.loopSlots || DEFAULT_LOOP_SLOTS;++ if (sig.static) {+ return {+ level: 'warn',+ message: 'This clip is a single held pose, so the slot would freeze instead of animating.',+ };+ }+ if (overlaySlots.includes(slot) && !sig.overlay) {+ return {+ level: 'warn',+ message: `On /walk, ${slot} plays as an upper-body overlay with the hips and legs stripped out, and ${Math.round((1 - sig.upperShare) * 100)}% of this clip's motion is below the waist. Most of it would not survive the strip.`,+ };+ }+ if (loopSlots.includes(slot) && !sig.loopClean) {+ return {+ level: 'warn',+ message: `${slot} loops continuously, and this clip's last frame does not meet its first. Expect a visible snap every cycle.`,+ };+ }+ if (!sig.anchored) {+ return {+ level: 'warn',+ message: `This clip ends ${sig.travel.toFixed(2)} m from where it started, so the avatar slides that far and snaps back when the gesture finishes.`,+ };+ }+ return { level: 'ok', message: describe(sig) };+}diff --git a/src/sign-api-console.js b/src/sign-api-console.jsnew file mode 100644index 000000000..92e45a457--- /dev/null+++ b/src/sign-api-console.js@@ -0,0 +1,386 @@+// The Sign API console: /api/sign, made watchable.+//+// An API that returns an animation is hard to believe from a JSON blob. This+// console calls the real endpoint (no fixtures, no local compile) and draws what+// came back as the thing it actually is: a performance on a timeline. Every word+// is a block sized by the seconds it occupies, signed blocks and fingerspelled+// blocks read differently, a spelled block shows its letters, and pressing play+// sweeps a playhead across it in lockstep with the avatar at the top of the page+// signing the same text.+//+// So the page teaches the endpoint twice over: developers see the request, the+// response and the copyable curl; everyone else sees why the response is shaped+// the way it is.++import { log } from './shared/log.js';++const $ = (sel, root = document) => root.querySelector(sel);++const SPEEDS = [+ { label: '0.5×', value: 0.5 },+ { label: '0.75×', value: 0.75 },+ { label: '1×', value: 1 },+];++const HANDS = [+ { label: 'Right', value: 'right' },+ { label: 'Left', value: 'left' },+];++// Phrases that each demonstrate something different about the compiler: pure+// vocabulary, a name that can only be spelled, digits, and a mix of both.+const EXAMPLES = ['happy to meet you', 'thank you yall', 'my name is ada', 'three ws is good'];++function el(tag, className, text) {+ const node = document.createElement(tag);+ if (className) node.className = className;+ if (text != null) node.textContent = text;+ return node;+}++const fmt = (n) => `${n.toFixed(2)}s`;++/** Bytes as the unit a developer reads at a glance. */+function humanBytes(bytes) {+ if (bytes < 1024) return `${bytes} B`;+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} kB`;+ return `${(bytes / 1024 / 1024).toFixed(2)} MB`;+}++function curlFor({ text, hand, speed }) {+ const params = new URLSearchParams({ text });+ if (hand === 'left') params.set('hand', 'left');+ if (speed !== 1) params.set('speed', String(speed));+ return `curl -s "https://three.ws/api/sign?${params}" | jq '.timeline'`;+}++/**+ * Mount the console into `#sl-api-console`.+ *+ * @param {{+ * sign?: (opts: { text: string, hand: string, speed: number }) => Promise<unknown>,+ * defaults?: { hand?: string, speed?: number },+ * }} [wiring]+ * `sign` performs the same utterance on the page's hero avatar, applying the+ * console's hand and speed to it. Without it the console still works: it just+ * loses the play-along, and says so instead of offering a dead button.+ */+export function initSignApiConsole({ sign = null, defaults = {} } = {}) {+ const host = $('#sl-api-console');+ if (!host) return null;++ let hand = defaults.hand === 'left' ? 'left' : 'right';+ let speed = SPEEDS.some((s) => s.value === defaults.speed) ? defaults.speed : 1;+ let last = null;+ let playFrame = 0;++ // ── controls ─────────────────────────────────────────────────────────────+ const form = el('form', 'sl-api-form');+ form.setAttribute('novalidate', '');+ const input = el('input', 'sl-input');+ input.type = 'text';+ input.id = 'sl-api-text';+ input.value = EXAMPLES[0];+ input.maxLength = 600;+ input.setAttribute('aria-label', 'Text to compile into a signed utterance');+ input.placeholder = 'text to sign';+ const submit = el('button', 'sl-btn', 'Compile');+ submit.type = 'submit';++ const row = el('div', 'sl-input-row');+ row.append(input, submit);++ const pills = (label, options, current, onPick) => {+ const wrap = el('div', 'sl-setting');+ const id = `sl-api-${label.toLowerCase().replace(/\s+/g, '-')}`;+ const caption = el('span', 'sl-setting-label', label);+ caption.id = id;+ const group = el('div', 'sl-opts');+ group.role = 'group';+ group.setAttribute('aria-labelledby', id);+ for (const option of options) {+ const btn = el('button', 'sl-opt', option.label);+ btn.type = 'button';+ btn.setAttribute('aria-pressed', String(option.value === current));+ btn.addEventListener('click', () => {+ group.querySelectorAll('.sl-opt').forEach((b) => b.setAttribute('aria-pressed', 'false'));+ btn.setAttribute('aria-pressed', 'true');+ onPick(option.value);+ });+ group.append(btn);+ }+ wrap.append(caption, group);+ return wrap;+ };++ const settings = el('div', 'sl-settings');+ settings.append(+ pills('Hand', HANDS, hand, (v) => {+ hand = v;+ }),+ pills('Speed', SPEEDS, speed, (v) => {+ speed = v;+ }),+ );++ const examples = el('div', 'sl-chips');+ for (const phrase of EXAMPLES) {+ const chip = el('button', 'sl-phrase-chip', phrase);+ chip.type = 'button';+ chip.addEventListener('click', () => {+ input.value = phrase;+ run();+ });+ examples.append(chip);+ }++ form.append(row, settings, examples);++ // ── output ───────────────────────────────────────────────────────────────+ const out = el('div', 'sl-api-out');+ out.dataset.state = 'idle';++ const statsRow = el('dl', 'sl-api-stats');+ const timelineWrap = el('div', 'sl-api-timeline-wrap');+ const timeline = el('div', 'sl-api-timeline');+ timeline.role = 'list';+ timeline.setAttribute('aria-label', 'The compiled utterance, word by word');+ const playhead = el('div', 'sl-api-playhead');+ playhead.hidden = true;+ const ruler = el('div', 'sl-api-ruler');+ timelineWrap.append(timeline, playhead, ruler);++ const actions = el('div', 'sl-api-actions');+ const playBtn = el('button', 'sl-btn sl-btn-quiet', '▶ Play it on the avatar');+ playBtn.type = 'button';+ const copyBtn = el('button', 'sl-btn sl-btn-quiet', 'Copy curl');+ copyBtn.type = 'button';+ const openBtn = el('a', 'sl-btn sl-btn-quiet', 'Open raw JSON');+ openBtn.target = '_blank';+ openBtn.rel = 'noopener';+ actions.append(playBtn, copyBtn, openBtn);++ const note = el('p', 'sl-api-note');+ note.setAttribute('aria-live', 'polite');++ const codeWrap = el('details', 'sl-api-code');+ const codeSummary = el('summary', null, 'Request and response');+ const codeBody = el('div', 'sl-api-code-body');+ codeWrap.append(codeSummary, codeBody);++ out.append(statsRow, timelineWrap, actions, note, codeWrap);+ host.append(form, out);++ if (!sign) {+ playBtn.remove();+ }++ // ── rendering ────────────────────────────────────────────────────────────+ function renderStats(data, meta) {+ statsRow.replaceChildren();+ const stats = [+ ['Duration', `${data.duration.toFixed(2)}s`],+ ['Signed', String(data.signed.length)],+ ['Fingerspelled', String(data.spelled.length)],+ ['Clip tracks', String(data.clip?.tracks?.length ?? 0)],+ ['Response', humanBytes(meta.bytes)],+ ['Round trip', `${Math.round(meta.ms)} ms`],+ ];+ for (const [term, value] of stats) {+ const box = el('div', 'sl-api-stat');+ box.append(el('dt', null, term), el('dd', null, value));+ statsRow.append(box);+ }+ }++ function renderTimeline(data) {+ timeline.replaceChildren();+ const total = data.duration || 1;+ for (const seg of data.timeline) {+ const span = Math.max(seg.end - seg.start, 0.001);+ const block = el('button', 'sl-api-seg');+ block.type = 'button';+ block.role = 'listitem';+ block.style.flexGrow = String(span);+ block.dataset.kind = seg.signed ? 'signed' : 'spelled';+ block.dataset.start = String(seg.start);+ block.dataset.end = String(seg.end);+ block.setAttribute(+ 'aria-label',+ seg.signed+ ? `${seg.word}, signed, ${fmt(seg.start)} to ${fmt(seg.end)}. ${seg.gloss}`+ : `${seg.word}, fingerspelled ${seg.letters?.map((l) => l.letter).join('-') ?? ''}, ${fmt(seg.start)} to ${fmt(seg.end)}.`,+ );+ block.title = seg.signed ? seg.gloss : `Fingerspelled: ${seg.word.split('').join('-')}`;++ const label = el('span', 'sl-api-seg-word', seg.word.toLowerCase());+ block.append(label);++ if (seg.letters?.length) {+ const letters = el('span', 'sl-api-seg-letters');+ for (const letter of seg.letters) {+ const cell = el('span', 'sl-api-letter', letter.letter);+ cell.style.flexGrow = String(Math.max(letter.end - letter.start, 0.001));+ cell.dataset.start = String(letter.start);+ cell.dataset.end = String(letter.end);+ letters.append(cell);+ }+ block.append(letters);+ }++ // Clicking one word plays just that word, which is how anyone actually+ // checks whether a single sign looks right.+ block.addEventListener('click', () => {+ input.value = seg.word.toLowerCase();+ run();+ });+ timeline.append(block);+ }++ // A tick per second, so the block widths read as real time.+ ruler.replaceChildren();+ for (let s = 0; s <= Math.floor(total); s++) {+ const tick = el('span', 'sl-api-tick', `${s}s`);+ tick.style.left = `${(s / total) * 100}%`;+ ruler.append(tick);+ }+ }++ function renderCode(url, data, meta) {+ codeBody.replaceChildren();+ const req = el('pre', 'sl-api-pre');+ req.append(el('code', null, `GET ${url}\n\n${curlFor(meta.params)}`));+ // The clip is tens of thousands of numbers; show its shape, not its bytes.+ const preview = {+ ...data,+ clip: data.clip+ ? {+ name: data.clip.name,+ duration: data.clip.duration,+ blendMode: data.clip.blendMode,+ tracks: `[${data.clip.tracks.length} bone tracks omitted here — ${humanBytes(meta.bytes)} over the wire]`,+ }+ : undefined,+ };+ const res = el('pre', 'sl-api-pre');+ res.append(el('code', null, JSON.stringify(preview, null, 2)));+ codeBody.append(el('h4', 'sl-api-code-h', 'Request'), req, el('h4', 'sl-api-code-h', 'Response'), res);+ }++ function clearPlayhead() {+ cancelAnimationFrame(playFrame);+ playFrame = 0;+ playhead.hidden = true;+ timeline.querySelectorAll('[data-active]').forEach((n) => delete n.dataset.active);+ }++ /** Sweep the playhead across the timeline for `duration` seconds. */+ function startPlayhead(duration) {+ clearPlayhead();+ playhead.hidden = false;+ const startedAt = performance.now();+ const step = () => {+ const t = (performance.now() - startedAt) / 1000;+ if (t >= duration) {+ clearPlayhead();+ return;+ }+ playhead.style.left = `${Math.min(100, (t / duration) * 100)}%`;+ for (const node of timeline.querySelectorAll('.sl-api-seg, .sl-api-letter')) {+ const on = t >= Number(node.dataset.start) && t < Number(node.dataset.end);+ if (on) node.dataset.active = '';+ else delete node.dataset.active;+ }+ playFrame = requestAnimationFrame(step);+ };+ playFrame = requestAnimationFrame(step);+ }++ // ── the request ──────────────────────────────────────────────────────────+ async function run() {+ const text = input.value.trim();+ if (!text) {+ out.dataset.state = 'error';+ note.textContent = 'Type something to compile. Letters, digits and spaces are performed.';+ return;+ }+ clearPlayhead();+ out.dataset.state = 'loading';+ note.textContent = '';+ submit.disabled = true;++ const params = new URLSearchParams({ text });+ if (hand === 'left') params.set('hand', 'left');+ if (speed !== 1) params.set('speed', String(speed));+ const url = `/api/sign?${params}`;++ const started = performance.now();+ try {+ const res = await fetch(url, { headers: { accept: 'application/json' } });+ const raw = await res.text();+ const ms = performance.now() - started;+ let data;+ try {+ data = JSON.parse(raw);+ } catch {+ throw new Error(`the endpoint returned ${res.status} with a non-JSON body`);+ }+ if (!res.ok) {+ throw new Error(data.message || data.error || `HTTP ${res.status}`);+ }+ last = { data, meta: { ms, bytes: new Blob([raw]).size, params: { text, hand, speed } }, url };+ renderStats(data, last.meta);+ renderTimeline(data);+ renderCode(url, data, last.meta);+ openBtn.href = url;+ out.dataset.state = 'ready';+ note.textContent = data.truncated+ ? `Truncated at ${data.duration.toFixed(1)}s to stay watchable. Raise max_seconds, or split the text.`+ : `${data.signed.length} signed, ${data.spelled.length} fingerspelled. Click any word to compile it on its own.`;+ } catch (err) {+ log.warn('[sign-api-console] request failed', err?.message);+ out.dataset.state = 'error';+ note.textContent = `${err.message}. The endpoint is public and needs no key, so this is usually a network problem: try again.`;+ } finally {+ submit.disabled = false;+ }+ }++ form.addEventListener('submit', (e) => {+ e.preventDefault();+ run();+ });++ playBtn.addEventListener('click', async () => {+ if (!last || !sign) return;+ playBtn.disabled = true;+ startPlayhead(last.data.duration);+ try {+ await sign({ text: last.data.text, hand, speed });+ } catch (err) {+ note.textContent = `Could not play that on the avatar: ${err?.message || 'the stage is not ready'}.`;+ } finally {+ clearPlayhead();+ playBtn.disabled = false;+ }+ });++ copyBtn.addEventListener('click', async () => {+ if (!last) return;+ try {+ await navigator.clipboard.writeText(curlFor(last.meta.params));+ copyBtn.textContent = 'Copied';+ setTimeout(() => {+ copyBtn.textContent = 'Copy curl';+ }, 1600);+ } catch {+ note.textContent = 'Clipboard blocked by the browser: the curl is in the Request panel below.';+ }+ });++ // Compile the first example immediately: an empty console teaches nothing,+ // and this is one cached GET.+ run();++ return { run, element: host };+}diff --git a/src/sign-grader.js b/src/sign-grader.jsnew file mode 100644index 000000000..c356c422a--- /dev/null+++ b/src/sign-grader.js@@ -0,0 +1,315 @@+// The handshape grader: score a hand a camera sees against the handshape the+// avatar is wearing, and say which finger is wrong.+//+// The trick is that nothing here describes a letter. The target is measured,+// not written down: `sign-hand-model.js` poses the canonical rig with the SAME+// handshape spec the avatar uses and hands back 21 landmark points, and this+// file runs one measurement function over both that reference hand and the+// hand in front of the camera. Grading is then a comparison of two vectors in+// identical units.+//+// Consequences worth knowing:+// * Retuning a letter in HANDSHAPES retunes the grader. There is no second+// table to keep in sync, and no way for the two to disagree.+// * Every measurement is an angle or a ratio of the hand's own size, so the+// score is invariant to where the hand is, how big it is, how far from the+// lens, and which way it is rotated.+// * Left and right hands measure the same, because mirroring a hand does not+// change any joint angle or any fingertip distance.+//+// Nothing in this file touches the network or the DOM: give it 21 points and it+// returns a number and a sentence.++import { HAND_DIGITS, HAND_LANDMARKS, handScale, handshapeLandmarks } from './sign-hand-model.js';++const DEG = 180 / Math.PI;+const FINGER_NAMES = ['Index', 'Middle', 'Ring', 'Pinky'];+const SPREAD_PAIRS = [['Index', 'Middle'], ['Middle', 'Ring'], ['Ring', 'Pinky']];++const sub = (a, b) => [a[0] - b[0], a[1] - b[1], (a[2] ?? 0) - (b[2] ?? 0)];+const len = (v) => Math.hypot(v[0], v[1], v[2]);+const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];+const clamp = (n, lo, hi) => (n < lo ? lo : n > hi ? hi : n);++/** Angle in degrees between two vectors, 0 when parallel. */+function angleBetween(a, b) {+ const la = len(a), lb = len(b);+ if (la < 1e-9 || lb < 1e-9) return 0;+ return Math.acos(clamp(dot(a, b) / (la * lb), -1, 1)) * DEG;+}++/** Bend at `b` on the chain a → b → c. 0 is a straight line. */+function bend(a, b, c) {+ return angleBetween(sub(b, a), sub(c, b));+}++/** A landmark array, tolerating `{x, y, z}` objects as MediaPipe returns them. */+function toPoints(landmarks) {+ if (!Array.isArray(landmarks) || landmarks.length < 21) {+ throw new Error(`a hand needs 21 landmarks, got ${Array.isArray(landmarks) ? landmarks.length : typeof landmarks}`);+ }+ return landmarks.map((p) => (Array.isArray(p) ? [p[0], p[1], p[2] ?? 0] : [p.x, p.y, p.z ?? 0]));+}++/**+ * Measure a hand. Every field is either degrees or a multiple of the hand's own+ * palm length, so two hands of any size and pose are directly comparable.+ *+ * @param {number[][]|{x:number,y:number,z?:number}[]} landmarks 21 points+ * @returns {{+ * curl: Record<string, number>,+ * spread: Record<string, number>,+ * thumbCurl: number,+ * thumbSpread: number,+ * pinch: Record<string, number>,+ * scale: number,+ * }}+ */+export function handMetrics(landmarks) {+ const p = toPoints(landmarks);+ const wrist = p[HAND_LANDMARKS.WRIST];+ const scale = handScale(p);++ const curl = {};+ const dir = {};+ const tip = {};+ for (const { name, points: [mcpI, pipI, dipI, tipI] } of HAND_DIGITS) {+ if (name === 'Thumb') continue;+ // Knuckle bend measures against the palm, so a finger folded at the+ // knuckle reads as curled even when its phalanges stay straight.+ curl[name] = bend(wrist, p[mcpI], p[pipI]) + bend(p[mcpI], p[pipI], p[dipI]) + bend(p[pipI], p[dipI], p[tipI]);+ dir[name] = sub(p[tipI], p[mcpI]);+ tip[name] = p[tipI];+ }++ const spread = {};+ for (const [a, b] of SPREAD_PAIRS) spread[`${a}-${b}`] = angleBetween(dir[a], dir[b]);++ // Signed sideways offset between neighbouring fingertips, along the palm's+ // own radial axis. An angle alone cannot tell fingers apart from fingers+ // crossed: R and V both read as "14 degrees between them". The sign can, and+ // it survives mirroring, because flipping the hand flips both the axis and+ // the offset.+ const radial = sub(p[HAND_LANDMARKS.INDEX_MCP], p[HAND_LANDMARKS.PINKY_MCP]);+ const rl = len(radial) || 1;+ const lateral = {};+ for (const [a, b] of SPREAD_PAIRS) {+ lateral[`${a}-${b}`] = dot(sub(tip[a], tip[b]), radial) / (rl * scale);+ }++ const thumbCurl =+ bend(p[HAND_LANDMARKS.THUMB_CMC], p[HAND_LANDMARKS.THUMB_MCP], p[HAND_LANDMARKS.THUMB_IP]) ++ bend(p[HAND_LANDMARKS.THUMB_MCP], p[HAND_LANDMARKS.THUMB_IP], p[HAND_LANDMARKS.THUMB_TIP]);+ // Measured at the wrist against the middle knuckle: both are rigid palm+ // points, so this stays meaningful when every finger is closed.+ const thumbSpread = angleBetween(sub(p[HAND_LANDMARKS.THUMB_TIP], wrist), sub(p[HAND_LANDMARKS.MIDDLE_MCP], wrist));++ const pinch = {};+ for (const { name, points } of HAND_DIGITS) {+ if (name === 'Thumb') continue;+ pinch[name] = len(sub(p[points[3]], p[HAND_LANDMARKS.THUMB_TIP])) / scale;+ }++ return { curl, spread, lateral, thumbCurl, thumbSpread, pinch, scale };+}++// How far a measurement may drift before it scores zero. Wide enough that a+// human hand held with ordinary care scores well, tight enough that a different+// letter never does. Degrees, except `pinch`, which is palm lengths.+const TOLERANCE = Object.freeze({ curl: 62, spread: 30, lateral: 0.34, thumbCurl: 52, thumbSpread: 34, pinch: 0.55 });++// What each measurement is worth. The four finger curls carry the letter; the+// thumb decides between look-alikes (A vs S, M vs N); pinch distance is what+// separates the closed circles (F, O, 6-9) from the open shapes.+const WEIGHT = Object.freeze({ curl: 1, spread: 0.35, lateral: 0.55, thumbCurl: 0.6, thumbSpread: 0.85, pinch: 0.5 });++const match = (err, tol) => clamp(1 - err / tol, 0, 1);++const _targets = new Map();+/** Measured metrics of the perfectly formed handshape (cached per name). */+export function handshapeMetrics(name) {+ let m = _targets.get(name);+ if (!m) {+ m = handMetrics(handshapeLandmarks(name));+ _targets.set(name, m);+ }+ return m;+}++function fingerHint(finger, delta) {+ const part = finger.toLowerCase();+ if (delta > 0) return `Curl your ${part} finger in more.`;+ return `Straighten your ${part} finger.`;+}++/**+ * Grade a hand against a handshape.+ *+ * @param {number[][]|{x:number,y:number,z?:number}[]} landmarks 21 points from a hand landmarker+ * @param {string} name a HANDSHAPES key+ * @returns {{+ * score: number,+ * name: string,+ * fingers: {finger: string, score: number, observed: number, target: number, delta: number}[],+ * thumb: {score: number, curlDelta: number, spreadDelta: number},+ * hint: string,+ * metrics: ReturnType<typeof handMetrics>,+ * }}+ */+export function gradeHandshape(landmarks, name) {+ const observed = handMetrics(landmarks);+ const target = handshapeMetrics(name);++ let total = 0;+ let weighted = 0;+ /** @type {{key: string, weight: number, score: number, label: string, delta: number}[]} */+ const terms = [];+ const add = (key, err, tol, weight, label, delta) => {+ const s = match(err, tol);+ total += weight;+ weighted += weight * s;+ terms.push({ key, weight, score: s, label, delta });+ return s;+ };++ const fingers = FINGER_NAMES.map((finger) => {+ const delta = observed.curl[finger] - target.curl[finger];+ const s = add(`curl:${finger}`, Math.abs(delta), TOLERANCE.curl, WEIGHT.curl, fingerHint(finger, -delta), delta);+ return { finger, score: s, observed: observed.curl[finger], target: target.curl[finger], delta };+ });++ for (const [a, b] of SPREAD_PAIRS) {+ const key = `${a}-${b}`;+ const lower = `${a.toLowerCase()} and ${b.toLowerCase()} fingers`;+ const delta = observed.spread[key] - target.spread[key];+ add(+ `spread:${key}`,+ Math.abs(delta),+ TOLERANCE.spread,+ WEIGHT.spread,+ delta > 0 ? `Bring your ${lower} together.` : `Spread your ${lower} apart.`,+ delta,+ );+ const side = observed.lateral[key] - target.lateral[key];+ const crossed = target.lateral[key] < 0;+ add(+ `lateral:${key}`,+ Math.abs(side),+ TOLERANCE.lateral,+ WEIGHT.lateral,+ crossed ? `Cross your ${lower}: ${a.toLowerCase()} over ${b.toLowerCase()}.` : `Line your ${lower} up side by side.`,+ side,+ );+ }++ const curlDelta = observed.thumbCurl - target.thumbCurl;+ const thumbCurlScore = add(+ 'thumbCurl',+ Math.abs(curlDelta),+ TOLERANCE.thumbCurl,+ WEIGHT.thumbCurl,+ curlDelta > 0 ? 'Straighten your thumb.' : 'Bend your thumb.',+ curlDelta,+ );+ const spreadDelta = observed.thumbSpread - target.thumbSpread;+ const thumbSpreadScore = add(+ 'thumbSpread',+ Math.abs(spreadDelta),+ TOLERANCE.thumbSpread,+ WEIGHT.thumbSpread,+ spreadDelta > 0 ? 'Bring your thumb in toward your palm.' : 'Move your thumb further out from your palm.',+ spreadDelta,+ );++ for (const finger of FINGER_NAMES) {+ const delta = observed.pinch[finger] - target.pinch[finger];+ const label = delta > 0 ? `Touch your thumb to your ${finger.toLowerCase()} fingertip.` : `Move your thumb away from your ${finger.toLowerCase()} fingertip.`;+ add(`pinch:${finger}`, Math.abs(delta), TOLERANCE.pinch, WEIGHT.pinch, label, delta);+ }++ const score = total > 0 ? (weighted / total) * 100 : 0;+ // The hint is the single measurement costing the most points, so the advice+ // is always the one change that helps most.+ let worst = null;+ for (const t of terms) {+ const cost = t.weight * (1 - t.score);+ if (!worst || cost > worst.cost) worst = { ...t, cost };+ }+ const hint = score >= 88 ? 'That is the shape. Hold it.' : worst && worst.cost > 0.08 ? worst.label : 'Almost there: hold steady.';++ return {+ score,+ name,+ fingers,+ thumb: { score: (thumbCurlScore + thumbSpreadScore) / 2, curlDelta, spreadDelta },+ hint,+ metrics: observed,+ };+}++/**+ * Which handshape a hand looks most like. Used to tell a learner they have+ * formed a real letter, just not the one they were asked for, which is the+ * single most useful correction in the manual alphabet.+ *+ * @param {number[][]} landmarks+ * @param {string[]} candidates+ * @returns {{name: string, score: number}[]} best first+ */+export function rankHandshapes(landmarks, candidates) {+ return candidates+ .map((name) => ({ name, score: gradeHandshape(landmarks, name).score }))+ .sort((a, b) => b.score - a.score);+}++/**+ * Time smoothing for a live camera feed.+ *+ * A landmarker jitters frame to frame, and a raw score flickers enough to be+ * unreadable and to pass a letter the learner never actually held. This keeps+ * an exponential average and reports a hold only once the smoothed score has+ * stayed above the bar for a real stretch of time.+ */+export class GradeSmoother {+ /**+ * @param {{ alpha?: number, passScore?: number, holdMs?: number }} [opts]+ * `alpha` is the weight of each new frame (lower is smoother), `passScore`+ * the bar to clear, `holdMs` how long it must stay cleared.+ */+ constructor(opts = {}) {+ this.alpha = opts.alpha ?? 0.28;+ this.passScore = opts.passScore ?? 78;+ this.holdMs = opts.holdMs ?? 700;+ this.value = 0;+ this.since = 0;+ this.hint = '';+ this.seen = false;+ }++ /**+ * Feed one graded frame.+ * @param {{score: number, hint: string}} grade+ * @param {number} now a monotonic timestamp in ms+ * @returns {{score: number, hint: string, holding: boolean, heldMs: number, passed: boolean}}+ */+ push(grade, now) {+ this.value = this.seen ? this.value + (grade.score - this.value) * this.alpha : grade.score;+ this.seen = true;+ this.hint = grade.hint;+ const holding = this.value >= this.passScore;+ if (!holding) this.since = 0;+ else if (!this.since) this.since = now;+ const heldMs = holding ? now - this.since : 0;+ return { score: this.value, hint: this.hint, holding, heldMs, passed: heldMs >= this.holdMs };+ }++ /** Forget the current hold, e.g. after moving to the next letter. */+ reset() {+ this.value = 0;+ this.since = 0;+ this.seen = false;+ this.hint = '';+ }+}++export { TOLERANCE, WEIGHT };diff --git a/src/sign-hand-model.js b/src/sign-hand-model.jsnew file mode 100644index 000000000..33996ba85--- /dev/null+++ b/src/sign-hand-model.js@@ -0,0 +1,169 @@+// The reference hand: a handshape rendered as 21 landmark points, in the exact+// layout MediaPipe's hand landmarker returns.+//+// This is the hinge of the signing loop. `src/sign-handshapes.js` compiles a+// handshape (A, B, CLAW, FLAT_O ...) into local bone rotations, and the avatar+// wears them. Here we run those SAME rotations through the SAME canonical+// skeleton (`src/sign-rig.js`) and read the joint positions back out as a point+// cloud. The result is what a camera would see if a perfectly formed hand made+// that letter.+//+// One spec, three consumers:+// 1. the 3D avatar poses its fingers from it (sign-handshapes.js),+// 2. this file draws the target as a skeleton diagram (/sign-mirror),+// 3. the grader measures a webcam hand against it (sign-grader.js).+//+// Nothing here re-describes a letter. Change a curl in HANDSHAPES and the+// diagram and the grading target move with the avatar, automatically.++import { FINGERS, Pose, boneLength, fingerTip, vAdd, vScale, vSub } from './sign-rig.js';+import { applyHandshape } from './sign-handshapes.js';++/**+ * MediaPipe hand landmark order. Index into any 21-point hand array.+ * @see https://ai.google.dev/edge/mediapipe/solutions/vision/hand_landmarker+ */+export const HAND_LANDMARKS = Object.freeze({+ WRIST: 0,+ THUMB_CMC: 1,+ THUMB_MCP: 2,+ THUMB_IP: 3,+ THUMB_TIP: 4,+ INDEX_MCP: 5,+ INDEX_PIP: 6,+ INDEX_DIP: 7,+ INDEX_TIP: 8,+ MIDDLE_MCP: 9,+ MIDDLE_PIP: 10,+ MIDDLE_DIP: 11,+ MIDDLE_TIP: 12,+ RING_MCP: 13,+ RING_PIP: 14,+ RING_DIP: 15,+ RING_TIP: 16,+ PINKY_MCP: 17,+ PINKY_PIP: 18,+ PINKY_DIP: 19,+ PINKY_TIP: 20,+});++/** Every digit, in landmark order, with its four point indices. */+export const HAND_DIGITS = Object.freeze([+ { name: 'Thumb', points: [1, 2, 3, 4] },+ { name: 'Index', points: [5, 6, 7, 8] },+ { name: 'Middle', points: [9, 10, 11, 12] },+ { name: 'Ring', points: [13, 14, 15, 16] },+ { name: 'Pinky', points: [17, 18, 19, 20] },+]);++/** Bone pairs for drawing a hand skeleton. */+export const HAND_CONNECTIONS = Object.freeze([+ [0, 1], [1, 2], [2, 3], [3, 4],+ [0, 5], [5, 6], [6, 7], [7, 8],+ [5, 9], [9, 10], [10, 11], [11, 12],+ [9, 13], [13, 14], [14, 15], [15, 16],+ [13, 17], [17, 18], [18, 19], [19, 20],+ [0, 17],+]);++// The rig's finger bones are the three phalanges; the knuckle a camera sees is+// where the proximal phalanx starts, and the tip is past the distal one.+const JOINT_BONES = (side, finger) => [1, 2, 3].map((j) => `${side}Hand${finger}${j}`);++/**+ * Where the metacarpal knuckle sits for a digit. The rig starts each finger at+ * its proximal joint, which IS the knuckle a landmarker reports, so this is a+ * direct read rather than an estimate.+ */+function knucklePoint(pose, side, finger) {+ return pose.worldPos(`${side}Hand${finger}1`);+}++/**+ * The 21 landmark positions of `name` as worn by the canonical rig.+ *+ * Returned in model space (metres, the rig's own scale). Every metric the+ * grader takes is an angle or a ratio, so no alignment with the camera frame is+ * needed or wanted: the point cloud is compared by shape, not by placement.+ *+ * @param {string} name a HANDSHAPES key: 'A'-'Z', '0'-'9', 'CLAW', 'FLAT_O', ...+ * @param {'Left'|'Right'} [side]+ * @returns {number[][]} 21 `[x, y, z]` points in MediaPipe order+ */+export function handshapeLandmarks(name, side = 'Right') {+ const pose = new Pose();+ applyHandshape(pose, name, side);+ const wrist = pose.worldPos(`${side}Hand`);+ const points = [wrist];+ for (const { name: finger } of HAND_DIGITS) {+ const [b1, b2, b3] = JOINT_BONES(side, finger);+ points.push(knucklePoint(pose, side, finger), pose.worldPos(b2), pose.worldPos(b3), fingerTip(pose, side, finger));+ // b1 is read through knucklePoint; keeping the destructure explicit+ // documents which bone each landmark comes from.+ void b1;+ }+ return points;+}++/**+ * A finger's own length under a pose, used to normalise distances so a small+ * hand and a large one grade the same.+ */+export function handScale(points) {+ const wrist = points[HAND_LANDMARKS.WRIST];+ const mid = points[HAND_LANDMARKS.MIDDLE_MCP];+ const len = Math.hypot(mid[0] - wrist[0], mid[1] - wrist[1], (mid[2] ?? 0) - (wrist[2] ?? 0));+ return len > 1e-6 ? len : 1;+}++/**+ * Flatten a 3D hand onto a 2D box for drawing, keeping the aspect ratio and+ * viewing it palm-on. Used for the target diagram beside the camera preview.+ *+ * @param {number[][]} points 21 landmarks+ * @param {{ width?: number, height?: number, padding?: number, flip?: boolean }} [opts]+ * @returns {{ x: number, y: number }[]}+ */+export function projectHand(points, opts = {}) {+ const width = opts.width ?? 220;+ const height = opts.height ?? 260;+ const padding = opts.padding ?? 18;+ // The canonical rest hand points down the model's X axis with the palm on+ // the Y axis, so an XZ view looks straight into the palm.+ const flat = points.map((p) => [p[2] ?? 0, -p[0]]);+ let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;+ for (const [x, y] of flat) {+ if (x < minX) minX = x;+ if (x > maxX) maxX = x;+ if (y < minY) minY = y;+ if (y > maxY) maxY = y;+ }+ const spanX = Math.max(maxX - minX, 1e-6);+ const spanY = Math.max(maxY - minY, 1e-6);+ const scale = Math.min((width - padding * 2) / spanX, (height - padding * 2) / spanY);+ const offX = (width - spanX * scale) / 2;+ const offY = (height - spanY * scale) / 2;+ return flat.map(([x, y]) => {+ const px = (x - minX) * scale + offX;+ return { x: opts.flip ? width - px : px, y: (y - minY) * scale + offY };+ });+}++/** Fingertip world positions of a posed handshape, for callers that only need those. */+export function handshapeFingertips(name, side = 'Right') {+ const pose = new Pose();+ applyHandshape(pose, name, side);+ return Object.fromEntries([...FINGERS, 'Thumb'].map((f) => [f, fingerTip(pose, side, f)]));+}++/** Midpoint of the palm under a handshape, in the same space as the landmarks. */+export function palmCentre(points) {+ const ids = [HAND_LANDMARKS.WRIST, HAND_LANDMARKS.INDEX_MCP, HAND_LANDMARKS.PINKY_MCP];+ return vScale(ids.map((i) => points[i]).reduce(vAdd, [0, 0, 0]), 1 / ids.length);+}++/** Length of the rig's middle proximal phalanx: the unit the diagram scales by. */+export const REFERENCE_BONE = (side = 'Right') => boneLength(`${side}HandMiddle1`);++/** Vector helper re-export so page code does not reach into the rig directly. */+export { vSub };diff --git a/src/sign-handshapes.js b/src/sign-handshapes.jsindex 8d0040af4..23675bae6 100644--- a/src/sign-handshapes.js+++ b/src/sign-handshapes.js@@ -15,7 +15,22 @@// `FLAT_O`, `BENT_B`, `OPEN_8`), which the lexical signs need and the alphabet// never used.-import { FINGERS, FINGER_JOINTS, fingerBones, qAxisAngle, qMul, qNorm, vNorm } from './sign-rig.js';+import {+ FINGERS,+ FINGER_JOINTS,+ fingerBones,+ qAxisAngle,+ qConj,+ qMul,+ qNorm,+ qRotate,+ restDirWorld,+ restPalmWorld,+ restRadialWorld,+ restWorld,+ vCross,+ vNorm,+} from './sign-rig.js';// The skeleton's own structure lives in sign-rig.js; re-exported here so callers// that think in handshapes have one import.@@ -24,6 +39,46 @@ export { FINGERS, FINGER_JOINTS, fingerBones };// Per-joint shares of a full curl (proximal knuckles carry most of it).const CURL_WEIGHTS = [85, 100, 65];+/**+ * The four axes a handshape rotates about, derived from the rig instead of+ * written down.+ *+ * A handshape sets each finger bone's local rotation OUTRIGHT, so the axes act+ * in the parent's rest frame, not the bone's. Getting that frame wrong is+ * invisible in a screenshot and fatal in the geometry: the previous hardcoded+ * axes curled the fingers sideways across the palm rather than into it, and+ * applied splay about each finger's own length, which is a pure twist that+ * moves no fingertip at all (V collapsed onto U, W onto B).+ *+ * Reading them off `restPalmWorld` / `restRadialWorld` / `restDirWorld` costs+ * one rotation per side, is exact for both hands without a mirror term, and+ * follows the rig if the rest pose is ever re-measured.+ */+const HAND_AXES = new Map();+function handAxes(side) {+ let axes = HAND_AXES.get(side);+ if (axes) return axes;+ const toParent = (v) => vNorm(qRotate(qConj(restWorld(`${side}Hand`)), v));+ const palm = toParent(restPalmWorld(side));+ const radial = toParent(restRadialWorld(side));+ const finger = toParent(restDirWorld(`${side}HandIndex1`));+ const thumb = toParent(restDirWorld(`${side}HandThumb1`));+ axes = {+ // Rotating a bone about (direction x palm) swings its tip toward the palm.+ curl: vNorm(vCross(finger, palm)),+ // ... and about (direction x radial) toward the thumb side of the hand.+ splay: vNorm(vCross(finger, radial)),+ thumbCurl: vNorm(vCross(thumb, palm)),+ // The thumb swings across the palm about the palm's own normal.+ thumbAdduct: palm,+ };+ HAND_AXES.set(side, axes);+ return axes;+}++/** The axes a given side's handshapes rotate about, for tooling and tests. */+export const handshapeAxes = (side = 'Right') => ({ ...handAxes(side) });+// Thumb presets, as [joint1, joint2, joint3] rotations composed from curl// about the thumb hinge and swing toward/away from the palm. Tuned for the// right hand and mirrored for the left via axis sign.@@ -126,27 +181,27 @@ function fingerJointDegrees(spec) {export function handshapeLocals(name, side = 'Right') {const shape = HANDSHAPES[name];if (!shape) throw new Error(`no handshape for letter "${name}"`);- const s = side === 'Left' ? 1 : -1;- const curlAxis = [0, 0, -s]; // hinge toward the palm (palms-down rest)- const splayAxis = [0, 1, 0];+ const axes = handAxes(side);const locals = {};for (const finger of FINGERS) {const deg = fingerJointDegrees(shape.curl?.[finger] ?? 0);const splay = shape.splay?.[finger] ?? 0;for (let j = 0; j < 3; j++) {- let q = qAxisAngle(curlAxis, deg[j] + (j === 0 ? (shape.knuckle ?? 0) : 0));- if (j === 0 && splay) q = qMul(q, qAxisAngle(splayAxis, splay * -s));+ let q = qAxisAngle(axes.curl, deg[j] + (j === 0 ? (shape.knuckle ?? 0) : 0));+ // Abduction belongs to the knuckle and happens in the plane of the+ // palm, so it composes BEFORE the curl: a finger that is already+ // folded does not abduct along its folded direction.+ if (j === 0 && splay) q = qMul(qAxisAngle(axes.splay, splay), q);locals[`${side}Hand${finger}${j + 1}`] = qNorm(q);}}const preset = THUMB_PRESETS[shape.thumb ?? 'side'];- // Thumb rest points ~45° between the fingers and the palm-forward axis;- // adduction swings it about the palm normal (toward/away from the palm- // centre), curl bends its hinge toward the palm. Axes are side-mirrored.- const thumbHinge = vNorm([-s * 0.5, 0, -0.85]);+ // Adduction swings the thumb about the palm normal (positive lays it across+ // the palm, negative takes it out to the side); curl bends its hinge toward+ // the palm on top of that.for (let j = 0; j < 3; j++) {- let q = qAxisAngle(thumbHinge, preset.curl[j]);- if (j === 0) q = qMul(qAxisAngle([0, 1, 0], preset.adduct * -s), q);+ let q = qAxisAngle(axes.thumbCurl, preset.curl[j]);+ if (j === 0) q = qMul(qAxisAngle(axes.thumbAdduct, preset.adduct), q);locals[`${side}HandThumb${j + 1}`] = qNorm(q);}return locals;diff --git a/src/sign-language-page.js b/src/sign-language-page.jsindex 9db3719d8..ad801cb75 100644--- a/src/sign-language-page.js+++ b/src/sign-language-page.js@@ -9,9 +9,10 @@// (src/sign-speech.js) drives it exactly like a text-to-speech engine.import { PoseStage } from './avatar-pose.js';-import { CHAT_TIMING, SignSpeaker } from './sign-speech.js';+import { SignSpeaker, scaledTiming } from './sign-speech.js';import { normalizeWord } from './fingerspelling.js';import { SIGNS, signGloss, signLookup } from './sign-dictionary.js';+import { initSignApiConsole } from './sign-api-console.js';import { log } from './shared/log.js';// Two hero rigs, because signing has two halves and no one avatar shows both@@ -58,13 +59,6 @@ const DEMO_PHRASES = ['HELLO', 'HAPPY TO MEET YOU', 'WELCOME TO THREE WS', 'THANconst $ = (sel, root = document) => root.querySelector(sel);-/** Stretch every duration in the chat timing so the whole utterance slows. */-function scaleTiming(rate) {- const out = {};- for (const [key, value] of Object.entries(CHAT_TIMING)) out[key] = value / rate;- return out;-}-async function boot() {const stageHost = $('#sl-stage');if (!stageHost) return;@@ -96,7 +90,7 @@ async function boot() {manager: stage.anim,dominant,signs: signLookup({ dominant, rate }),- timing: rate === 1 ? null : scaleTiming(rate),+ timing: rate === 1 ? null : scaledTiming(rate),});};const replay = async () => {@@ -270,6 +264,13 @@ async function boot() {});};+ /** Move the pressed state in a pill group to whichever button `match` picks. */+ const syncPills = (hostSel, match) => {+ $(hostSel)+ ?.querySelectorAll('.sl-opt')+ .forEach((btn) => btn.setAttribute('aria-pressed', String(match(btn))));+ };+buildOptions('#sl-speed', SPEEDS, (s) => s.rate === rate, (s) => setRate(s.rate));buildOptions('#sl-hand',@@ -341,6 +342,36 @@ async function boot() {// ── Webcam sign-in demo ───────────────────────────────────────────────────wireWebcamDemo(setStatus);+ // ── The sign API, live on the same page ───────────────────────────────────+ // The console calls /api/sign for real and draws the timeline that comes+ // back; "play it on the avatar" hands the same utterance to the hero, with+ // the console's hand and speed applied, so the request and the performance+ // on screen are provably the same thing.+ initSignApiConsole({+ defaults: { hand: dominant === 'Left' ? 'left' : 'right', speed: rate },+ sign: async ({ text, hand, speed }) => {+ if (!speaker) throw new Error('the avatar has not finished loading');+ stopHero();+ heroActive = false;+ const wanted = hand === 'left' ? 'Left' : 'Right';+ if (wanted !== dominant || speed !== rate) {+ dominant = wanted;+ rate = speed;+ savePrefs({ rate, dominant, avatar: avatar.id });+ syncPills('#sl-hand', (btn) => btn.textContent.toLowerCase().startsWith(hand));+ syncPills('#sl-speed', (btn) => btn.textContent === `${speed}×`);+ rebuildSpeaker();+ }+ lastPhrase = text;+ syncShare();+ setStatus(`Signing: “${text.toLowerCase()}”`);+ // Move to the avatar before it starts, not after it finishes.+ stageHost.scrollIntoView({ behavior: reducedMotion ? 'auto' : 'smooth', block: 'center' });+ const result = await speaker.speak(text);+ if (!result.superseded) setStatus(describeResult(result));+ },+ });+// ── ?say= deep link ───────────────────────────────────────────────────────// A shareable signing link, mirroring the studio's ?spell=: /sign-language// ?say=hello+world signs the phrase on arrival (dictionary + spelling).diff --git a/src/sign-speech.js b/src/sign-speech.jsindex c577f4c5c..e943b17a0 100644--- a/src/sign-speech.js+++ b/src/sign-speech.js@@ -29,6 +29,22 @@ export const CHAT_TIMING = Object.freeze({const WORD_GAP_SECONDS = 0.18;const NORMAL_BLEND_MODE = 2500;+/**+ * Timing for a given playback rate: every authored duration divided by it, so+ * 0.5× is a signer taking twice as long over the same signs rather than a clip+ * played back slowly. Pair it with `signLookup({ rate })`, which scales the+ * lexical signs the same way.+ *+ * @param {number} rate 1 is citation speed; below 1 is slower+ * @param {object} [base] the timing table to scale (chat pacing by default)+ */+export function scaledTiming(rate, base = CHAT_TIMING) {+ if (!(rate > 0) || rate === 1) return { ...base };+ const out = {};+ for (const [key, value] of Object.entries(base)) out[key] = value / rate;+ return out;+}+/*** Split text into the word sequence the signer will perform. Letters and* digits survive (A-Z fingerspelling plus the ASL number handshapes 0-9);@@ -109,7 +125,17 @@ function appendSegment(merged, clip, offset) {* }} [opts]* `signs` resolves a word to a lexical sign clip document (canonical-bone* tracks, the animation library shape); words it misses are fingerspelled.- * @returns {{ clip: object, words: string[], signed: string[], spelled: string[], truncated: boolean }}+ * @returns {{+ * clip: object,+ * words: string[],+ * signed: string[],+ * spelled: string[],+ * segments: { word: string, signed: boolean, gloss: string|null, start: number, end: number,+ * letters: { letter: string, start: number, end: number }[]|null }[],+ * truncated: boolean,+ * }}+ * `segments` is the performed timeline: one entry per word in clip order, with+ * the seconds it occupies and, for a spelled word, where each letter lands.* @throws when the text has no spellable content.*/export function compileUtterance(text, opts = {}) {@@ -125,47 +151,69 @@ export function compileUtterance(text, opts = {}) {// end. Only the first word leads in from rest and only the last settles back// to it; every word between keeps the hands up in signing space, which is what// makes a sentence read as one utterance instead of as a list of words.- const build = (word, position) =>- lookup(word, position) ??- buildFingerspellingClip(word, {+ // Each word compiles to its own segment, and a spelled one also reports where+ // each letter falls inside it, so a caller can follow the utterance along+ // without re-deriving the cadence it was built from.+ const build = (word, position) => {+ const sign = lookup(word, position);+ if (sign) return { segment: sign, signed: true, letters: null };+ const marks = [];+ const segment = buildFingerspellingClip(word, {...timing,name: `fs-${word.toLowerCase()}`,lead: position.first,settle: position.last,dominant: opts.dominant,+ marks,});+ return { segment, signed: false, letters: marks };+ };const chosen = [];let planned = 0;let truncated = false;for (let i = 0; i < words.length; i++) {const position = { first: i === 0, last: false };- const segment = build(words[i], position);+ const built = build(words[i], position);const gap = chosen.length ? WORD_GAP_SECONDS : 0;// Reserve room for the closing settle so the cap still holds once the last// word is rebuilt with it.- if (chosen.length && planned + gap + segment.duration + timing.tailSeconds > maxSeconds) {+ if (chosen.length && planned + gap + built.segment.duration + timing.tailSeconds > maxSeconds) {truncated = true;break;}- planned += gap + segment.duration;- chosen.push({ word: words[i], position, segment, signed: lookup(words[i], position) != null });+ planned += gap + built.segment.duration;+ chosen.push({ word: words[i], position, ...built });}// Whichever word ended up last (the real last, or the one truncation stopped// at) is the one that lowers the hands.const closing = chosen[chosen.length - 1];closing.position = { ...closing.position, last: true };- closing.segment = build(closing.word, closing.position);+ Object.assign(closing, build(closing.word, closing.position));const merged = new Map();let cursor = 0;const signed = [];const spelled = [];+ const segments = [];for (const entry of chosen) {if (cursor > 0) cursor += WORD_GAP_SECONDS;+ const start = cursor;cursor = appendSegment(merged, entry.segment, cursor);(entry.signed ? signed : spelled).push(entry.word);+ segments.push({+ word: entry.word,+ signed: entry.signed,+ gloss: entry.signed ? (lookupSign(entry.word)?.sign.gloss ?? null) : null,+ start,+ end: cursor,+ letters: entry.letters+ ? entry.letters+ .filter((m) => m.letter !== ' ')+ .map((m) => ({ letter: m.letter, start: start + m.start, end: start + m.end }))+ : null,+ });}// Rotation lanes only. A signed utterance is upper-body: it must never write@@ -188,6 +236,7 @@ export function compileUtterance(text, opts = {}) {words,signed,spelled,+ segments,truncated,};}