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: agent interactions lab + mixamo R2 pipeline + buffer polyfill
nirholasa23f7c0af09a
diff --git a/package-lock.json b/package-lock.jsonindex 2a963ed03..69764c9f1 100644--- a/package-lock.json+++ b/package-lock.json@@ -121,6 +121,7 @@"prettier": "^3.2.5","sharp": "latest","vite": "latest",+ "vite-plugin-node-polyfills": "^0.25.0","vite-plugin-pwa": "latest","vitest": "latest","workbox-build": "^7.4.0",diff --git a/package.json b/package.jsonindex 5f8b51a00..f4a02a179 100644--- a/package.json+++ b/package.json@@ -200,6 +200,7 @@"prettier": "^3.2.5","sharp": "latest","vite": "latest",+ "vite-plugin-node-polyfills": "^0.25.0","vite-plugin-pwa": "latest","vitest": "latest","workbox-build": "^7.4.0",diff --git a/public/animations/mixamo/catalog.json b/public/animations/mixamo/catalog.jsonindex 152451ce5..e499c1fe8 100644--- a/public/animations/mixamo/catalog.json+++ b/public/animations/mixamo/catalog.json@@ -1,6 +1,6 @@{"character_id": "403e7206-d314-416a-9ef2-c618e26a8b6e",- "generated_at": "2026-05-01T18:45:09.473Z",+ "generated_at": "2026-05-22T06:53:26.747Z","animations": {"c9c72233-b96c-11e4-a802-0aaa78deedf9": {"id": "c9c72233-b96c-11e4-a802-0aaa78deedf9",@@ -50,6 +50,405 @@"status": "permanent_fail","http": 400,"failed_at": "2026-05-01T18:45:09.473Z"+ },+ "c9c6ba36-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c6ba36-b96c-11e4-a802-0aaa78deedf9",+ "name": "Jogging Slowly In Reverse Varying Angles Of Twist",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:27:27.861Z"+ },+ "c9c646a9-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c646a9-b96c-11e4-a802-0aaa78deedf9",+ "name": "Gun Reload While Walking",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:27:27.910Z"+ },+ "c9c650df-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c650df-b96c-11e4-a802-0aaa78deedf9",+ "name": "Female \"African Noodle\" Dance",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:27:57.990Z"+ },+ "c9c6b165-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c6b165-b96c-11e4-a802-0aaa78deedf9",+ "name": "Zombie Laying On Back To Standing Up",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:27:58.001Z"+ },+ "c9c65d8a-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c65d8a-b96c-11e4-a802-0aaa78deedf9",+ "name": "Female Hip Hop 'Body Wave' Dancing",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:28:28.250Z"+ },+ "c9c671b2-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c671b2-b96c-11e4-a802-0aaa78deedf9",+ "name": "Male Strut Walk",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:28:28.308Z"+ },+ "c9c64ab0-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c64ab0-b96c-11e4-a802-0aaa78deedf9",+ "name": "Male Menacing Jump Down",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:28:52.680Z"+ },+ "d3a09098-c43e-49e7-85f3-fcc86760517a": {+ "id": "d3a09098-c43e-49e7-85f3-fcc86760517a",+ "name": "Two Handed Casting Spell Fowards",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:28:52.681Z"+ },+ "14edbafc-0099-4c35-9f66-25e095c7fcd6": {+ "id": "14edbafc-0099-4c35-9f66-25e095c7fcd6",+ "name": "Female Idle To Twist Right Idle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:29:22.798Z"+ },+ "c9c5f9cb-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c5f9cb-b96c-11e4-a802-0aaa78deedf9",+ "name": "Hook With The Lead Hand",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:29:22.811Z"+ },+ "51e30f03-9fbf-4d0a-a1b4-489f94e85245": {+ "id": "51e30f03-9fbf-4d0a-a1b4-489f94e85245",+ "name": "Playing With Magic",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:29:52.947Z"+ },+ "946fd0d3-815b-4653-8be1-1a2e5b9cc688": {+ "id": "946fd0d3-815b-4653-8be1-1a2e5b9cc688",+ "name": "Female Walk Forward - Knees High",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:29:52.953Z"+ },+ "c9ceef5f-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ceef5f-b96c-11e4-a802-0aaa78deedf9",+ "name": "Turning 90 Degrees Left",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:30:23.063Z"+ },+ "c9cad4c4-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cad4c4-b96c-11e4-a802-0aaa78deedf9",+ "name": "Start Plank From Fitness Idle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:30:23.067Z"+ },+ "c9caee1d-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9caee1d-b96c-11e4-a802-0aaa78deedf9",+ "name": "High Center Block",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:30:23.068Z"+ },+ "c9cb0ab6-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cb0ab6-b96c-11e4-a802-0aaa78deedf9",+ "name": "Formal Military Salute",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:30:53.342Z"+ },+ "c9c9f63d-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c9f63d-b96c-11e4-a802-0aaa78deedf9",+ "name": "Female Standing Talking On Phone",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:30:53.343Z"+ },+ "c9ca84cb-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ca84cb-b96c-11e4-a802-0aaa78deedf9",+ "name": "Male Kicking With Both Legs",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:31:53.483Z"+ },+ "c9cb3f36-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cb3f36-b96c-11e4-a802-0aaa78deedf9",+ "name": "Goalkeeper Catching Ball Medium Height",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:31:53.491Z"+ },+ "c9cb2022-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cb2022-b96c-11e4-a802-0aaa78deedf9",+ "name": "Ending Snatch Workout To Fitness Idle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:32:23.634Z"+ },+ "c9cac4cf-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cac4cf-b96c-11e4-a802-0aaa78deedf9",+ "name": "Situp Transition To Fitness Idle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:32:23.635Z"+ },+ "c9cadde1-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cadde1-b96c-11e4-a802-0aaa78deedf9",+ "name": "Illegal Elbow To The Head",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:32:53.739Z"+ },+ "c9cb49e8-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9cb49e8-b96c-11e4-a802-0aaa78deedf9",+ "name": "Goalkeeper Jump Catching Ball High Height",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:32:53.740Z"+ },+ "c9ca7c38-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ca7c38-b96c-11e4-a802-0aaa78deedf9",+ "name": "Putt Pre-Shot Looking Routine",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:33:23.882Z"+ },+ "c9c9ed52-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c9ed52-b96c-11e4-a802-0aaa78deedf9",+ "name": "Male Right Turn With Briefcase",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:34:24.071Z"+ },+ "c9ca099c-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ca099c-b96c-11e4-a802-0aaa78deedf9",+ "name": "Male Walking And Opening A Door Inwards",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:36:24.206Z"+ },+ "c9ca9cba-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ca9cba-b96c-11e4-a802-0aaa78deedf9",+ "name": "Male Two Arm Swing Onto Platform",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:36:24.217Z"+ },+ "c9ca9a5a-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ca9a5a-b96c-11e4-a802-0aaa78deedf9",+ "name": "Jumping Knee Followed By A Punch",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:38:24.322Z"+ },+ "c9c9611b-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c9611b-b96c-11e4-a802-0aaa78deedf9",+ "name": "Climbing Up A Ladder To Standing",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:38:24.336Z"+ },+ "c9c99d44-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c99d44-b96c-11e4-a802-0aaa78deedf9",+ "name": "Standing Ready To Standing Cover",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:38:54.444Z"+ },+ "c9ca76d1-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9ca76d1-b96c-11e4-a802-0aaa78deedf9",+ "name": "Bad Shot Reaction Var 3",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:38:54.455Z"+ },+ "c9c9ce91-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c9ce91-b96c-11e4-a802-0aaa78deedf9",+ "name": "Freehang Climb To Standing",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:39:24.593Z"+ },+ "c9c9941c-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c9941c-b96c-11e4-a802-0aaa78deedf9",+ "name": "Super Excited",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:40:24.709Z"+ },+ "c9c8b661-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8b661-b96c-11e4-a802-0aaa78deedf9",+ "name": "Walking From Standing",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:40:24.712Z"+ },+ "c9c8bb8a-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8bb8a-b96c-11e4-a802-0aaa78deedf9",+ "name": "Pilot Flips High Switches In A Helicopter",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:41:24.862Z"+ },+ "c9c98e99-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c98e99-b96c-11e4-a802-0aaa78deedf9",+ "name": "Looking Over Both Shoulders",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:41:24.869Z"+ },+ "c9c8335e-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8335e-b96c-11e4-a802-0aaa78deedf9",+ "name": "Sitting To Standing",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:43:25.007Z"+ },+ "c9c97399-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c97399-b96c-11e4-a802-0aaa78deedf9",+ "name": "Jumping In Place",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:43:25.010Z"+ },+ "c9c84492-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c84492-b96c-11e4-a802-0aaa78deedf9",+ "name": "Rifle Standing Aiming Idle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:43:55.144Z"+ },+ "c9c8bf13-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8bf13-b96c-11e4-a802-0aaa78deedf9",+ "name": "Blocking With Rifle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:43:55.214Z"+ },+ "c9c8707d-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8707d-b96c-11e4-a802-0aaa78deedf9",+ "name": "Jogging",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:44:25.256Z"+ },+ "c9c8f19f-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8f19f-b96c-11e4-a802-0aaa78deedf9",+ "name": "Dismissing With Back Hand",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:44:25.259Z"+ },+ "c9c867ac-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c867ac-b96c-11e4-a802-0aaa78deedf9",+ "name": "Jog In A Circle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:44:55.529Z"+ },+ "c9c863fe-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c863fe-b96c-11e4-a802-0aaa78deedf9",+ "name": "Firing A Rifle While Standing",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:44:55.532Z"+ },+ "c9c8d7db-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8d7db-b96c-11e4-a802-0aaa78deedf9",+ "name": "Fast Run To 180 Degree Turn",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:45:25.770Z"+ },+ "c9c90592-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c90592-b96c-11e4-a802-0aaa78deedf9",+ "name": "Receive An Uppercut Punch To The Face",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:46:25.897Z"+ },+ "c9c81fce-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c81fce-b96c-11e4-a802-0aaa78deedf9",+ "name": "Action Move Running And Rolling",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:47:26.033Z"+ },+ "c9c8aa0e-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8aa0e-b96c-11e4-a802-0aaa78deedf9",+ "name": "Dodging While Holding Rifle",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:47:26.045Z"+ },+ "c9c817ba-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c817ba-b96c-11e4-a802-0aaa78deedf9",+ "name": "Change Direction 180 Degrees While Running",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:49:26.190Z"+ },+ "c9c8d27d-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8d27d-b96c-11e4-a802-0aaa78deedf9",+ "name": "Quick Nervous Look Over Right Shoulder",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:49:26.192Z"+ },+ "c9c80a75-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c80a75-b96c-11e4-a802-0aaa78deedf9",+ "name": "Left Male Strafe",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:49:56.315Z"+ },+ "c9c8276d-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c8276d-b96c-11e4-a802-0aaa78deedf9",+ "name": "Run To Stop Against Object",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:49:56.338Z"+ },+ "c9c795b6-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c795b6-b96c-11e4-a802-0aaa78deedf9",+ "name": "Waving Someone Over While Seated",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:50:26.443Z"+ },+ "c9c6d61e-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c6d61e-b96c-11e4-a802-0aaa78deedf9",+ "name": "Opening And Closing Cabinet Door",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:50:27.466Z"+ },+ "c9c6e172-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c6e172-b96c-11e4-a802-0aaa78deedf9",+ "name": "Hip Hop Dancing Side To Side",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:51:26.602Z"+ },+ "c9c71cfd-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c71cfd-b96c-11e4-a802-0aaa78deedf9",+ "name": "Flying Hurricane Kick",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:51:26.646Z"+ },+ "c9c71941-b96c-11e4-a802-0aaa78deedf9": {+ "id": "c9c71941-b96c-11e4-a802-0aaa78deedf9",+ "name": "Jogging Around Ring Entry Sequence",+ "status": "permanent_fail",+ "http": 400,+ "failed_at": "2026-05-22T06:53:26.747Z"}}}\ No newline at end of filediff --git a/public/animations/mixamo/hf-manifest.json b/public/animations/mixamo/hf-manifest.jsonnew file mode 100644index 000000000..e15142570--- /dev/null+++ b/public/animations/mixamo/hf-manifest.json@@ -0,0 +1,93 @@+{+ "00263ce7085eecf97ac97cd06d48c998": {+ "uuid": "00263ce7085eecf97ac97cd06d48c998",+ "r2Key": "mixamo/00263ce7085eecf97ac97cd06d48c998.fbx",+ "bytes": 729776,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:05.450Z"+ },+ "00041fd3325430d72c5a947e1171de3b": {+ "uuid": "00041fd3325430d72c5a947e1171de3b",+ "r2Key": "mixamo/00041fd3325430d72c5a947e1171de3b.fbx",+ "bytes": 509584,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:05.471Z"+ },+ "0047fc953feac685a03497e88c79c5b0": {+ "uuid": "0047fc953feac685a03497e88c79c5b0",+ "r2Key": "mixamo/0047fc953feac685a03497e88c79c5b0.fbx",+ "bytes": 732608,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:05.477Z"+ },+ "0048ddbd78fdaf0a54201fa072c11ba1": {+ "uuid": "0048ddbd78fdaf0a54201fa072c11ba1",+ "r2Key": "mixamo/0048ddbd78fdaf0a54201fa072c11ba1.fbx",+ "bytes": 1581264,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:05.599Z"+ },+ "006c9a5e149c549f1c1bdae7d2fcaf3f": {+ "uuid": "006c9a5e149c549f1c1bdae7d2fcaf3f",+ "r2Key": "mixamo/006c9a5e149c549f1c1bdae7d2fcaf3f.fbx",+ "bytes": 838128,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:05.951Z"+ },+ "006bf01be8dd4c47e2b52ffc884ce89f": {+ "uuid": "006bf01be8dd4c47e2b52ffc884ce89f",+ "r2Key": "mixamo/006bf01be8dd4c47e2b52ffc884ce89f.fbx",+ "bytes": 986800,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:05.975Z"+ },+ "007461825ff5e6b6bd7860345aa449d2": {+ "uuid": "007461825ff5e6b6bd7860345aa449d2",+ "r2Key": "mixamo/007461825ff5e6b6bd7860345aa449d2.fbx",+ "bytes": 626560,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:06.087Z"+ },+ "0062b3586221049498c037f20f24278e": {+ "uuid": "0062b3586221049498c037f20f24278e",+ "r2Key": "mixamo/0062b3586221049498c037f20f24278e.fbx",+ "bytes": 693312,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:06.089Z"+ },+ "00954fe50745902f381ae452b7ddb5c5": {+ "uuid": "00954fe50745902f381ae452b7ddb5c5",+ "r2Key": "mixamo/00954fe50745902f381ae452b7ddb5c5.fbx",+ "bytes": 786864,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:06.515Z"+ },+ "00d4be92be662482d9225367626361b3": {+ "uuid": "00d4be92be662482d9225367626361b3",+ "r2Key": "mixamo/00d4be92be662482d9225367626361b3.fbx",+ "bytes": 458288,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:06.603Z"+ },+ "00b83952c5c63310f26c081f12be45cb": {+ "uuid": "00b83952c5c63310f26c081f12be45cb",+ "r2Key": "mixamo/00b83952c5c63310f26c081f12be45cb.fbx",+ "bytes": 641888,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:06.628Z"+ },+ "00fe8d9ed1bb882552ab8b606dadf90c": {+ "uuid": "00fe8d9ed1bb882552ab8b606dadf90c",+ "r2Key": "mixamo/00fe8d9ed1bb882552ab8b606dadf90c.fbx",+ "bytes": 1467632,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:07.053Z"+ },+ "0101e2a167184e7ceefe2ba138e20128": {+ "uuid": "0101e2a167184e7ceefe2ba138e20128",+ "r2Key": "mixamo/0101e2a167184e7ceefe2ba138e20128.fbx",+ "bytes": 634688,+ "uploaded": true,+ "uploaded_at": "2026-05-22T06:49:07.075Z"+ }+}\ No newline at end of filediff --git a/public/demos/404.html b/public/demos/404.htmlindex e2ff12551..4a74fb8b9 100644--- a/public/demos/404.html+++ b/public/demos/404.html@@ -164,6 +164,11 @@_v3.unproject(camera);return { x: _v3.x, y: _v3.y };}++ // ── Avatar runtime ────────────────────────────────────────────────+ // Declared above resize() so the recalibrate path doesn't TDZ on init.+ let avatar = null, mixer = null, rootBone = null, baseRootPos = null;+function resize() {renderer.setSize(window.innerWidth, window.innerHeight, false);updateFrustum();@@ -177,9 +182,6 @@const key = new THREE.DirectionalLight(0xfff4dc, 2.0); key.position.set(3, 6, 5); scene.add(key);const rim = new THREE.DirectionalLight(0x4060ff, 0.6); rim.position.set(-4, 3, -2); scene.add(rim);const fill = new THREE.DirectionalLight(0xffeedd, 0.4); fill.position.set(0, 2, 7); scene.add(fill);-- // ── Avatar runtime ────────────────────────────────────────────────- let avatar = null, mixer = null, rootBone = null, baseRootPos = null;const actions = {};let currentAction = null;const FADE_S = 0.3;diff --git a/public/demos/agents/_lib.js b/public/demos/agents/_lib.jsnew file mode 100644index 000000000..61230dab9--- /dev/null+++ b/public/demos/agents/_lib.js@@ -0,0 +1,200 @@+// Shared utilities for the /demos/agents/* interaction prototypes.+// Mirrors the renderer/avatar bootstrap from 3d-home.html so each demo+// can stay focused on its unique interaction logic.++import * as THREE from 'three';+import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';++export const PX_PER_UNIT = 120;++export function smoothstep(t) { return t * t * (3 - 2 * t); }+export function lerp(a, b, t) { return a + (b - a) * t; }+export function clamp(v, a, b) { return Math.max(a, Math.min(b, v)); }++export function createStage(canvas) {+ const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });+ renderer.setPixelRatio(Math.min(devicePixelRatio, 2));+ renderer.outputColorSpace = THREE.SRGBColorSpace;+ renderer.toneMapping = THREE.ACESFilmicToneMapping;+ renderer.toneMappingExposure = 1.1;++ const scene = new THREE.Scene();+ const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0.1, 100);+ camera.position.z = 10;++ scene.add(new THREE.AmbientLight(0xffffff, 0.6));+ const key = new THREE.DirectionalLight(0xfff4dc, 2.0);+ key.position.set(3, 6, 5); scene.add(key);+ const rim = new THREE.DirectionalLight(0x4060ff, 0.6);+ rim.position.set(-4, 3, -2); scene.add(rim);+ const fill = new THREE.DirectionalLight(0xffeedd, 0.4);+ fill.position.set(0, 2, 7); scene.add(fill);++ function resize() {+ const hw = window.innerWidth / PX_PER_UNIT / 2;+ const hh = window.innerHeight / PX_PER_UNIT / 2;+ camera.left = -hw; camera.right = hw;+ camera.top = hh; camera.bottom = -hh;+ camera.updateProjectionMatrix();+ renderer.setSize(window.innerWidth, window.innerHeight, false);+ }+ window.addEventListener('resize', resize);+ resize();++ const _v3 = new THREE.Vector3();+ function domToWorld(sx, sy) {+ _v3.set(+ (sx / window.innerWidth) * 2 - 1,+ -(sy / window.innerHeight) * 2 + 1,+ 0,+ );+ _v3.unproject(camera);+ return { x: _v3.x, y: _v3.y };+ }++ return { renderer, scene, camera, resize, domToWorld };+}++export async function loadAvatar(url = '/avatars/cz.glb') {+ const gltf = await new Promise((res, rej) =>+ new GLTFLoader().load(url, res, undefined, rej),+ );+ const avatar = gltf.scene;+ let rootBone = null;+ avatar.traverse(n => {+ if (!rootBone && /^(Hips|Root|mixamorig:?Hips)$/i.test(n.name)) rootBone = n;+ });+ const mixer = new THREE.AnimationMixer(avatar);+ const baseRootPos = rootBone ? rootBone.position.clone() : null;+ return { avatar, mixer, rootBone, baseRootPos };+}++export async function loadClips(mixer, clipMap) {+ const entries = Object.entries(clipMap);+ const jsons = await Promise.all(+ entries.map(([_, url]) => fetch(url).then(r => r.json())),+ );+ const out = {};+ for (let i = 0; i < entries.length; i++) {+ out[entries[i][0]] = mixer.clipAction(THREE.AnimationClip.parse(jsons[i]));+ }+ return out;+}++export function startLoop(renderer, scene, camera, mixer, onTick, rootBone, baseRootPos) {+ const clock = new THREE.Clock();+ const _orig = renderer.render.bind(renderer);+ if (rootBone && baseRootPos) {+ renderer.render = (sc, cam) => {+ try { rootBone.position.copy(baseRootPos); } catch (_) {}+ _orig(sc, cam);+ };+ }+ (function tick() {+ requestAnimationFrame(tick);+ try {+ const dt = Math.min(clock.getDelta(), 0.05);+ mixer?.update(dt);+ onTick?.(dt);+ renderer.render(scene, camera);+ } catch (_) {}+ })();+}++// Ballistic droplet burst — same physics as 3d-home.html's fireSplash.+const PALETTES = {+ lime: ['#f6ffc4', '#d6ff3d', '#92b500'],+ water: ['#e0f7ff', '#7fc4ff', '#1a6ec8'],+ red: ['#ffd4d4', '#ff6b6b', '#9b1414'],+ gold: ['#fff4c4', '#ffd23d', '#c89200'],+};+export function fireSplash(sx, sy, opts = {}) {+ const count = opts.count ?? 18;+ const pal = PALETTES[opts.color ?? 'lime'] ?? PALETTES.lime;+ const drops = [];+ for (let i = 0; i < count; i++) {+ const size = 5 + Math.random() * 7;+ const el = document.createElement('div');+ el.style.cssText =+ `position:fixed;left:${sx - size / 2}px;top:${sy - size / 2}px;` ++ `width:${size}px;height:${size}px;border-radius:50%;` ++ `background:radial-gradient(circle at 35% 30%,${pal[0]},${pal[1]} 55%,${pal[2]});` ++ `box-shadow:0 0 6px ${pal[1]}aa;pointer-events:none;z-index:30;` ++ `will-change:transform,opacity;`;+ document.body.appendChild(el);+ const angle = -Math.PI / 2 + (Math.random() - 0.5) * Math.PI * 1.15;+ const speed = 220 + Math.random() * 340;+ drops.push({+ el, x: 0, y: 0,+ vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed,+ life: 0, max: 0.85 + Math.random() * 0.5,+ });+ }+ let last = performance.now();+ (function step(now) {+ const dt = Math.min((now - last) / 1000, 0.04);+ last = now;+ let alive = false;+ for (const d of drops) {+ if (!d.el) continue;+ d.life += dt;+ d.vy += 1600 * dt;+ d.x += d.vx * dt;+ d.y += d.vy * dt;+ const t = d.life / d.max;+ if (t >= 1) { d.el.remove(); d.el = null; continue; }+ d.el.style.opacity = String(1 - t * t);+ d.el.style.transform = `translate(${d.x.toFixed(1)}px, ${d.y.toFixed(1)}px)`;+ alive = true;+ }+ if (alive) requestAnimationFrame(step);+ })(last);+}++// Compact squish via Web Animations API (no gsap dep).+export function fireSquish(el, opts = {}) {+ const sX = opts.scaleX ?? 1.05;+ const sY = opts.scaleY ?? 0.7;+ el.animate(+ [+ { transform: 'scaleX(1) scaleY(1)' },+ { transform: `scaleX(${sX}) scaleY(${sY})`, offset: 0.12 },+ { transform: 'scaleX(0.99) scaleY(1.02)', offset: 0.4 },+ { transform: 'scaleX(1.01) scaleY(0.99)', offset: 0.65 },+ { transform: 'scaleX(1) scaleY(1)' },+ ],+ { duration: 900, easing: 'cubic-bezier(0.16, 1, 0.3, 1)' },+ );+}++// Expanding shockwave ring centered at (sx, sy) for impact feedback.+export function fireShockwave(sx, sy, opts = {}) {+ const color = opts.color ?? '#d6ff3d';+ const size = opts.size ?? 14;+ const max = opts.max ?? 120;+ const ring = document.createElement('div');+ ring.style.cssText =+ `position:fixed;left:${sx - size / 2}px;top:${sy - size / 2}px;` ++ `width:${size}px;height:${size}px;border-radius:50%;` ++ `border:2px solid ${color};box-shadow:0 0 12px ${color}88;` ++ `pointer-events:none;z-index:25;will-change:transform,opacity;`;+ document.body.appendChild(ring);+ const anim = ring.animate(+ [+ { transform: 'scale(1)', opacity: 0.95 },+ { transform: `scale(${max / size})`, opacity: 0 },+ ],+ { duration: 520, easing: 'cubic-bezier(0.16, 1, 0.3, 1)' },+ );+ anim.onfinish = () => ring.remove();+}++// Common HTML chrome — minimal nav + back link injected once.+export function mountChrome(title) {+ document.body.insertAdjacentHTML('afterbegin', `+ <div class="agents-nav">+ <a href="/demos/agents/" class="agents-back">← agents</a>+ <span class="agents-title">${title}</span>+ </div>+ `);+}diff --git a/public/demos/agents/_shared.css b/public/demos/agents/_shared.cssnew file mode 100644index 000000000..242d83a96--- /dev/null+++ b/public/demos/agents/_shared.css@@ -0,0 +1,92 @@+/* Shared chrome + base layout for /demos/agents/* prototypes */+:root { color-scheme: dark; }+*, *::before, *::after { box-sizing: border-box; }+html, body {+ height: 100%; margin: 0;+ background: #04050d; color: #eee;+ font: 15px/1.55 'Inter', -apple-system, system-ui, sans-serif;+}++#avatar-canvas {+ position: fixed; top: 0; left: 0;+ width: 100vw; height: 100vh;+ pointer-events: none; z-index: 999;+}++.agents-nav {+ position: fixed; top: 0; left: 0; right: 0; z-index: 20;+ display: flex; align-items: center; gap: 20px;+ padding: 14px 28px;+ background: rgba(4,5,13,0.55);+ backdrop-filter: blur(14px);+ border-bottom: 1px solid rgba(255,255,255,0.04);+}+.agents-back {+ color: #d6ff3d; text-decoration: none;+ font: 600 13px/1 'Space Grotesk','Inter',sans-serif;+ letter-spacing: 0.02em;+}+.agents-back:hover { color: #fff; }+.agents-title {+ color: #888c9d;+ font: 600 12px/1 'Space Grotesk','Inter',sans-serif;+ letter-spacing: 0.18em; text-transform: uppercase;+}++.stage {+ position: relative; z-index: 10;+ min-height: 100vh;+ display: flex; flex-direction: column;+ justify-content: center;+ padding: 100px 56px 60px;+ max-width: 560px;+}+.hero-eyebrow {+ display: inline-flex; align-items: center; gap: 9px;+ font: 600 11px/1 'Space Grotesk','Inter',sans-serif;+ letter-spacing: 0.17em; text-transform: uppercase;+ color: #d6ff3d; margin-bottom: 24px;+}+.hero-eyebrow::before {+ content: ''; width: 7px; height: 7px; border-radius: 50%;+ background: #d6ff3d; box-shadow: 0 0 8px rgba(214,255,61,0.7);+}+.hero-title {+ font-family: 'Space Grotesk','Inter',sans-serif;+ font-size: clamp(38px, 4.5vw, 64px);+ font-weight: 800; letter-spacing: -0.03em;+ line-height: 1.04; margin: 0 0 18px; color: #fff;+}+.hero-title em { color: #d6ff3d; font-style: normal; }+.hero-sub {+ color: #555870; font-size: 15px; line-height: 1.7;+ max-width: 40ch; margin: 0 0 36px;+}+.cta-row { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }++.btn {+ display: inline-flex; align-items: center; gap: 10px;+ padding: 16px 32px; border: none; border-radius: 14px;+ font: 700 15px/1 'Inter', inherit; cursor: pointer; text-decoration: none;+ user-select: none;+ transform-origin: bottom center;+ will-change: transform;+}+.btn-primary {+ background: linear-gradient(160deg, #e2ff5a, #c8ef2c);+ color: #0a0b0f;+ box-shadow: 0 8px 0 0 #7a9600, 0 10px 28px rgba(214,255,61,0.28);+}+.btn-primary:hover { filter: brightness(1.07); }+.btn-ghost {+ background: rgba(255,255,255,0.05); color: #bbb;+ border: 1.5px solid rgba(255,255,255,0.1);+ box-shadow: 0 5px 0 0 rgba(255,255,255,0.04);+}++.hint {+ position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);+ color: #555870; font-size: 12px; letter-spacing: 0.06em;+ text-transform: uppercase; pointer-events: none;+ z-index: 15;+}diff --git a/public/demos/agents/builds-button.html b/public/demos/agents/builds-button.htmlnew file mode 100644index 000000000..0ec2b10fc--- /dev/null+++ b/public/demos/agents/builds-button.html@@ -0,0 +1,178 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Builds the button — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ #cta-btn {+ opacity: 0;+ transform: translateY(20px);+ transition: opacity 0.5s, transform 0.5s cubic-bezier(0.16,1,0.3,1);+ }+ #cta-btn.built {+ opacity: 1;+ transform: translateY(0);+ }+ .block {+ position: fixed; pointer-events: none; z-index: 28;+ border-radius: 6px;+ background: linear-gradient(160deg, #e2ff5a, #c8ef2c);+ box-shadow: 0 4px 0 0 #7a9600;+ will-change: transform;+ }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Builds the button</div>+ <h1 class="hero-title">She <em>assembles</em> the CTA.</h1>+ <p class="hero-sub">+ Walks in from the left carrying blocks. Places them where the+ button belongs. Stacks them. They snap together into the CTA.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary" id="cta-btn"><span>Build your agent — free</span><span>→</span></a>+ <button class="btn btn-ghost" id="restart"><span>Rebuild</span></button>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">click "rebuild"</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ smoothstep, fireSplash, fireShockwave, mountChrome,+ } from './_lib.js';++ mountChrome('Builds the button');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const restart= document.getElementById('restart');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ walk: '/animations/clips/walk.json',+ idle: '/animations/clips/idle.json',+ cheer: '/animations/clips/celebrate.json',+ });+ A.walk.setLoop(THREE.LoopRepeat, Infinity);+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.cheer.setLoop(THREE.LoopOnce, 1); A.cheer.clampWhenFinished = true;+ A.idle.play();+ let current = A.idle;++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ function btnRect() { return ctaBtn.getBoundingClientRect(); }++ // Sequence: she walks from offscreen-left to the CTA spot, places+ // one of three blocks each trip. After the third, the real CTA fades in.+ const BLOCK_SIZES = [+ { w: 0.36, h: 0.32 }, // left third+ { w: 0.36, h: 0.32 }, // middle third+ { w: 0.36, h: 0.32 }, // right third+ ];+ let stage_i = 0;+ let phase = 'idle', t0 = 0;+ let fromW = null, toW = null, dur = 1.4;+ let activeBlock = null;++ function start() {+ stage_i = 0;+ ctaBtn.classList.remove('built');+ ctaBtn.style.opacity = '0';+ // Clear any leftover DOM blocks+ document.querySelectorAll('.block').forEach(b => b.remove());+ nextTrip();+ }+ restart.addEventListener('click', start);+ start();++ function nextTrip() {+ if (stage_i >= BLOCK_SIZES.length) {+ // Done — fade in real button + celebrate.+ ctaBtn.classList.add('built');+ switchTo(A.cheer, 0.2);+ const r = btnRect();+ fireSplash(r.left + r.width / 2, r.top, { count: 28 });+ fireShockwave(r.left + r.width / 2, r.top, { size: 30, max: 200 });+ phase = 'done';+ return;+ }+ // Spawn DOM block at offscreen-left, the carrier walks it in.+ const r = btnRect();+ const slotX = r.left + r.width * (stage_i + 0.5) / BLOCK_SIZES.length;+ const slotY = r.top + r.height / 2;+ const blockW = r.width / BLOCK_SIZES.length;+ const blockH = r.height;+ const b = document.createElement('div');+ b.className = 'block';+ b.style.width = `${blockW}px`;+ b.style.height = `${blockH}px`;+ b.style.left = `-${blockW + 20}px`;+ b.style.top = `${slotY - blockH / 2}px`;+ document.body.appendChild(b);+ activeBlock = { el: b, slotX, slotY, blockW, blockH };++ // Carrier path: from far left → just under the slot.+ const start = stage.domToWorld(-80, slotY + 100);+ const end = stage.domToWorld(slotX, slotY + 100);+ avatar.position.set(start.x, start.y, 0);+ fromW = start; toW = end; t0 = performance.now();+ phase = 'walkin'; dur = 1.6;+ switchTo(A.walk, 0.2);+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ if (phase === 'walkin') {+ const p = Math.min((performance.now() - t0) / 1000 / dur, 1);+ const e = smoothstep(p);+ avatar.position.x = fromW.x + (toW.x - fromW.x) * e;+ avatar.position.y = fromW.y + (toW.y - fromW.y) * e;+ avatar.rotation.y = -Math.PI * 0.5; // facing right+ // Block follows alongside the carrier, slightly behind+up.+ if (activeBlock) {+ const proj = new THREE.Vector3(avatar.position.x - 0.4, avatar.position.y + 0.7, 0).project(stage.camera);+ const sx = (proj.x + 1) * 0.5 * window.innerWidth;+ const sy = (1 - (proj.y + 1) * 0.5) * window.innerHeight;+ activeBlock.el.style.left = `${sx - activeBlock.blockW / 2}px`;+ activeBlock.el.style.top = `${sy - activeBlock.blockH / 2}px`;+ }+ if (p >= 1) {+ phase = 'place'; t0 = performance.now();+ switchTo(A.idle, 0.2);+ }+ } else if (phase === 'place') {+ const p = Math.min((performance.now() - t0) / 500, 1);+ if (activeBlock) {+ const startX = parseFloat(activeBlock.el.style.left);+ const startY = parseFloat(activeBlock.el.style.top);+ const endX = activeBlock.slotX - activeBlock.blockW / 2;+ const endY = activeBlock.slotY - activeBlock.blockH / 2;+ activeBlock.el.style.left = `${startX + (endX - startX) * p}px`;+ activeBlock.el.style.top = `${startY + (endY - startY) * p}px`;+ }+ if (p >= 1) {+ stage_i++;+ phase = 'dwell'; t0 = performance.now();+ }+ } else if (phase === 'dwell') {+ if (performance.now() - t0 > 350) nextTrip();+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/climb-title.html b/public/demos/agents/climb-title.htmlnew file mode 100644index 000000000..86a9639db--- /dev/null+++ b/public/demos/agents/climb-title.html@@ -0,0 +1,111 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Climb the title — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ .hero-title { display: flex; flex-wrap: wrap; gap: 0.18em; }+ .hero-title .word { display: inline-block; }+ .grip { display: inline-block; }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Climb the title</div>+ <h1 class="hero-title">+ <span class="word"><span class="grip">G</span><span class="grip">i</span><span class="grip">v</span><span class="grip">e</span></span>+ <span class="word"><span class="grip">y</span><span class="grip">o</span><span class="grip">u</span><span class="grip">r</span></span>+ <span class="word"><em><span class="grip">A</span><span class="grip">I</span></em></span>+ </h1>+ <p class="hero-sub">+ She climbs letter to letter like a rope-climber. Each letter top is+ a grip point — she perches, jumps, perches again.+ </p>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">she climbs the headline</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ smoothstep, mountChrome,+ } from './_lib.js';++ mountChrome('Climb the title');++ const canvas = document.getElementById('avatar-canvas');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ idle: '/animations/clips/idle.json',+ jump: '/animations/clips/jump.json',+ wave: '/animations/clips/wave.json',+ });+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.jump.setLoop(THREE.LoopOnce, 1); A.jump.clampWhenFinished = true;+ A.wave.setLoop(THREE.LoopOnce, 1); A.wave.clampWhenFinished = true;+ A.idle.play();+ let current = A.idle;++ const grips = [...document.querySelectorAll('.grip')];+ // Hop order: walk through letters left to right.+ let ix = 0;+ function gripWorld(i) {+ const r = grips[i].getBoundingClientRect();+ return stage.domToWorld(r.left + r.width / 2, r.top - 6);+ }+ let start = gripWorld(0);+ avatar.position.set(start.x, start.y, 0);++ let traveling = false, fromW = null, toW = null, t0 = 0, dur = 0.55;++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ function hopTo(i) {+ fromW = { x: avatar.position.x, y: avatar.position.y };+ toW = gripWorld(i);+ dur = 0.5;+ t0 = performance.now();+ traveling = true;+ switchTo(A.jump, 0.15);+ }++ let nextHopAt = performance.now() + 900;++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ const now = performance.now();+ if (!traveling && now > nextHopAt) {+ ix = (ix + 1) % grips.length;+ hopTo(ix);+ }+ if (traveling) {+ const p = Math.min((now - t0) / 1000 / dur, 1);+ const e = smoothstep(p);+ const arc = 0.7 * 4 * p * (1 - p);+ avatar.position.x = fromW.x + (toW.x - fromW.x) * e;+ avatar.position.y = fromW.y + (toW.y - fromW.y) * e + arc;+ avatar.rotation.y = Math.sign(toW.x - fromW.x) * Math.sin(Math.PI * p) * 0.18;+ if (p >= 1) {+ avatar.rotation.y = 0;+ traveling = false;+ const dwell = ix === grips.length - 1 ? 1800 : 600;+ nextHopAt = now + dwell;+ switchTo(ix === grips.length - 1 ? A.wave : A.idle, 0.2);+ }+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/cursor-follower.html b/public/demos/agents/cursor-follower.htmlnew file mode 100644index 000000000..5b30d2d24--- /dev/null+++ b/public/demos/agents/cursor-follower.html@@ -0,0 +1,144 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Cursor follower — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Cursor follower</div>+ <h1 class="hero-title">Hover <em>anywhere</em>.</h1>+ <p class="hero-sub">+ She picks the closest text or button to your cursor and hops to it.+ Sit still and she yawns; move again and she's back.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary"><span>Primary</span><span>→</span></a>+ <a href="#" class="btn btn-ghost"><span>Secondary</span></a>+ </div>+ <p style="margin-top:36px;color:#888c9d;font-size:13px;letter-spacing:0.04em;">+ Hover any underlined word →+ <a href="#" data-target style="color:#d6ff3d;border-bottom:1px dotted;text-decoration:none;">docs</a> ·+ <a href="#" data-target style="color:#d6ff3d;border-bottom:1px dotted;text-decoration:none;">pricing</a> ·+ <a href="#" data-target style="color:#d6ff3d;border-bottom:1px dotted;text-decoration:none;">examples</a>+ </p>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">move the cursor — she hops</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ PX_PER_UNIT, smoothstep, mountChrome,+ } from './_lib.js';++ mountChrome('Cursor follower');++ const canvas = document.getElementById('avatar-canvas');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ idle: '/animations/clips/idle.json',+ jump: '/animations/clips/jumpdown.json',+ wave: '/animations/clips/wave.json',+ sit: '/animations/clips/sitidle.json',+ });+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.sit.setLoop(THREE.LoopRepeat, Infinity);+ A.jump.setLoop(THREE.LoopOnce, 1); A.jump.clampWhenFinished = true;+ A.wave.setLoop(THREE.LoopOnce, 1); A.wave.clampWhenFinished = true;++ // Candidate targets: every button + link + 'data-target' span.+ const TARGETS = [...document.querySelectorAll('a.btn, a[data-target]')];++ let current = A.idle, pose = 'idle';+ A.idle.play();++ let dest = null, dwellUntil = 0, lastMoveAt = performance.now();+ let posWorld = stage.domToWorld(window.innerWidth * 0.7, window.innerHeight * 0.5);+ avatar.position.set(posWorld.x, posWorld.y, 0);++ function switchTo(name, fade = 0.25) {+ const next = A[name];+ if (!next || next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next; pose = name;+ }++ function nearestTarget(mx, my) {+ let best = null, bestD = Infinity;+ for (const el of TARGETS) {+ const r = el.getBoundingClientRect();+ const cx = r.left + r.width / 2;+ const cy = r.top + r.height / 2;+ const d = Math.hypot(mx - cx, my - cy);+ if (d < bestD) { bestD = d; best = el; }+ }+ return best;+ }++ window.addEventListener('mousemove', (e) => {+ lastMoveAt = performance.now();+ const t = nearestTarget(e.clientX, e.clientY);+ if (!t) return;+ const r = t.getBoundingClientRect();+ dest = stage.domToWorld(r.left + r.width / 2, r.top - 8);+ });++ // Sequence: when avatar reaches dest, play a one-shot reaction.+ let traveling = false, fromW = null, toW = null, tStart = 0, dur = 0;++ function startTravel(target) {+ fromW = { x: avatar.position.x, y: avatar.position.y };+ toW = target;+ const distPx = Math.hypot(fromW.x - toW.x, fromW.y - toW.y) * PX_PER_UNIT;+ dur = Math.max(0.45, Math.min(1.2, distPx / 700));+ tStart = performance.now();+ traveling = true;+ switchTo('jump');+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ const now = performance.now();+ const idleMs = now - lastMoveAt;++ // Idle-out: 3.5s no movement → sit; movement resumes → stand back to idle.+ if (idleMs > 3500 && pose !== 'sit' && !traveling) switchTo('sit', 0.4);+ if (idleMs < 200 && pose === 'sit') switchTo('idle', 0.25);++ // Begin travel if dest moved and avatar is close to rest.+ if (dest && !traveling) {+ const dx = (dest.x - avatar.position.x) * PX_PER_UNIT;+ const dy = (dest.y - avatar.position.y) * PX_PER_UNIT;+ if (Math.hypot(dx, dy) > 30) startTravel(dest);+ }++ if (traveling) {+ const p = Math.min((now - tStart) / 1000 / dur, 1);+ const e = smoothstep(p);+ const arc = 0.45 * 4 * p * (1 - p);+ avatar.position.x = fromW.x + (toW.x - fromW.x) * e;+ avatar.position.y = fromW.y + (toW.y - fromW.y) * e + arc;+ avatar.rotation.y = Math.sin(Math.PI * p) * 0.15 * Math.sign(toW.x - fromW.x);+ if (p >= 1) {+ avatar.rotation.y = 0;+ traveling = false;+ dwellUntil = now + 250;+ switchTo('idle', 0.2);+ }+ } else if (pose === 'idle' && now > dwellUntil && Math.random() < 0.005) {+ switchTo('wave', 0.25);+ setTimeout(() => { if (pose === 'wave') switchTo('idle', 0.3); }, 1800);+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/fall-from-top.html b/public/demos/agents/fall-from-top.htmlnew file mode 100644index 000000000..6e1dc0b86--- /dev/null+++ b/public/demos/agents/fall-from-top.html@@ -0,0 +1,109 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Fall from above — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Fall from off-canvas</div>+ <h1 class="hero-title">She drops in <em>uninvited</em>.</h1>+ <p class="hero-sub">+ Page loads, gravity engages, she falls past the nav and crashes+ onto the CTA — splash, squish, then composes herself.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary" id="cta-btn"><span>Catch me</span><span>↓</span></a>+ <button class="btn btn-ghost" id="redrop"><span>Drop again</span></button>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">click "drop again" to re-enter</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ PX_PER_UNIT, fireSplash, fireShockwave, fireSquish,+ mountChrome,+ } from './_lib.js';++ mountChrome('Fall from off-canvas');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const redrop = document.getElementById('redrop');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ falling: '/animations/clips/falling.json',+ land: '/animations/clips/falltolanding.json',+ idle: '/animations/clips/idle.json',+ });+ A.falling.setLoop(THREE.LoopRepeat, Infinity);+ A.land.setLoop(THREE.LoopOnce, 1); A.land.clampWhenFinished = true;+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ let current = null;++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ if (current) next.crossFadeFrom(current, fade, false);+ next.play();+ current = next;+ }++ let physVy = 0, physVx = 0;+ let phase = 'idle';+ const GRAVITY = 18;++ function targetWorld() {+ const r = ctaBtn.getBoundingClientRect();+ return stage.domToWorld(r.left + r.width / 2, r.top);+ }++ function startFall() {+ const t = targetWorld();+ // Spawn above the viewport, slightly off-center.+ const top = stage.domToWorld(0, -120);+ avatar.position.set(t.x, top.y, 0);+ avatar.rotation.set(0, 0, 0);+ physVy = -2.5; // initial downward push+ physVx = 0;+ phase = 'falling';+ switchTo(A.falling, 0.05);+ }++ startFall();+ redrop.addEventListener('click', startFall);++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ if (phase !== 'falling') return;+ physVy -= GRAVITY * dt;+ avatar.position.y += physVy * dt;+ avatar.rotation.z += dt * 1.2; // slow tumble+ const t = targetWorld();+ if (avatar.position.y <= t.y) {+ avatar.position.y = t.y;+ avatar.position.x = t.x;+ avatar.rotation.set(0, 0, 0);+ phase = 'landed';+ switchTo(A.land, 0.05);+ const r = ctaBtn.getBoundingClientRect();+ const ix = r.left + r.width / 2;+ const iy = r.top;+ fireSplash(ix, iy, { count: 26 });+ fireShockwave(ix, iy, { size: 30, max: 220 });+ fireSquish(ctaBtn, { scaleY: 0.6 });+ setTimeout(() => switchTo(A.idle, 0.5), 1200);+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/falls-asleep.html b/public/demos/agents/falls-asleep.htmlnew file mode 100644index 000000000..f82dd9afa--- /dev/null+++ b/public/demos/agents/falls-asleep.html@@ -0,0 +1,130 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Falls asleep — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ .zzz {+ position: fixed; pointer-events: none; z-index: 25;+ font: 700 24px/1 'Space Grotesk','Inter',sans-serif;+ color: #d6ff3d; text-shadow: 0 0 12px rgba(214,255,61,0.6);+ will-change: transform, opacity;+ }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Falls asleep on the text</div>+ <h1 class="hero-title"><span id="sleep-line">Give your AI</span> a <em>body.</em></h1>+ <p class="hero-sub">+ She'll sit on the headline. Don't move the cursor for 6 seconds and+ she nods off — Zzz drift up. Move closer and she startles awake.+ </p>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">stay still for 6 seconds</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ clamp, mountChrome,+ } from './_lib.js';++ mountChrome('Falls asleep on the text');++ const canvas = document.getElementById('avatar-canvas');+ const sleepLine = document.getElementById('sleep-line');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ sit: '/animations/clips/sitidle.json',+ down: '/animations/clips/downdog.json',+ reaction:'/animations/clips/reaction.json',+ });+ A.sit.setLoop(THREE.LoopRepeat, Infinity);+ A.down.setLoop(THREE.LoopRepeat, Infinity);+ A.reaction.setLoop(THREE.LoopOnce, 1); A.reaction.clampWhenFinished = true;+ A.sit.play();+ let current = A.sit;++ function sitOn() {+ const r = sleepLine.getBoundingClientRect();+ return stage.domToWorld(r.right - r.height * 0.4, r.top + 120);+ }+ let home = sitOn();+ avatar.position.set(home.x, home.y, 0);+ window.addEventListener('resize', () => { home = sitOn(); });++ function switchTo(next, fade = 0.4) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ let lastMoveAt = performance.now();+ let mouseScreen = { x: -9999, y: -9999 };+ let asleep = false;+ let zzzT0 = 0;+ window.addEventListener('mousemove', (e) => {+ lastMoveAt = performance.now();+ mouseScreen.x = e.clientX; mouseScreen.y = e.clientY;+ if (asleep) {+ const proj = new THREE.Vector3(avatar.position.x, avatar.position.y, 0).project(stage.camera);+ const ax = (proj.x + 1) * 0.5 * window.innerWidth;+ const ay = (1 - (proj.y + 1) * 0.5) * window.innerHeight;+ if (Math.hypot(e.clientX - ax, e.clientY - ay) < 240) {+ asleep = false;+ switchTo(A.reaction, 0.1);+ setTimeout(() => switchTo(A.sit, 0.5), 900);+ }+ }+ });++ function spawnZzz() {+ const proj = new THREE.Vector3(avatar.position.x, avatar.position.y + 1.0, 0).project(stage.camera);+ const sx = (proj.x + 1) * 0.5 * window.innerWidth;+ const sy = (1 - (proj.y + 1) * 0.5) * window.innerHeight;+ const z = document.createElement('div');+ z.className = 'zzz';+ z.textContent = 'z';+ z.style.left = `${sx}px`;+ z.style.top = `${sy}px`;+ z.style.fontSize = `${16 + Math.random() * 14}px`;+ document.body.appendChild(z);+ z.animate(+ [+ { transform: 'translate(0, 0) rotate(-8deg)', opacity: 0 },+ { transform: `translate(${20 + Math.random() * 20}px, -100px) rotate(8deg)`, opacity: 1, offset: 0.3 },+ { transform: `translate(${40 + Math.random() * 30}px, -180px) rotate(-8deg)`, opacity: 0 },+ ],+ { duration: 2400, easing: 'cubic-bezier(0.4, 0, 0.6, 1)' },+ ).onfinish = () => z.remove();+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ const now = performance.now();+ home = sitOn();+ avatar.position.x = home.x;+ avatar.position.y = home.y;+ const idleMs = now - lastMoveAt;+ if (!asleep && idleMs > 6000) {+ asleep = true;+ switchTo(A.down, 0.7);+ zzzT0 = now;+ }+ if (asleep && now - zzzT0 > 900) {+ spawnZzz();+ zzzT0 = now;+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/high-five.html b/public/demos/agents/high-five.htmlnew file mode 100644index 000000000..a08b26168--- /dev/null+++ b/public/demos/agents/high-five.html@@ -0,0 +1,108 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>High-five — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">High-five reach</div>+ <h1 class="hero-title">Bring your <em>hand</em> close.</h1>+ <p class="hero-sub">+ She tracks the cursor's distance and leans toward it as you near+ her. Click within reach to high-five — the button claps back.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary" id="cta-btn"><span>Slap me</span><span>✋</span></a>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">move closer to the agent</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ PX_PER_UNIT, clamp, fireShockwave, fireSquish, fireSplash,+ mountChrome,+ } from './_lib.js';++ mountChrome('High-five reach');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ idle: '/animations/clips/idle.json',+ wave: '/animations/clips/wave.json',+ cheer: '/animations/clips/celebrate.json',+ });+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.wave.setLoop(THREE.LoopOnce, 1); A.wave.clampWhenFinished = true;+ A.cheer.setLoop(THREE.LoopOnce, 1); A.cheer.clampWhenFinished = true;+ A.idle.play();+ let current = A.idle;++ // Anchor avatar above and right of the button — within reach.+ function anchor() {+ const r = ctaBtn.getBoundingClientRect();+ return stage.domToWorld(r.right + 140, r.top - 40);+ }+ let home = anchor();+ avatar.position.set(home.x, home.y, 0);+ window.addEventListener('resize', () => { home = anchor(); });++ let mouseScreen = { x: -9999, y: -9999 };+ window.addEventListener('mousemove', (e) => {+ mouseScreen.x = e.clientX; mouseScreen.y = e.clientY;+ });++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ ctaBtn.addEventListener('click', (e) => {+ const r = ctaBtn.getBoundingClientRect();+ fireShockwave(r.left + r.width / 2, r.top + r.height / 2, { size: 30, max: 200 });+ fireSplash(r.left + r.width / 2, r.top, { count: 24 });+ fireSquish(ctaBtn);+ switchTo(A.cheer);+ setTimeout(() => switchTo(A.idle, 0.4), 1800);+ });++ const REACH_PX = 360;++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ // Distance from cursor to avatar in screen px.+ const proj = new THREE.Vector3(avatar.position.x, avatar.position.y, 0).project(stage.camera);+ const ax = (proj.x + 1) * 0.5 * window.innerWidth;+ const ay = (1 - (proj.y + 1) * 0.5) * window.innerHeight;+ const d = Math.hypot(mouseScreen.x - ax, mouseScreen.y - ay);+ const prox = 1 - clamp(d / REACH_PX, 0, 1);++ // Lean toward cursor — small XY world offset from home position.+ const dirX = (mouseScreen.x - ax) / Math.max(1, d);+ const dirY = (mouseScreen.y - ay) / Math.max(1, d);+ const leanX = dirX * prox * 0.35;+ const leanY = -dirY * prox * 0.25;+ avatar.position.x += (home.x + leanX - avatar.position.x) * Math.min(1, dt * 8);+ avatar.position.y += (home.y + leanY - avatar.position.y) * Math.min(1, dt * 8);+ avatar.rotation.z = -prox * dirX * 0.15;++ // Within slap range → wave, otherwise idle.+ if (prox > 0.55 && current !== A.wave && current !== A.cheer) switchTo(A.wave, 0.2);+ else if (prox < 0.35 && current === A.wave) switchTo(A.idle, 0.3);+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/holds-cta.html b/public/demos/agents/holds-cta.htmlnew file mode 100644index 000000000..059a3f1e8--- /dev/null+++ b/public/demos/agents/holds-cta.html@@ -0,0 +1,112 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Holds the CTA — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ #cta-btn { will-change: transform; transition: transform 0.18s cubic-bezier(0.16,1,0.3,1); }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Holds the CTA up</div>+ <h1 class="hero-title">She's <em>working</em> for you.</h1>+ <p class="hero-sub">+ A second agent crouches under the button, holding it up. Hover the+ CTA and she struggles; click and she drops it.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary" id="cta-btn"><span>Build your agent — free</span><span>→</span></a>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">hover the CTA</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ fireSplash, fireShockwave, mountChrome,+ } from './_lib.js';++ mountChrome('Holds the CTA up');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ pray: '/animations/clips/pray.json',+ idle: '/animations/clips/idle.json',+ defeated: '/animations/clips/defeated.json',+ });+ A.pray.setLoop(THREE.LoopRepeat, Infinity);+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.defeated.setLoop(THREE.LoopOnce, 1); A.defeated.clampWhenFinished = true;+ A.pray.play();+ let current = A.pray;++ function under() {+ const r = ctaBtn.getBoundingClientRect();+ return stage.domToWorld(r.left + r.width / 2, r.bottom + 100);+ }+ let home = under();+ avatar.position.set(home.x, home.y, 0);+ window.addEventListener('resize', () => { home = under(); });++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ let strain = 0; // 0..1 — how hard she's straining+ let dropped = false;++ ctaBtn.addEventListener('mouseenter', () => { strain = 1; });+ ctaBtn.addEventListener('mouseleave', () => { strain = 0; });+ ctaBtn.addEventListener('click', (e) => {+ e.preventDefault();+ if (dropped) return;+ dropped = true;+ // Button thuds down 50px, she collapses.+ ctaBtn.style.transform = 'translateY(40px) rotate(-3deg)';+ ctaBtn.style.boxShadow = '0 2px 0 0 #7a9600, 0 4px 14px rgba(214,255,61,0.18)';+ switchTo(A.defeated, 0.15);+ const r = ctaBtn.getBoundingClientRect();+ fireSplash(r.left + r.width / 2, r.bottom, { count: 22, color: 'gold' });+ fireShockwave(r.left + r.width / 2, r.bottom, { size: 28, max: 180, color: '#ffd23d' });+ setTimeout(() => {+ ctaBtn.style.transform = '';+ ctaBtn.style.boxShadow = '';+ dropped = false;+ switchTo(A.pray, 0.4);+ }, 2400);+ });++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ home = under();+ avatar.position.x = home.x;+ avatar.position.y = home.y;+ // Wobble harder when strained.+ const t = performance.now() / 1000;+ const wob = Math.sin(t * (5 + strain * 8)) * (0.012 + strain * 0.05);+ avatar.position.y += wob;+ avatar.rotation.z = Math.sin(t * (6 + strain * 6)) * (strain * 0.08);+ // Mirror small strain wobble onto the button.+ if (!dropped) {+ const bx = Math.sin(t * 14) * strain * 1.5;+ const by = Math.sin(t * 11) * strain * 2;+ ctaBtn.style.transform = `translate(${bx.toFixed(1)}px, ${by.toFixed(1)}px)`;+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/index.html b/public/demos/agents/index.htmlnew file mode 100644index 000000000..6dadbc1a7--- /dev/null+++ b/public/demos/agents/index.html@@ -0,0 +1,177 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>three.ws — Agent interaction lab</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ body { display: block; }+ .lab {+ max-width: 1100px; margin: 0 auto;+ padding: 90px 32px 80px;+ }+ .lab-eyebrow {+ color: #d6ff3d; font: 600 12px/1 'Space Grotesk','Inter',sans-serif;+ letter-spacing: 0.18em; text-transform: uppercase; margin: 0 0 14px;+ }+ .lab-title {+ font-family: 'Space Grotesk','Inter',sans-serif;+ font-size: clamp(38px, 4.5vw, 56px); font-weight: 800;+ letter-spacing: -0.03em; line-height: 1.04; margin: 0 0 18px;+ }+ .lab-sub {+ color: #6c7088; max-width: 60ch; margin: 0 0 56px;+ font-size: 16px; line-height: 1.7;+ }+ .group {+ display: grid; grid-template-columns: 220px 1fr; gap: 32px;+ padding: 32px 0; border-top: 1px solid rgba(255,255,255,0.05);+ }+ .group:last-child { border-bottom: 1px solid rgba(255,255,255,0.05); }+ .group-name {+ font: 600 12px/1.3 'Space Grotesk','Inter',sans-serif;+ letter-spacing: 0.16em; text-transform: uppercase; color: #d6ff3d;+ }+ .group-name span { display: block; color: #555870; margin-top: 6px; font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 13px; line-height: 1.6; }+ .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }+ .card {+ display: block; padding: 18px 18px 16px;+ border-radius: 14px;+ background: #0c0e16;+ border: 1.5px solid rgba(255,255,255,0.06);+ text-decoration: none; color: inherit;+ transition: transform 0.15s, border-color 0.15s, background 0.15s;+ }+ .card:hover {+ transform: translateY(-2px);+ border-color: rgba(214,255,61,0.4);+ background: #11141e;+ }+ .card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; letter-spacing: -0.005em; color: #fff; }+ .card p { margin: 0; color: #6c7088; font-size: 12.5px; line-height: 1.55; }+ .card .ico { font-size: 22px; margin-bottom: 8px; }+ @media (max-width: 720px) {+ .group { grid-template-columns: 1fr; gap: 12px; }+ }+ </style>+ </head>+ <body>+ <div class="agents-nav">+ <a href="/demos/" class="agents-back">← lab</a>+ <span class="agents-title">Agent interactions</span>+ </div>++ <main class="lab">+ <p class="lab-eyebrow">three.ws · lab</p>+ <h1 class="lab-title">Agent interactions</h1>+ <p class="lab-sub">+ Fourteen prototypes exploring how a 3D agent can physically inhabit+ the page. Gravity is real, page elements are the playground, the+ agent reacts to your intent. Click into any one to play.+ </p>++ <section class="group">+ <div class="group-name">Cursor-driven<span>The agent responds directly to where you point and click.</span></div>+ <div class="cards">+ <a class="card" href="/demos/agents/cursor-follower.html">+ <div class="ico">🖱️</div>+ <h3>Cursor follower</h3>+ <p>Hops between elements you hover. Sits and yawns when idle.</p>+ </a>+ <a class="card" href="/demos/agents/high-five.html">+ <div class="ico">✋</div>+ <h3>High-five reach</h3>+ <p>Extends a hand as the cursor enters her space. Click to slap.</p>+ </a>+ <a class="card" href="/demos/agents/pickup-drop.html">+ <div class="ico">🤏</div>+ <h3>Pickup & drop</h3>+ <p>Click-drag her around. She lands with a splash and squish.</p>+ </a>+ </div>+ </section>++ <section class="group">+ <div class="group-name">Gravity / impact<span>Extends the jump-down with new entrances and bounces.</span></div>+ <div class="cards">+ <a class="card" href="/demos/agents/fall-from-top.html">+ <div class="ico">⬇️</div>+ <h3>Fall from off-canvas</h3>+ <p>Drops from above the nav, ragdoll-lands near the CTA.</p>+ </a>+ <a class="card" href="/demos/agents/trampoline.html">+ <div class="ico">🛏️</div>+ <h3>Trampoline mode</h3>+ <p>CTA bounces her four times, each peak higher than the last.</p>+ </a>+ <a class="card" href="/demos/agents/wrecking-ball.html">+ <div class="ico">🪨</div>+ <h3>Wrecking-ball entrance</h3>+ <p>Swings in on a rope from the right margin and knocks the CTA.</p>+ </a>+ </div>+ </section>++ <section class="group">+ <div class="group-name">Page-as-playground<span>The text and layout are her climbing frame.</span></div>+ <div class="cards">+ <a class="card" href="/demos/agents/climb-title.html">+ <div class="ico">🧗</div>+ <h3>Climbs the title</h3>+ <p>Scales the letterforms of the hero like a rope-climber.</p>+ </a>+ <a class="card" href="/demos/agents/skateboard.html">+ <div class="ico">🛹</div>+ <h3>Skateboards the descender</h3>+ <p>Uses the <em>y</em> of "body" as a ramp toward the CTA.</p>+ </a>+ <a class="card" href="/demos/agents/sit-in-body.html">+ <div class="ico">🪟</div>+ <h3>Sits inside "body"</h3>+ <p>Curls up in the counter of the lowercase o, peers out.</p>+ </a>+ </div>+ </section>++ <section class="group">+ <div class="group-name">Scroll-driven<span>She responds to the page moving underneath her.</span></div>+ <div class="cards">+ <a class="card" href="/demos/agents/scroll-inertia.html">+ <div class="ico">🌀</div>+ <h3>Scroll inertia</h3>+ <p>Fast scroll throws her; she catches the edge and recovers.</p>+ </a>+ <a class="card" href="/demos/agents/walks-gutter.html">+ <div class="ico">🚶♀️</div>+ <h3>Walks the gutter</h3>+ <p>Strolls alongside the column at the same speed as scroll.</p>+ </a>+ </div>+ </section>++ <section class="group">+ <div class="group-name">Multi-agent & UI gags<span>Two agents in the page, or one breaking the fourth wall.</span></div>+ <div class="cards">+ <a class="card" href="/demos/agents/holds-cta.html">+ <div class="ico">🏋️♀️</div>+ <h3>Holds the CTA up</h3>+ <p>Second agent crouches under the button, strains on hover.</p>+ </a>+ <a class="card" href="/demos/agents/falls-asleep.html">+ <div class="ico">💤</div>+ <h3>Falls asleep on text</h3>+ <p>Lays across "Give your AI", snores; cursor wakes her.</p>+ </a>+ <a class="card" href="/demos/agents/builds-button.html">+ <div class="ico">🧱</div>+ <h3>Builds the button</h3>+ <p>Assembles the CTA from blocks she carries in.</p>+ </a>+ </div>+ </section>+ </main>+ </body>+</html>diff --git a/public/demos/agents/pickup-drop.html b/public/demos/agents/pickup-drop.htmlnew file mode 100644index 000000000..465caf897--- /dev/null+++ b/public/demos/agents/pickup-drop.html@@ -0,0 +1,132 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Pickup & drop — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ #avatar-canvas { pointer-events: auto; cursor: grab; }+ #avatar-canvas.dragging { cursor: grabbing; }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Pickup & drop</div>+ <h1 class="hero-title">Pick her <em>up</em>.</h1>+ <p class="hero-sub">+ Click and drag her anywhere on the page. Release her and gravity+ takes over — she falls, splashes on landing, then stands up.+ </p>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">click + drag her body</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ PX_PER_UNIT, fireSplash, fireShockwave,+ mountChrome,+ } from './_lib.js';++ mountChrome('Pickup & drop');++ const canvas = document.getElementById('avatar-canvas');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ idle: '/animations/clips/idle.json',+ falling: '/animations/clips/falling.json',+ land: '/animations/clips/falltolanding.json',+ });+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.falling.setLoop(THREE.LoopRepeat, Infinity);+ A.land.setLoop(THREE.LoopOnce, 1); A.land.clampWhenFinished = true;+ A.idle.play();+ let current = A.idle;++ function place(sx, sy) {+ const w = stage.domToWorld(sx, sy);+ avatar.position.set(w.x, w.y, 0);+ }+ place(window.innerWidth * 0.65, window.innerHeight * 0.55);++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ // Drag state+ let dragging = false;+ let velX = 0, velY = 0; // px/s, computed from drag deltas+ let lastDragX = 0, lastDragY = 0, lastDragT = 0;++ canvas.addEventListener('pointerdown', (e) => {+ dragging = true;+ canvas.classList.add('dragging');+ canvas.setPointerCapture(e.pointerId);+ lastDragX = e.clientX; lastDragY = e.clientY; lastDragT = performance.now();+ velX = 0; velY = 0;+ place(e.clientX, e.clientY);+ switchTo(A.falling, 0.2);+ });+ canvas.addEventListener('pointermove', (e) => {+ if (!dragging) return;+ const now = performance.now();+ const dt = Math.max(0.001, (now - lastDragT) / 1000);+ velX = (e.clientX - lastDragX) / dt;+ velY = (e.clientY - lastDragY) / dt;+ lastDragX = e.clientX; lastDragY = e.clientY; lastDragT = now;+ place(e.clientX, e.clientY);+ });+ canvas.addEventListener('pointerup', () => {+ if (!dragging) return;+ dragging = false;+ canvas.classList.remove('dragging');+ // Convert toss velocity from px/s to world units/s.+ physVx = velX / PX_PER_UNIT;+ physVy = -velY / PX_PER_UNIT; // screen y → world y inverted+ falling = true;+ });++ // Gravity physics (only when not being dragged).+ let falling = false, physVx = 0, physVy = 0;+ const GRAVITY = 9; // world units/s² (looks chunky like the page)++ // Ground line = bottom 18% of viewport, in world coords.+ function groundY() {+ return stage.domToWorld(0, window.innerHeight * 0.82).y;+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ if (falling) {+ physVy -= GRAVITY * dt;+ avatar.position.x += physVx * dt;+ avatar.position.y += physVy * dt;+ avatar.rotation.z += physVx * dt * 0.6;+ const gy = groundY();+ if (avatar.position.y <= gy) {+ // Impact+ avatar.position.y = gy;+ falling = false;+ avatar.rotation.z = 0;+ const proj = new THREE.Vector3(avatar.position.x, avatar.position.y, 0).project(stage.camera);+ const ix = (proj.x + 1) * 0.5 * window.innerWidth;+ const iy = (1 - (proj.y + 1) * 0.5) * window.innerHeight;+ fireSplash(ix, iy, { count: 22 });+ fireShockwave(ix, iy, { size: 30, max: 180 });+ switchTo(A.land, 0.1);+ setTimeout(() => switchTo(A.idle, 0.5), 900);+ }+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/scroll-inertia.html b/public/demos/agents/scroll-inertia.htmlnew file mode 100644index 000000000..ff8069b83--- /dev/null+++ b/public/demos/agents/scroll-inertia.html@@ -0,0 +1,118 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Scroll inertia — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ body { overflow-y: scroll; }+ .long {+ max-width: 560px; margin: 0 auto;+ padding: 110px 32px 110px;+ }+ .long h2 { font: 700 28px/1.2 'Space Grotesk','Inter',sans-serif; margin: 80px 0 18px; }+ .long p { color: #555870; margin: 0 0 24px; font-size: 15px; line-height: 1.7; }+ .spacer { height: 80vh; }+ </style>+ </head>+ <body>+ <main class="long">+ <div class="hero-eyebrow">Scroll inertia</div>+ <h1 class="hero-title">Scroll <em>fast</em>.</h1>+ <p>She gets thrown when the page accelerates, catches the edge of a heading, and recovers when you settle.</p>++ <div class="spacer"></div>++ <h2>A long section</h2>+ <p>Just keep scrolling. The faster you fling the page, the more she struggles to hold on.</p>+ <p>When you stop, she eases back to her seat.</p>++ <div class="spacer"></div>++ <h2>Another section</h2>+ <p>Try a sharp flick and then a slow drift.</p>++ <div class="spacer"></div>++ <h2>End of page</h2>+ <p>You're done. Scroll up and feel her pull the other way.</p>+ </main>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">scroll fast — fling her</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ clamp, mountChrome,+ } from './_lib.js';++ mountChrome('Scroll inertia');++ const canvas = document.getElementById('avatar-canvas');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ idle: '/animations/clips/idle.json',+ falling: '/animations/clips/falling.json',+ dodge: '/animations/clips/dodge.json',+ });+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.falling.setLoop(THREE.LoopRepeat, Infinity);+ A.dodge.setLoop(THREE.LoopOnce, 1); A.dodge.clampWhenFinished = true;+ A.idle.play();+ let current = A.idle;++ // Anchor to the right side, vertically center.+ function homeWorld() {+ return stage.domToWorld(window.innerWidth * 0.78, window.innerHeight * 0.5);+ }+ let home = homeWorld();+ avatar.position.set(home.x, home.y, 0);++ let displaceY = 0, velY = 0;+ let lastScroll = window.scrollY, lastT = performance.now();++ window.addEventListener('scroll', () => {+ const now = performance.now();+ const dt = Math.max(0.001, (now - lastT) / 1000);+ const dy = window.scrollY - lastScroll;+ lastScroll = window.scrollY;+ lastT = now;+ // Add scroll velocity to displacement (in world units).+ // Positive scroll-down → world Y pushed downward (she lags up).+ velY += (dy / dt) / 800;+ });++ function switchTo(next, fade = 0.2) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ // Spring back to home with damped oscillation.+ const springK = 18;+ const damping = 6;+ const accel = -displaceY * springK - velY * damping;+ velY += accel * dt;+ displaceY += velY * dt;++ home = homeWorld();+ avatar.position.x = home.x;+ avatar.position.y = home.y + displaceY;+ avatar.rotation.z = clamp(velY * -0.05, -0.4, 0.4);++ const speed = Math.abs(velY);+ if (speed > 1.6 && current !== A.falling) switchTo(A.falling, 0.15);+ else if (speed < 0.4 && current === A.falling) switchTo(A.idle, 0.4);+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/sit-in-body.html b/public/demos/agents/sit-in-body.htmlnew file mode 100644index 000000000..91ec4c442--- /dev/null+++ b/public/demos/agents/sit-in-body.html@@ -0,0 +1,90 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Sits inside "body" — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ .body-word { display: inline-block; position: relative; }+ .body-letter { display: inline-block; position: relative; }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Sits inside "body"</div>+ <h1 class="hero-title">Give your AI a <em><span class="body-word"><span class="body-letter">b</span><span class="body-letter" id="o-letter">o</span><span class="body-letter">d</span><span class="body-letter">y</span></span></em>.</h1>+ <p class="hero-sub">+ She makes herself at home in the round counter of the lowercase+ <em>o</em>, peeking out and ducking back in every few seconds.+ </p>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">watch the o</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ smoothstep, mountChrome,+ } from './_lib.js';++ mountChrome('Sits inside "body"');++ const canvas = document.getElementById('avatar-canvas');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ // Shrink so she fits inside the letter.+ avatar.scale.setScalar(0.35);++ const A = await loadClips(mixer, {+ sit: '/animations/clips/sitidle.json',+ wave: '/animations/clips/wave.json',+ });+ A.sit.setLoop(THREE.LoopRepeat, Infinity);+ A.wave.setLoop(THREE.LoopOnce, 1); A.wave.clampWhenFinished = true;+ A.sit.play();+ let current = A.sit;++ const oLetter = document.getElementById('o-letter');+ function oCenter() {+ const r = oLetter.getBoundingClientRect();+ return stage.domToWorld(r.left + r.width / 2, r.top + r.height * 0.65);+ }+ let home = oCenter();+ avatar.position.set(home.x, home.y, 0);+ window.addEventListener('resize', () => { home = oCenter(); avatar.position.set(home.x, home.y, 0); });++ function switchTo(next, fade = 0.3) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ // Periodically peek up out of the o.+ let peekT0 = performance.now() + 1800;+ let peekUntil = 0;++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ home = oCenter();+ const now = performance.now();+ if (now > peekT0 && now > peekUntil) {+ peekUntil = now + 2000;+ peekT0 = now + 4500 + Math.random() * 3000;+ switchTo(A.wave, 0.2);+ setTimeout(() => switchTo(A.sit, 0.4), 1700);+ }+ // Smooth follow of layout shifts.+ const lerp = 0.12;+ const targetY = home.y + (now < peekUntil ? 0.18 : 0);+ avatar.position.x += (home.x - avatar.position.x) * lerp;+ avatar.position.y += (targetY - avatar.position.y) * lerp;+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/skateboard.html b/public/demos/agents/skateboard.htmlnew file mode 100644index 000000000..437051bd7--- /dev/null+++ b/public/demos/agents/skateboard.html@@ -0,0 +1,159 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Skateboard — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ .hero-title em { position: relative; }+ .descender { display: inline-block; position: relative; }+ .descender::after {+ content: '';+ position: absolute;+ left: 0; right: 0; bottom: 0;+ height: 2px;+ background: linear-gradient(90deg, transparent, rgba(214,255,61,0.4));+ }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Skateboards the descender</div>+ <h1 class="hero-title">Give your AI a <em><span class="descender" id="ramp">body</span></em>.</h1>+ <p class="hero-sub">+ She rides the descender of "<em>y</em>" like a quarter-pipe and+ launches into the CTA.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary" id="cta-btn"><span>Catch the landing</span><span>→</span></a>+ <button class="btn btn-ghost" id="restart"><span>Drop in again</span></button>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">click "drop in again"</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ smoothstep, fireSplash, fireSquish, fireShockwave,+ mountChrome,+ } from './_lib.js';++ mountChrome('Skateboards the descender');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const restart= document.getElementById('restart');+ const ramp = document.getElementById('ramp');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ idle: '/animations/clips/idle.json',+ jump: '/animations/clips/jump.json',+ cheer: '/animations/clips/celebrate.json',+ });+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.jump.setLoop(THREE.LoopOnce, 1); A.jump.clampWhenFinished = true;+ A.cheer.setLoop(THREE.LoopOnce, 1); A.cheer.clampWhenFinished = true;+ A.idle.play();+ let current = A.idle;++ // Skateboard plane under her feet.+ const boardGeo = new THREE.BoxGeometry(0.7, 0.07, 0.28);+ const boardMat = new THREE.MeshStandardMaterial({ color: 0xd6ff3d, roughness: 0.5 });+ const board = new THREE.Mesh(boardGeo, boardMat);+ board.visible = false;+ stage.scene.add(board);++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ function rampPath() {+ // Three checkpoints: top of descender → bottom of descender → CTA top.+ const r1 = ramp.getBoundingClientRect();+ const r2 = ctaBtn.getBoundingClientRect();+ return {+ top: stage.domToWorld(r1.left + 8, r1.top + 4),+ bottom: stage.domToWorld(r1.left + 14, r1.bottom - 6),+ launch: stage.domToWorld(r1.right - 4, r1.bottom - 26),+ land: stage.domToWorld(r2.left + r2.width / 2, r2.top),+ };+ }++ let phase = 'idle', t0 = 0, fromW = null, toW = null;+ let leg = 0;++ function startRun() {+ const p = rampPath();+ avatar.position.set(p.top.x, p.top.y, 0);+ board.position.set(p.top.x, p.top.y - 0.02, 0.05);+ board.visible = true;+ switchTo(A.idle, 0.2);+ leg = 0;+ goTo(p.top, p.bottom, 0.6);+ }++ function goTo(from, to, dur) {+ fromW = from; toW = to;+ phase = 'travel'; t0 = performance.now();+ this_dur = dur;+ }+ let this_dur = 0.5;++ restart.addEventListener('click', startRun);+ startRun();++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ if (phase !== 'travel') return;+ const p = Math.min((performance.now() - t0) / 1000 / this_dur, 1);+ const e = smoothstep(p);+ // curve down the ramp: pull X further along by easing in+ const x = fromW.x + (toW.x - fromW.x) * e;+ let y;+ if (leg === 0) {+ // Sliding down — accelerate.+ y = fromW.y + (toW.y - fromW.y) * (e * e);+ } else if (leg === 1) {+ // Launch arc — peak rises then falls.+ const arc = 0.5 * 4 * p * (1 - p);+ y = fromW.y + (toW.y - fromW.y) * e + arc;+ } else {+ y = fromW.y + (toW.y - fromW.y) * e;+ }+ avatar.position.x = x;+ avatar.position.y = y;+ if (leg < 2) board.position.set(x, y - 0.02, 0.05);+ else board.visible = false;+ avatar.rotation.z = leg === 1 ? Math.sin(Math.PI * p) * 0.25 : 0;++ if (p >= 1) {+ const path = rampPath();+ if (leg === 0) {+ leg = 1; goTo(path.bottom, path.launch, 0.18);+ } else if (leg === 1) {+ leg = 2;+ switchTo(A.jump, 0.1);+ goTo(path.launch, path.land, 0.7);+ } else {+ const r = ctaBtn.getBoundingClientRect();+ fireSplash(r.left + r.width / 2, r.top, { count: 26 });+ fireShockwave(r.left + r.width / 2, r.top, { size: 32, max: 200 });+ fireSquish(ctaBtn);+ switchTo(A.cheer, 0.2);+ phase = 'done';+ }+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/trampoline.html b/public/demos/agents/trampoline.htmlnew file mode 100644index 000000000..2fa5343b7--- /dev/null+++ b/public/demos/agents/trampoline.html@@ -0,0 +1,121 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Trampoline — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Trampoline mode</div>+ <h1 class="hero-title">The CTA <em>bounces</em>.</h1>+ <p class="hero-sub">+ She lands on the button and it springs her back up — four bounces,+ each peak higher than the last. Confetti on the top bounce.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary" id="cta-btn"><span>Bounce me</span><span>⤴</span></a>+ <button class="btn btn-ghost" id="restart"><span>Restart</span></button>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">click "restart" to bounce again</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ fireSplash, fireSquish, fireShockwave,+ mountChrome,+ } from './_lib.js';++ mountChrome('Trampoline mode');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const restart= document.getElementById('restart');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ falling: '/animations/clips/falling.json',+ cheer: '/animations/clips/celebrate.json',+ });+ A.falling.setLoop(THREE.LoopRepeat, Infinity);+ A.cheer.setLoop(THREE.LoopOnce, 1); A.cheer.clampWhenFinished = true;+ A.falling.play();+ let current = A.falling;++ function btnWorld() {+ const r = ctaBtn.getBoundingClientRect();+ return stage.domToWorld(r.left + r.width / 2, r.top);+ }++ // Four bounces with rising peaks (last one is the celebration).+ const PEAKS = [1.4, 1.9, 2.4, 3.0]; // world units above button+ const FALL_S = [0.35, 0.4, 0.45, 0.6]; // down half-duration++ let bounceIdx = 0, t0 = 0, downDur = 0, upDur = 0, peakUnit = 0;+ let phase = 'down';++ function startBounce() {+ const tgt = btnWorld();+ peakUnit = PEAKS[bounceIdx];+ downDur = FALL_S[bounceIdx];+ upDur = downDur * 1.4;+ // Start at peak height+ avatar.position.set(tgt.x, tgt.y + peakUnit, 0);+ phase = 'down'; t0 = performance.now();+ }++ function bounceImpact() {+ const r = ctaBtn.getBoundingClientRect();+ const ix = r.left + r.width / 2;+ const iy = r.top;+ fireSplash(ix, iy, { count: 16 + bounceIdx * 4 });+ fireShockwave(ix, iy, { size: 20 + bounceIdx * 6, max: 140 + bounceIdx * 30 });+ fireSquish(ctaBtn, { scaleY: 0.55 - bounceIdx * 0.05 });+ if (bounceIdx === PEAKS.length - 1) {+ // Final big bounce: cheer, confetti everywhere.+ for (let i = 0; i < 4; i++) setTimeout(() => fireSplash(ix, iy, { count: 24, color: ['lime','gold','red','water'][i] }), i * 80);+ A.cheer.reset();+ A.cheer.crossFadeFrom(current, 0.3, false).play();+ current = A.cheer;+ }+ }++ restart.addEventListener('click', () => { bounceIdx = 0; startBounce(); });+ startBounce();++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ const tgt = btnWorld();+ if (phase === 'down') {+ const p = Math.min((performance.now() - t0) / 1000 / downDur, 1);+ const e = p * p; // accelerating fall+ avatar.position.y = (tgt.y + peakUnit) - peakUnit * e;+ avatar.position.x = tgt.x;+ if (p >= 1) {+ bounceImpact();+ phase = 'up'; t0 = performance.now();+ }+ } else if (phase === 'up') {+ const p = Math.min((performance.now() - t0) / 1000 / upDur, 1);+ const e = 1 - (1 - p) * (1 - p); // decelerating rise+ avatar.position.y = tgt.y + peakUnit * e;+ if (p >= 1) {+ if (bounceIdx < PEAKS.length - 1) {+ bounceIdx++;+ startBounce();+ } else {+ phase = 'done';+ }+ }+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/walks-gutter.html b/public/demos/agents/walks-gutter.htmlnew file mode 100644index 000000000..fd910093e--- /dev/null+++ b/public/demos/agents/walks-gutter.html@@ -0,0 +1,110 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Walks the gutter — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ body { overflow-y: scroll; }+ .col { max-width: 540px; margin: 0 auto 0 60px; padding: 110px 32px 200px; }+ .col h2 { font: 700 24px/1.25 'Space Grotesk','Inter',sans-serif; margin: 60px 0 14px; }+ .col p { color: #555870; margin: 0 0 18px; font-size: 15px; line-height: 1.75; }+ </style>+ </head>+ <body>+ <main class="col">+ <div class="hero-eyebrow">Walks the gutter</div>+ <h1 class="hero-title">She walks <em>with</em> you.</h1>+ <p>Scroll the page. She paces in the right-hand gutter at the same speed, slowing when you slow.</p>+ <p>Stop scrolling and she stops with you. Reverse direction and she turns around.</p>+ <h2>Heading two</h2>+ <p>Long-form copy. She keeps pace, her gait sped up or slowed to match.</p>+ <p>The longer the page, the longer the walk.</p>+ <h2>Heading three</h2>+ <p>Halfway down.</p>+ <p>Each section keeps her busy.</p>+ <h2>Heading four</h2>+ <p>Almost there.</p>+ <p>Final stretch — she'll idle at the end.</p>+ <h2>Heading five</h2>+ <p>End of page.</p>+ </main>+ <canvas id="avatar-canvas"></canvas>+ <div class="hint">scroll slowly</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ clamp, mountChrome,+ } from './_lib.js';++ mountChrome('Walks the gutter');++ const canvas = document.getElementById('avatar-canvas');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ walk: '/animations/clips/walk.json',+ idle: '/animations/clips/idle.json',+ });+ A.walk.setLoop(THREE.LoopRepeat, Infinity);+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.idle.play();+ let current = A.idle;++ // Anchor to right gutter, vertically centered in viewport.+ function homeWorld(yOffsetPx = 0) {+ return stage.domToWorld(window.innerWidth - 140, window.innerHeight * 0.55 + yOffsetPx);+ }+ let h = homeWorld(0);+ avatar.position.set(h.x, h.y, 0);++ let lastScroll = window.scrollY, lastT = performance.now();+ let scrollSpeed = 0; // px/s, smoothed+ let walkOffset = 0; // accumulated lateral wander+ let dirX = 1; // facing direction (1 right, -1 left)++ window.addEventListener('scroll', () => {+ const now = performance.now();+ const dt = Math.max(0.001, (now - lastT) / 1000);+ const v = (window.scrollY - lastScroll) / dt;+ lastScroll = window.scrollY;+ lastT = now;+ scrollSpeed = scrollSpeed * 0.7 + v * 0.3;+ });++ function switchTo(next, fade = 0.25) {+ if (next === current) return;+ next.reset();+ next.crossFadeFrom(current, fade, false).play();+ current = next;+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, (dt) => {+ // Decay scroll speed toward 0 if no recent events.+ scrollSpeed *= Math.pow(0.001, dt * 0.5);++ const moving = Math.abs(scrollSpeed) > 25;+ if (moving && current !== A.walk) switchTo(A.walk, 0.2);+ if (!moving && current === A.walk) switchTo(A.idle, 0.3);++ // Pace forward/back as a small horizontal sway in the gutter.+ const pace = clamp(scrollSpeed / 600, -1.5, 1.5);+ walkOffset += pace * dt * 60;+ walkOffset = clamp(walkOffset, -50, 50);+ dirX = pace >= 0 ? 1 : -1;++ h = homeWorld(0);+ avatar.position.x = stage.domToWorld(window.innerWidth - 140 + walkOffset, 0).x;+ avatar.position.y = h.y;+ avatar.rotation.y = dirX < 0 ? Math.PI * 0.18 : -Math.PI * 0.18;+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/agents/wrecking-ball.html b/public/demos/agents/wrecking-ball.htmlnew file mode 100644index 000000000..480dd2e3a--- /dev/null+++ b/public/demos/agents/wrecking-ball.html@@ -0,0 +1,158 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <title>Wrecking ball — three.ws</title>+ <meta name="robots" content="noindex" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/demos/agents/_shared.css" />+ <style>+ .rope {+ position: fixed; pointer-events: none;+ width: 2px; background: rgba(214,255,61,0.5);+ transform-origin: top center; z-index: 25;+ box-shadow: 0 0 6px rgba(214,255,61,0.4);+ }+ </style>+ </head>+ <body>+ <div class="stage">+ <div class="hero-eyebrow">Wrecking-ball entrance</div>+ <h1 class="hero-title">Make an <em>entrance</em>.</h1>+ <p class="hero-sub">+ She swings in from off-canvas on a rope and knocks the ghost button+ sideways. It wobbles, recovers, and she dangles before letting go.+ </p>+ <div class="cta-row">+ <a href="#" class="btn btn-primary"><span>Don't mind her</span><span>→</span></a>+ <a href="#" class="btn btn-ghost" id="cta-btn"><span>Hit this one</span><span>💥</span></a>+ <button class="btn btn-ghost" id="restart" style="margin-top:8px;"><span>Swing again</span></button>+ </div>+ </div>+ <canvas id="avatar-canvas"></canvas>+ <div class="rope" id="rope"></div>+ <div class="hint">click "swing again"</div>++ <script type="module">+ import * as THREE from 'three';+ import {+ createStage, loadAvatar, loadClips, startLoop,+ fireSplash, fireShockwave,+ mountChrome,+ } from './_lib.js';++ mountChrome('Wrecking-ball entrance');++ const canvas = document.getElementById('avatar-canvas');+ const ctaBtn = document.getElementById('cta-btn');+ const restart= document.getElementById('restart');+ const ropeEl = document.getElementById('rope');+ const stage = createStage(canvas);+ const { avatar, mixer, rootBone, baseRootPos } = await loadAvatar();+ stage.scene.add(avatar);++ const A = await loadClips(mixer, {+ falling: '/animations/clips/falling.json',+ idle: '/animations/clips/idle.json',+ });+ A.falling.setLoop(THREE.LoopRepeat, Infinity);+ A.idle.setLoop(THREE.LoopRepeat, Infinity);+ A.falling.play();+ let current = A.falling;++ // Pendulum: pivot at top-right, swings through a 100° arc.+ let phase = 'swing'; // swing → strike → recover → dangle+ let pivotPx = { x: 0, y: 0 };+ let length = 0;+ let t0 = 0;++ function recalc() {+ pivotPx = { x: window.innerWidth * 0.92, y: 60 };+ length = Math.min(window.innerHeight * 0.55, 460);+ }+ recalc();+ window.addEventListener('resize', recalc);++ function ctaCenterPx() {+ const r = ctaBtn.getBoundingClientRect();+ return { x: r.left + r.width / 2, y: r.top + r.height / 2 };+ }++ // Map t∈[0,1] to a swing angle that starts horizontal-right (90°)+ // and decelerates into the strike at impact angle (≈ where the+ // pendulum reaches the CTA).+ function swingAngle(t) {+ const start = -Math.PI / 2 + 0.4; // ~71° right of straight-down+ const end = computeImpactAngle();+ const e = 1 - (1 - t) * (1 - t);+ return start + (end - start) * e;+ }+ function computeImpactAngle() {+ const c = ctaCenterPx();+ const dx = c.x - pivotPx.x;+ const dy = c.y - pivotPx.y;+ return Math.atan2(dx, dy); // angle from straight-down axis+ }++ function startSwing() {+ recalc();+ phase = 'swing'; t0 = performance.now();+ ropeEl.style.display = 'block';+ ctaBtn.style.transition = '';+ ctaBtn.style.transform = '';+ }+ restart.addEventListener('click', startSwing);+ startSwing();++ function setAvatarToPendulum(angle) {+ // Position the agent at the end of the pendulum in screen px.+ const px = pivotPx.x + Math.sin(angle) * length;+ const py = pivotPx.y + Math.cos(angle) * length;+ const w = stage.domToWorld(px, py);+ avatar.position.set(w.x, w.y, 0);+ // Tilt the agent to match the rope direction.+ avatar.rotation.z = -angle;+ // Update rope visual.+ ropeEl.style.left = `${pivotPx.x}px`;+ ropeEl.style.top = `${pivotPx.y}px`;+ ropeEl.style.height = `${length - 30}px`;+ ropeEl.style.transform = `rotate(${angle}rad)`;+ }++ startLoop(stage.renderer, stage.scene, stage.camera, mixer, () => {+ if (phase === 'swing') {+ const p = Math.min((performance.now() - t0) / 1100, 1);+ setAvatarToPendulum(swingAngle(p));+ if (p >= 1) {+ const c = ctaCenterPx();+ fireSplash(c.x, c.y, { count: 22 });+ fireShockwave(c.x, c.y, { size: 36, max: 220 });+ ctaBtn.style.transition = 'transform 0.6s cubic-bezier(0.16,1,0.3,1)';+ ctaBtn.style.transform = 'translateX(-26px) rotate(-9deg)';+ setTimeout(() => { ctaBtn.style.transform = 'translateX(0) rotate(0)'; }, 220);+ phase = 'recover'; t0 = performance.now();+ }+ } else if (phase === 'recover') {+ // Mini swing-back of the pendulum after impact.+ const p = Math.min((performance.now() - t0) / 1400, 1);+ const a0 = computeImpactAngle();+ // Bounce back ~30° and oscillate decaying.+ const swing = Math.sin(p * Math.PI * 2.5) * (1 - p) * 0.45;+ setAvatarToPendulum(a0 + swing);+ if (p >= 1) {+ phase = 'dangle'; t0 = performance.now();+ A.idle.reset();+ A.idle.crossFadeFrom(current, 0.4, false).play();+ current = A.idle;+ }+ } else if (phase === 'dangle') {+ // Slight swaying dangle.+ const a0 = computeImpactAngle();+ const wob = Math.sin((performance.now() - t0) / 600) * 0.05;+ setAvatarToPendulum(a0 + wob);+ }+ }, rootBone, baseRootPos);+ </script>+ </body>+</html>diff --git a/public/demos/checkout.html b/public/demos/checkout.htmlindex 5aa8929e8..d93769143 100644--- a/public/demos/checkout.html+++ b/public/demos/checkout.html@@ -240,6 +240,11 @@y: (1 - _v3.y) * 0.5 * window.innerHeight,};}+ // ── Avatar runtime ────────────────────────────────────────────────+ // Declared above resize() so the parkAtButton() guard doesn't TDZ on init.+ let avatar = null, mixer = null, rootBone = null, baseRootPos = null;+ let phase = 'loading';+function resize() {renderer.setSize(window.innerWidth, window.innerHeight, false);updateFrustum();@@ -254,8 +259,6 @@const rim = new THREE.DirectionalLight(0x4060ff, 0.6); rim.position.set(-4, 3, -2); scene.add(rim);const fill = new THREE.DirectionalLight(0xffeedd, 0.4); fill.position.set(0, 2, 7); scene.add(fill);- // ── Avatar runtime ────────────────────────────────────────────────- let avatar = null, mixer = null, rootBone = null, baseRootPos = null;const actions = {};let currentAction = null;const FADE_S = 0.3;@@ -276,7 +279,6 @@// grabbing — quick reaction animation, item lifts off the product card// running — arcing toward the cart icon// celebrating — landed at cart, plays celebrate, returns to idle- let phase = 'loading';let itemCount = 0;const BUTTON_FEET_OFFSET_PX = 12; // how far below the button's top edge the feet sitconst CART_LAND_OFFSET_PX = 130; // sit/stand offset for the avatar at cart heightdiff --git a/public/demos/index.html b/public/demos/index.htmlindex 4a7df8bcc..64c608873 100644--- a/public/demos/index.html+++ b/public/demos/index.html@@ -72,6 +72,11 @@</p><div class="demos-grid">+ <a class="demo-card" href="/demos/agents/">+ <h2>Agent interactions lab</h2>+ <p>Fourteen prototypes for how a 3D agent can physically inhabit the page: cursor follower, trampoline button, wrecking ball, climb-the-title, more.</p>+ <span class="demo-status beta">Beta</span>+ </a><a class="demo-card" href="/demos/usdz-ar.html"><h2>USDZ & AR Quick Look</h2><p>Load an avatar, generate a USDZ companion in-browser, push it to R2, and confirm iOS Quick Look opens the result.</p>diff --git a/public/demos/pricing.html b/public/demos/pricing.htmlindex 4d3cf4a0b..47c45db9b 100644--- a/public/demos/pricing.html+++ b/public/demos/pricing.html@@ -243,6 +243,12 @@_v3.unproject(camera);return { x: _v3.x, y: _v3.y };}+ // ── Avatar runtime ────────────────────────────────────────────────+ // Declared above resize() so the recalibrate path doesn't TDZ on init.+ let avatar = null, mixer = null, rootBone = null, baseRootPos = null;+ let phase = 'loading';+ let activeTier = null;+function resize() {renderer.setSize(window.innerWidth, window.innerHeight, false);updateFrustum();@@ -262,8 +268,6 @@const rim = new THREE.DirectionalLight(0x4060ff, 0.6); rim.position.set(-4, 3, -2); scene.add(rim);const fill = new THREE.DirectionalLight(0xffeedd, 0.4); fill.position.set(0, 2, 7); scene.add(fill);- // ── Avatar runtime ────────────────────────────────────────────────- let avatar = null, mixer = null, rootBone = null, baseRootPos = null;const actions = {};let currentAction = null;const FADE_S = 0.3;@@ -289,8 +293,8 @@return domToWorld(r.left + r.width / 2, r.top + FEET_TOP_OFFSET_PX);}- let phase = 'loading'; // loading | idle | jumping- let activeTier = null; // tier she's currently associated with+ // phase: loading | idle | jumping (declared above)+ // activeTier: tier she's currently associated with (declared above)let jumpT = 0, jumpStart = null, jumpEnd = null, jumpLift = 0;const JUMP_S = 0.85;diff --git a/scripts/fetch-mixamo-catalog.mjs b/scripts/fetch-mixamo-catalog.mjsindex 1612b5b82..b7b0200ea 100644--- a/scripts/fetch-mixamo-catalog.mjs+++ b/scripts/fetch-mixamo-catalog.mjs@@ -14,9 +14,10 @@import { mkdirSync, writeFileSync, existsSync, readFileSync, renameSync } from 'node:fs';import { join } from 'node:path';+import { S3Client, PutObjectCommand, HeadObjectCommand } from '@aws-sdk/client-s3';// ── Config ────────────────────────────────────────────────────────────────-const Y_BOT_ID = '403e7206-d314-416a-9ef2-c618e26a8b6e';+const Y_BOT_ID = '4f5d21e1-4ccc-41f1-b35b-fb2547bd8493';const API = 'https://www.mixamo.com/api/v1';const PAGE_LIMIT = 96;const POLL_INTERVAL_MS = 2000;@@ -53,11 +54,55 @@ function loadToken() {const TOKEN = loadToken();if (!TOKEN) {- console.error('❌ MIXAMO_TOKEN not set. Add it to .env.local or pass as env var.');- console.error(' Get it from DevTools on mixamo.com → Application → localStorage → access_token');+ console.error('❌ MIXAMO_TOKEN not set. Run: node scripts/get-mixamo-token.mjs');process.exit(1);}+// ── R2 config ─────────────────────────────────────────────────────────────+function loadEnvVar(key) {+ if (process.env[key]) return process.env[key].trim();+ const envPath = join(process.cwd(), '.env.local');+ if (existsSync(envPath)) {+ const line = readFileSync(envPath, 'utf8').split('\n').find((l) => l.startsWith(`${key}=`));+ if (line) return line.slice(key.length + 1).trim().replace(/^["']|["']$/g, '');+ }+ return null;+}++const R2_ACCOUNT_ID = loadEnvVar('R2_ACCOUNT_ID');+const R2_ACCESS_KEY_ID = loadEnvVar('R2_ACCESS_KEY_ID');+const R2_SECRET_ACCESS_KEY = loadEnvVar('R2_SECRET_ACCESS_KEY');+const R2_BUCKET = loadEnvVar('R2_BUCKET') || 'test';+const USE_R2 = !!(R2_ACCOUNT_ID && R2_ACCESS_KEY_ID && R2_SECRET_ACCESS_KEY);++const r2 = USE_R2+ ? new S3Client({+ region: 'auto',+ endpoint: `https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com`,+ credentials: { accessKeyId: R2_ACCESS_KEY_ID.trim(), secretAccessKey: R2_SECRET_ACCESS_KEY.trim() },+ })+ : null;++async function existsInR2(key) {+ try {+ await r2.send(new HeadObjectCommand({ Bucket: R2_BUCKET, Key: key }));+ return true;+ } catch {+ return false;+ }+}++async function uploadToR2(key, buf) {+ await r2.send(+ new PutObjectCommand({+ Bucket: R2_BUCKET,+ Key: key,+ Body: buf,+ ContentType: 'application/octet-stream',+ }),+ );+}+const headers = {Accept: 'application/json','Content-Type': 'application/json',@@ -154,9 +199,11 @@ async function downloadOne(product) {const slug = slugify(product.description || product.name || product.id);const fbxPath = join(OUT_DIR, `${slug}.fbx`);const existing = catalog.animations[product.id];+ const r2Key = `mixamo/${slug}.fbx`;- if (existing?.file && existsSync(join(OUT_DIR, existing.file))) {- return { skipped: true, slug, reason: 'already-downloaded' };+ if (existing?.status === 'completed') {+ const alreadyExists = USE_R2 ? await existsInR2(r2Key) : existsSync(join(OUT_DIR, `${slug}.fbx`));+ if (alreadyExists) return { skipped: true, slug, reason: 'already-downloaded' };}if (existing?.status === 'permanent_fail') {return { skipped: true, slug, reason: 'permanent-fail' };@@ -204,15 +251,21 @@ async function downloadOne(product) {const fileRes = await rlFetch(downloadUrl);if (!fileRes.ok) throw new Error(`download ${fileRes.status}`);const buf = Buffer.from(await fileRes.arrayBuffer());- writeFileSync(fbxPath, buf);++ if (USE_R2) {+ await uploadToR2(r2Key, buf);+ } else {+ writeFileSync(fbxPath, buf);+ }catalog.animations[product.id] = {id: product.id,name: product.description || product.name,- file: `${slug}.fbx`,+ file: USE_R2 ? r2Key : `${slug}.fbx`,bytes: buf.length,downloaded_at: new Date().toISOString(),status: 'completed',+ storage: USE_R2 ? 'r2' : 'local',};saveCatalog();@@ -260,8 +313,8 @@ async function runPool(products) {// ── Main ──────────────────────────────────────────────────────────────────(async () => {console.log(`🎬 Mixamo catalog fetcher`);- console.log(` Character: ${CHARACTER_ID}`);- console.log(` Output: ${OUT_DIR}`);+ console.log(` Character: ${CHARACTER_ID}`);+ console.log(` Storage: ${USE_R2 ? `R2 → ${R2_BUCKET}/mixamo/` : OUT_DIR}`);console.log(` Concurrency: ${CONCURRENCY}\n`);const products = await listAllAnimations();diff --git a/scripts/get-mixamo-token.mjs b/scripts/get-mixamo-token.mjsnew file mode 100644index 000000000..0d9a13619--- /dev/null+++ b/scripts/get-mixamo-token.mjs@@ -0,0 +1,217 @@+#!/usr/bin/env node+/**+ * Logs into Adobe/Mixamo via Playwright and extracts the bearer token.+ * Saves MIXAMO_TOKEN to .env.local so fetch-mixamo-catalog.mjs can use it.+ *+ * Usage:+ * node scripts/get-mixamo-token.mjs+ * # reads ADOBE_EMAIL / ADOBE_PASSWORD from .env.local+ *+ * Adobe may send a verification code to your email — enter it when prompted.+ */++import { chromium } from 'playwright';+import { existsSync, readFileSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import * as readline from 'node:readline/promises';+import { stdin as input, stdout as output } from 'node:process';++const ENV_PATH = join(process.cwd(), '.env.local');++function loadEnv() {+ const env = {};+ if (existsSync(ENV_PATH)) {+ for (const line of readFileSync(ENV_PATH, 'utf8').split('\n')) {+ const m = line.match(/^([A-Z_]+)=(.*)$/);+ if (m) env[m[1]] = m[2].replace(/^["']|["']$/g, '').trim();+ }+ }+ return env;+}++function saveToken(token) {+ let contents = existsSync(ENV_PATH) ? readFileSync(ENV_PATH, 'utf8') : '';+ if (contents.includes('MIXAMO_TOKEN=')) {+ contents = contents.replace(/^MIXAMO_TOKEN=.*$/m, `MIXAMO_TOKEN=${token}`);+ } else {+ contents = contents.trimEnd() + `\nMIXAMO_TOKEN=${token}\n`;+ }+ writeFileSync(ENV_PATH, contents);+ console.log('✅ MIXAMO_TOKEN saved to .env.local');+}++async function fillOtp(page, code) {+ const single = await page.$('input[name="code"], input[aria-label*="code" i], input[placeholder*="code" i]');+ if (single) {+ await single.fill(code);+ } else {+ const inputs = await page.$$('input[type="text"], input[type="number"], input[inputmode="numeric"]');+ for (let i = 0; i < inputs.length && i < code.length; i++) {+ await inputs[i].fill(code[i]);+ }+ }+ await page.click('button[type="submit"], button:has-text("Continue")').catch(() =>+ page.keyboard.press('Enter')+ );+}++async function prompt(question) {+ const rl = readline.createInterface({ input, output });+ const answer = await rl.question(question);+ rl.close();+ return answer.trim();+}++(async () => {+ const env = { ...loadEnv(), ...process.env };+ const email = env.ADOBE_EMAIL;+ const password = env.ADOBE_PASSWORD;++ if (!email || !password) {+ console.error('❌ ADOBE_EMAIL and ADOBE_PASSWORD must be set in .env.local');+ process.exit(1);+ }++ console.log(`🔐 Logging in as ${email}...`);++ const browser = await chromium.launch({ headless: true });+ const context = await browser.newContext();+ let token = null;++ context.on('request', (req) => {+ const auth = req.headers()['authorization'];+ if (auth?.startsWith('Bearer ') && req.url().includes('mixamo.com')) {+ token = auth.slice(7);+ }+ });++ const page = await context.newPage();+ await page.goto('https://www.mixamo.com', { waitUntil: 'domcontentloaded' });+ await page.waitForTimeout(2000);++ if (token) {+ console.log('✅ Already authenticated');+ saveToken(token);+ await browser.close();+ return;+ }++ // Click sign in button+ const signInSelectors = [+ 'button:has-text("Log in")',+ 'button:has-text("Sign In")',+ 'a:has-text("Sign In")',+ '[data-id="sign-in"]',+ ];++ let clicked = false;+ for (const sel of signInSelectors) {+ try {+ await page.click(sel, { timeout: 3000 });+ clicked = true;+ break;+ } catch { /* try next */ }+ }++ if (!clicked) {+ await page.screenshot({ path: 'scripts/debug-mixamo.png', fullPage: true });+ console.error('❌ Could not find Sign In button. Screenshot: scripts/debug-mixamo.png');+ await browser.close();+ process.exit(1);+ }++ // Handle popup or redirect+ let loginPage = page;+ try {+ const popup = await context.waitForEvent('page', { timeout: 5000 });+ loginPage = popup;+ console.log(' Popup detected');+ } catch { /* main page redirect */ }++ await loginPage.waitForURL(/adobeid|ims-na1|adobe\.com/, { timeout: 15000 }).catch(() => {});+ await loginPage.waitForLoadState('domcontentloaded').catch(() => {});+ console.log(` URL: ${loginPage.url()}`);+ await loginPage.screenshot({ path: 'scripts/debug-step1.png', fullPage: true });+ console.log(' Screenshot: scripts/debug-step1.png');++ // Step 1: Email+ console.log(' Filling email...');+ await loginPage.waitForSelector('input[type="email"]', { timeout: 15000, state: 'visible' });+ await loginPage.fill('input[type="email"]', email);+ await loginPage.screenshot({ path: 'scripts/debug-step2.png' });+ await loginPage.click('button[type="submit"]').catch(() => loginPage.keyboard.press('Enter'));+ await loginPage.waitForTimeout(3000);+ await loginPage.screenshot({ path: 'scripts/debug-step3.png' });+ console.log(` After email submit URL: ${loginPage.url()}`);++ // Step 2 or 3: could be password, could be verify-identity, could be OTP+ let bodyText = await loginPage.innerText('body').catch(() => '');+ console.log(` Page heading: ${bodyText.slice(0, 120).replace(/\n/g, ' ')}`);++ // Handle verification screen before password (some accounts see this first)+ if (bodyText.includes('Verify') || bodyText.includes('verification') || bodyText.includes('code')) {+ console.log('\n📧 Adobe sent a verification code to your email.');+ const code = await prompt(' Enter the code: ');+ await fillOtp(loginPage, code);+ await loginPage.waitForTimeout(3000);+ await loginPage.screenshot({ path: 'scripts/debug-step4.png' });+ bodyText = await loginPage.innerText('body').catch(() => '');+ }++ // Password step+ if (await loginPage.$('input[type="password"]').then(Boolean).catch(() => false)) {+ console.log(' Filling password...');+ await loginPage.fill('input[type="password"]', password, { force: true });+ await loginPage.click('button[type="submit"]').catch(() => loginPage.keyboard.press('Enter'));+ await loginPage.waitForTimeout(3000);+ await loginPage.screenshot({ path: 'scripts/debug-step5.png' });+ bodyText = await loginPage.innerText('body').catch(() => '');+ console.log(` After password URL: ${loginPage.url()}`);+ }++ // Verification after password+ if (bodyText.includes('Verify') || bodyText.includes('verification') || bodyText.includes('code')) {+ console.log('\n📧 Adobe sent a verification code to your email.');+ const code = await prompt(' Enter the code: ');+ await fillOtp(loginPage, code);+ await loginPage.waitForTimeout(3000);+ }+++ // Wait for redirect back to mixamo+ console.log('⏳ Waiting for authentication...');+ await page.waitForURL(/mixamo\.com/, { timeout: 30000 }).catch(() => {});+ await page.waitForLoadState('networkidle', { timeout: 20000 }).catch(() => {});++ if (!token) {+ await page.evaluate(() =>+ fetch('https://www.mixamo.com/api/v1/products?page=1&limit=1&type=Motion').catch(() => {})+ );+ await page.waitForTimeout(3000);+ }++ if (!token) {+ token = await page.evaluate(() =>+ localStorage.getItem('access_token') ||+ document.cookie.split(';').map((c) => c.trim()).find((c) => c.startsWith('access_token='))?.split('=')[1] ||+ null+ );+ }++ await browser.close();++ if (!token) {+ console.error('❌ Could not extract token.');+ console.error(' Manual fallback: log in at mixamo.com, open DevTools → Network,');+ console.error(' click any request to mixamo.com/api, copy the Authorization header');+ console.error(' (value after "Bearer "), and add to .env.local:');+ console.error(' MIXAMO_TOKEN=<paste-here>');+ process.exit(1);+ }++ console.log(`🎟 Token captured (${token.slice(0, 20)}...)`);+ saveToken(token);+})().catch((err) => {+ console.error('💥', err.message);+ process.exit(1);+});diff --git a/scripts/hf-mixamo-to-r2.mjs b/scripts/hf-mixamo-to-r2.mjsnew file mode 100644index 000000000..d3f5873be--- /dev/null+++ b/scripts/hf-mixamo-to-r2.mjs@@ -0,0 +1,184 @@+#!/usr/bin/env node+/**+ * Downloads all Mixamo FBX animations from jasongzy/Mixamo (HuggingFace)+ * and uploads them to R2 under mixamo/<slug>.fbx+ *+ * Resumable — re-run to continue from where it left off.+ *+ * Usage:+ * node scripts/hf-mixamo-to-r2.mjs+ */++import { S3Client, PutObjectCommand, HeadObjectCommand } from '@aws-sdk/client-s3';+import { existsSync, readFileSync, writeFileSync, mkdirSync, renameSync } from 'node:fs';+import { join } from 'node:path';++// ── Config ────────────────────────────────────────────────────────────────+const HF_REPO = 'jasongzy/Mixamo';+const HF_BASE = `https://huggingface.co/datasets/${HF_REPO}/resolve/main`;+const CONCURRENCY = 4;++// ── Load env ──────────────────────────────────────────────────────────────+function loadEnvVar(key) {+ if (process.env[key]) return process.env[key].trim();+ const envPath = join(process.cwd(), '.env.local');+ if (existsSync(envPath)) {+ const line = readFileSync(envPath, 'utf8').split('\n').find((l) => l.startsWith(`${key}=`));+ if (line) return line.slice(key.length + 1).trim().replace(/^["']|["']$/g, '');+ }+ return null;+}++const HF_TOKEN = loadEnvVar('HF_TOKEN');+const R2_ACCOUNT_ID = loadEnvVar('R2_ACCOUNT_ID');+const R2_ACCESS_KEY_ID = loadEnvVar('R2_ACCESS_KEY_ID');+const R2_SECRET_ACCESS_KEY = loadEnvVar('R2_SECRET_ACCESS_KEY');+const R2_BUCKET = loadEnvVar('R2_BUCKET') || 'test';++if (!HF_TOKEN) { console.error('❌ HF_TOKEN not set in .env.local'); process.exit(1); }+if (!R2_ACCOUNT_ID || !R2_ACCESS_KEY_ID || !R2_SECRET_ACCESS_KEY) {+ console.error('❌ R2 credentials not set in .env.local'); process.exit(1);+}++// ── R2 client ─────────────────────────────────────────────────────────────+const r2 = new S3Client({+ region: 'auto',+ endpoint: `https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com`,+ credentials: {+ accessKeyId: R2_ACCESS_KEY_ID.trim(),+ secretAccessKey: R2_SECRET_ACCESS_KEY.trim(),+ },+});++async function existsInR2(key) {+ try {+ await r2.send(new HeadObjectCommand({ Bucket: R2_BUCKET, Key: key }));+ return true;+ } catch { return false; }+}++async function uploadToR2(key, buf) {+ await r2.send(new PutObjectCommand({+ Bucket: R2_BUCKET,+ Key: key,+ Body: buf,+ ContentType: 'application/octet-stream',+ }));+}++// ── Manifest ──────────────────────────────────────────────────────────────+mkdirSync('public/animations/mixamo', { recursive: true });+const MANIFEST_PATH = 'public/animations/mixamo/hf-manifest.json';+const manifest = existsSync(MANIFEST_PATH)+ ? JSON.parse(readFileSync(MANIFEST_PATH, 'utf8'))+ : {};++function saveManifest() {+ writeFileSync(MANIFEST_PATH + '.tmp', JSON.stringify(manifest, null, 2));+ renameSync(MANIFEST_PATH + '.tmp', MANIFEST_PATH);+}++// ── HuggingFace helpers ───────────────────────────────────────────────────+const hfHeaders = { Authorization: `Bearer ${HF_TOKEN}` };++async function hfGet(url) {+ const res = await fetch(url, { headers: hfHeaders });+ if (!res.ok) throw new Error(`HF ${res.status} ${url}`);+ return res;+}++async function listHFFiles() {+ // Use HF API to list all files in the repo+ let files = [];+ let cursor = null;+ while (true) {+ const url = `https://huggingface.co/api/datasets/${HF_REPO}/tree/main/animation${cursor ? `?cursor=${cursor}` : ''}`;+ const res = await hfGet(url);+ const data = await res.json();+ if (!Array.isArray(data) || data.length === 0) break;+ files.push(...data.filter(f => f.path?.endsWith('.fbx')));+ // Check for next page via Link header+ const link = res.headers.get('link');+ const next = link?.match(/<([^>]+)>;\s*rel="next"/)?.[1];+ if (!next) break;+ cursor = new URL(next).searchParams.get('cursor');+ if (!cursor) break;+ }+ return files;+}++// ── Worker pool ───────────────────────────────────────────────────────────+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));++async function processFile(file, index, total) {+ const uuid = file.path.replace('animation/', '').replace('.fbx', '');+ const r2Key = `mixamo/${uuid}.fbx`;+ const label = `[${index + 1}/${total}]`;++ if (manifest[uuid]?.uploaded) {+ const exists = await existsInR2(r2Key);+ if (exists) {+ process.stdout.write(`${label} ⏭ ${uuid.slice(0, 8)}...\n`);+ return;+ }+ }++ try {+ const res = await hfGet(`${HF_BASE}/animation/${uuid}.fbx`);+ const buf = Buffer.from(await res.arrayBuffer());+ await uploadToR2(r2Key, buf);++ manifest[uuid] = {+ uuid,+ r2Key,+ bytes: buf.length,+ uploaded: true,+ uploaded_at: new Date().toISOString(),+ };+ saveManifest();++ process.stdout.write(`${label} ✅ ${uuid.slice(0, 8)}... (${(buf.length / 1024).toFixed(0)} KB)\n`);+ } catch (err) {+ process.stdout.write(`${label} ❌ ${uuid.slice(0, 8)}...: ${err.message}\n`);+ }+}++async function runPool(files) {+ let cursor = 0;+ async function worker() {+ while (cursor < files.length) {+ const i = cursor++;+ await processFile(files[i], i, files.length);+ await sleep(100);+ }+ }+ await Promise.all(Array.from({ length: CONCURRENCY }, worker));+}++// ── Main ──────────────────────────────────────────────────────────────────+(async () => {+ console.log(`🎬 HuggingFace Mixamo → R2`);+ console.log(` Repo: ${HF_REPO}`);+ console.log(` Bucket: ${R2_BUCKET}/mixamo/`);+ console.log(` Workers: ${CONCURRENCY}\n`);++ console.log('📚 Listing files from HuggingFace...');+ const files = await listHFFiles();+ console.log(`📦 Found ${files.length} FBX files\n`);++ const already = Object.values(manifest).filter((m) => m.uploaded).length;+ if (already > 0) console.log(` Resuming — ${already} already uploaded\n`);++ const t0 = Date.now();+ await runPool(files);+ const mins = ((Date.now() - t0) / 60000).toFixed(1);++ const done = Object.values(manifest).filter((m) => m.uploaded).length;+ console.log(`\n${'═'.repeat(45)}`);+ console.log(`✅ Uploaded: ${done}/${files.length}`);+ console.log(`⏱ Time: ${mins} min`);+ console.log(`📋 Manifest: ${MANIFEST_PATH}`);+})().catch((err) => {+ console.error('💥', err);+ process.exit(1);+});diff --git a/scripts/verify-new-demos-interactions.mjs b/scripts/verify-new-demos-interactions.mjsnew file mode 100644index 000000000..06ecffa83--- /dev/null+++ b/scripts/verify-new-demos-interactions.mjs@@ -0,0 +1,60 @@+// Interaction smoke check — load each demo, wait for the avatar to mount,+// then exercise the page's primary trigger (button click, hover) and confirm+// no runtime errors fire during the animation sequence.+import { chromium } from 'playwright';++const BASE = process.env.BASE_URL || 'http://localhost:3000';+const browser = await chromium.launch();+let totalFail = 0;++async function run(route, action) {+ const ctx = await browser.newContext();+ const page = await ctx.newPage();+ const errors = [];+ page.on('pageerror', e => errors.push(`pageerror: ${e.message}`));+ page.on('console', msg => { if (msg.type() === 'error') errors.push(`console.error: ${msg.text()}`); });++ console.log(`\n→ ${route}`);+ await page.goto(BASE + route, { waitUntil: 'networkidle', timeout: 15000 });++ // Wait until the GLB + clips have loaded — the demos all set phase = 'idle'+ // (or 'confused' for 404) once the loader's .then fires. We poll the canvas+ // for ~3s, which is plenty of headroom on local dev.+ await page.waitForTimeout(2500);++ await action(page);+ // Let the triggered animation play out+ await page.waitForTimeout(3500);++ if (errors.length) {+ console.log(` ✖ errors during interaction:`);+ errors.forEach(e => console.log(` ${e}`));+ totalFail++;+ } else {+ console.log(` ✓ interaction completed cleanly`);+ }+ await ctx.close();+}++// 404 — click "Back to lab" (goes to /demos/, which we know returns 200) so we+// can verify the run-off animation triggers without being polluted by errors+// from the redirect destination.+await run('/demos/404.html', async page => {+ await page.click('#lab-btn', { noWaitAfter: true });+});++// Checkout — click Add to cart, which triggers grab → run → cart thump+await run('/demos/checkout.html', async page => {+ await page.click('#add-btn');+});++// Pricing — hover Basic tier, then Enterprise, which should trigger two jumps+await run('/demos/pricing.html', async page => {+ await page.hover('#tier-basic');+ await page.waitForTimeout(1500);+ await page.hover('#tier-enterprise');+});++await browser.close();+console.log(`\n${totalFail === 0 ? '✓ all interactions clean' : `✖ ${totalFail} interaction(s) had errors`}`);+process.exit(totalFail === 0 ? 0 : 1);diff --git a/scripts/verify-new-demos.mjs b/scripts/verify-new-demos.mjsnew file mode 100644index 000000000..1ba5a15f5--- /dev/null+++ b/scripts/verify-new-demos.mjs@@ -0,0 +1,82 @@+// Headless smoke check for the new demos. Loads each page, waits for the+// avatar GLB + animation clips to finish fetching, then reports any console+// errors or failed network requests. Run with: node scripts/verify-new-demos.mjs+import { chromium } from 'playwright';++const BASE = process.env.BASE_URL || 'http://localhost:3002';+const ROUTES = ['/demos/404.html', '/demos/checkout.html', '/demos/pricing.html'];++const browser = await chromium.launch();+let totalFail = 0;++for (const route of ROUTES) {+ const ctx = await browser.newContext();+ const page = await ctx.newPage();++ const errors = [];+ const failedRequests = [];++ page.on('pageerror', e => errors.push(`pageerror: ${e.message}`));+ page.on('console', msg => {+ if (msg.type() === 'error') errors.push(`console.error: ${msg.text()}`);+ });+ page.on('requestfailed', req => {+ failedRequests.push(`${req.url()} (${req.failure()?.errorText})`);+ });+ page.on('response', resp => {+ const s = resp.status();+ if (s >= 400) failedRequests.push(`${resp.url()} → ${s}`);+ });++ const url = BASE + route;+ console.log(`\n→ ${url}`);+ try {+ await page.goto(url, { waitUntil: 'networkidle', timeout: 15000 });+ } catch (e) {+ console.log(` ✖ navigation failed: ${e.message}`);+ totalFail++;+ await ctx.close();+ continue;+ }++ // Probe the avatar mount: each demo's module exposes `avatar` as a closure+ // local — we can't see it, but the canvas should have non-zero size and the+ // animation manifest fetch should have succeeded. We assert on:+ // 1. <canvas> rendered with width > 0+ // 2. /animations/clips/idle.json fetched 200+ // 3. /avatars/cz.glb fetched 200+ const canvasOk = await page.evaluate(() => {+ const c = document.getElementById('avatar-canvas');+ return c && c.width > 0 && c.height > 0;+ });++ // Give the avatar a beat to actually start animating+ await page.waitForTimeout(1500);++ const hasGoodCanvas = canvasOk;+ const hasErrors = errors.length > 0;+ const hasFails = failedRequests.length > 0;++ if (hasErrors) {+ console.log(` ✖ console errors:`);+ errors.forEach(e => console.log(` ${e}`));+ }+ if (hasFails) {+ console.log(` ✖ failed requests:`);+ failedRequests.forEach(r => console.log(` ${r}`));+ }+ if (!hasGoodCanvas) {+ console.log(` ✖ avatar canvas not rendered`);+ }+ if (!hasErrors && !hasFails && hasGoodCanvas) {+ console.log(` ✓ clean load, canvas mounted`);+ } else {+ totalFail++;+ }++ await ctx.close();+}++await browser.close();+console.log(`\n${totalFail === 0 ? '✓ all routes clean' : `✖ ${totalFail} route(s) had issues`}`);+process.exit(totalFail === 0 ? 0 : 1);diff --git a/vite.config.js b/vite.config.jsindex 902a38275..241028002 100644--- a/vite.config.js+++ b/vite.config.js@@ -3,6 +3,7 @@ import { resolve } from 'path';import { readFileSync, cpSync, createReadStream, existsSync, statSync, rmSync } from 'fs';import { extname } from 'path';import { VitePWA } from 'vite-plugin-pwa';+import { nodePolyfills } from 'vite-plugin-node-polyfills';// The build emits two targets controlled by the TARGET env var://@@ -183,10 +184,36 @@ const appConfig = {'demos-button': resolve(__dirname, 'public/demos/button.html'),'demos-3d-home': resolve(__dirname, 'public/demos/3d-home.html'),'demos-halfbody-xr': resolve(__dirname, 'public/demos/halfbody-xr.html'),+ // /demos/agents/* — agent interaction lab.+ 'agents-index': resolve(__dirname, 'public/demos/agents/index.html'),+ 'agents-cursor-follower': resolve(__dirname, 'public/demos/agents/cursor-follower.html'),+ 'agents-high-five': resolve(__dirname, 'public/demos/agents/high-five.html'),+ 'agents-pickup-drop': resolve(__dirname, 'public/demos/agents/pickup-drop.html'),+ 'agents-fall-from-top': resolve(__dirname, 'public/demos/agents/fall-from-top.html'),+ 'agents-trampoline': resolve(__dirname, 'public/demos/agents/trampoline.html'),+ 'agents-wrecking-ball': resolve(__dirname, 'public/demos/agents/wrecking-ball.html'),+ 'agents-climb-title': resolve(__dirname, 'public/demos/agents/climb-title.html'),+ 'agents-skateboard': resolve(__dirname, 'public/demos/agents/skateboard.html'),+ 'agents-sit-in-body': resolve(__dirname, 'public/demos/agents/sit-in-body.html'),+ 'agents-scroll-inertia': resolve(__dirname, 'public/demos/agents/scroll-inertia.html'),+ 'agents-walks-gutter': resolve(__dirname, 'public/demos/agents/walks-gutter.html'),+ 'agents-holds-cta': resolve(__dirname, 'public/demos/agents/holds-cta.html'),+ 'agents-falls-asleep': resolve(__dirname, 'public/demos/agents/falls-asleep.html'),+ 'agents-builds-button': resolve(__dirname, 'public/demos/agents/builds-button.html'),},},},plugins: [+ // Polyfill the Node `buffer` and `process` globals so @solana/web3.js+ // (and any other dep that does `import { Buffer } from 'buffer'`) works+ // in the browser without the "Module 'buffer' has been externalized"+ // console warning. Scoped to these two — we don't blanket-polyfill all+ // Node builtins because most pages don't need them.+ nodePolyfills({+ include: ['buffer', 'process'],+ globals: { Buffer: true, process: true, global: true },+ protocolImports: true,+ }),{name: 'vercel-rewrites',configureServer(server) {@@ -276,6 +303,8 @@ const appConfig = {'/blog/': resolve(root, 'blog/index.html'),'/demos': resolve(root, 'public/demos/index.html'),'/demos/': resolve(root, 'public/demos/index.html'),+ '/demos/agents': resolve(root, 'public/demos/agents/index.html'),+ '/demos/agents/': resolve(root, 'public/demos/agents/index.html'),'/demo/avatar-os': resolve(root, 'public/demo/avatar-os/index.html'),'/demo/avatar-os/': resolve(root, 'public/demo/avatar-os/index.html'),'/demo/coin': resolve(root, 'public/demo/coin/index.html'),@@ -358,6 +387,13 @@ const appConfig = {const slug = path.replace(/^\/demos\//, '').replace(/\.html$/, '').replace(/\/$/, '');filePath = resolve(root, `public/demos/${slug}.html`);}+ // /demos/agents/<slug>(.html)? → public/demos/agents/<slug>.html.+ // Goes through transformIndexHtml so the inline `'three'` imports+ // inside each demo's <script type="module"> get bundled.+ else if (!filePath && /^\/demos\/agents\/[a-z0-9-]+(\.html)?\/?$/.test(path)) {+ const slug = path.replace(/^\/demos\/agents\//, '').replace(/\.html$/, '').replace(/\/$/, '');+ filePath = resolve(root, `public/demos/agents/${slug}.html`);+ }// /demo/coin/<base58 mint> → demo/coin index hydrates from the// mint address in the URL path. Mirrors vercel.json.else if (!filePath && /^\/demo\/coin\/[1-9A-HJ-NP-Za-km-z]{32,44}\/?$/.test(path)) {