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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n="demos_agents_trampoline.meta_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" data-i18n-html="demos_agents_trampoline.the_cta_bounces">The CTA <em>bounces</em>.</h1>
<p class="hero-sub" data-i18n="demos_agents_trampoline.she_lands_on_the_button_and_it">
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">
<button type="button" class="btn btn-primary" id="cta-btn" data-i18n-html="demos_agents_trampoline.bounce_me"><span>Bounce me</span><span>⤴</span></button>
<button class="btn btn-ghost" id="restart" data-i18n-html="demos_agents_trampoline.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: ['blue','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(); });
ctaBtn.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>
<script src="/brand.js" defer></script>
<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
<script type="module" src="/i18n.js"></script>
</body>
</html>