Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: integrate ui-juice library for enhanced animations and score rendering in trader components

qbdz05baabb692ba
diff --git a/pages/trader.html b/pages/trader.html
index c75a37ba7..c490eb3cd 100644
--- a/pages/trader.html
+++ b/pages/trader.html
@@ -19,6 +19,7 @@
<link rel="manifest" href="/site.webmanifest" />
<link rel="stylesheet" href="/fonts/fonts.css" />
<link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/ui-juice.css" />
<link rel="stylesheet" href="/src/leaderboard.css" />
<link rel="stylesheet" href="/src/trader.css" />
<link rel="stylesheet" href="/footer.css" />
diff --git a/src/agent-picker.js b/src/agent-picker.js
index e91329fc7..43e67f445 100644
--- a/src/agent-picker.js
+++ b/src/agent-picker.js
@@ -22,6 +22,8 @@
*/
import './agent-picker.css';
+import './ui-juice.css';
+import { enterStagger } from './ui-juice.js';
import { onchainBadgeHTML } from './shared/onchain-badge.js';
const PAGE_SIZE = 24;
@@ -350,12 +352,17 @@ export class AgentPicker {
if (!this._state.firstPageDone) this._els.grid.innerHTML = '';
+ const fresh = [];
for (const a of agents) {
this._state.cardsById.set(a.id, a);
- this._els.grid.appendChild(this._renderCard(a));
+ const card = this._renderCard(a);
+ this._els.grid.appendChild(card);
+ fresh.push(card);
this._state.loaded += 1;
for (const s of a.skills || []) this._state.loadedSkills.add(s);
}
+ // Stagger the freshly-landed cards in (first page + each lazy-loaded page).
+ enterStagger(fresh);
this._state.firstPageDone = true;
this._state.hasMore = !!data.has_more;
diff --git a/src/avatar-gallery-picker.js b/src/avatar-gallery-picker.js
index 02c4a06a5..eeca6af78 100644
--- a/src/avatar-gallery-picker.js
+++ b/src/avatar-gallery-picker.js
@@ -17,6 +17,8 @@
*/
import './avatar-gallery-picker.css';
+import './ui-juice.css';
+import { enterStagger } from './ui-juice.js';
import { onchainBadgeHTML } from './shared/onchain-badge.js';
import { walletChipHTML, wireWalletChips } from './shared/agent-wallet-chip.js';
@@ -367,12 +369,17 @@ export class AvatarGalleryPicker {
this._els.grid.innerHTML = '';
}
+ const fresh = [];
for (const a of avatars) {
this._state.cardsById.set(a.id, a);
- this._els.grid.appendChild(this._renderCard(a));
+ const card = this._renderCard(a);
+ this._els.grid.appendChild(card);
+ fresh.push(card);
this._state.totalLoaded += 1;
for (const t of a.tags || []) this._state.loadedTags.add(t);
}
+ // Stagger the freshly-landed avatar cards in (first page + each lazy page).
+ enterStagger(fresh);
if (!this._state.firstPageDone) {
if (typeof data.total === 'number') this._state.total = data.total;
diff --git a/src/launches.js b/src/launches.js
index 20121da5c..9aeb65857 100644
--- a/src/launches.js
+++ b/src/launches.js
@@ -21,6 +21,7 @@
import { mountCoinStatus, formatMcap } from './pump/coin-status-card.js';
import { walletChipEl } from './shared/agent-wallet-chip.js';
import { createLogger } from './shared/log.js';
+import { countUp, updateValue, enterStagger, rippleOnce, liveDot, setLiveDot } from './ui-juice.js';
const log = createLogger('launches');
@@ -388,8 +389,17 @@ function recomputeAggregates() {
}
if (coin.graduated) graduated += 1;
}
- if (statMcapEl) statMcapEl.textContent = priced ? formatMcap(totalMcap) : '—';
- if (statGradEl) statGradEl.textContent = priced ? String(graduated) : '—';
+ // Count between real aggregates so a page of widgets resolving (or a live
+ // launch landing) ticks the hero up instead of snapping. The placeholder
+ // state clears the tracked value so the first real number counts from 0.
+ if (statMcapEl) {
+ if (priced) updateValue(statMcapEl, totalMcap, formatMcap, { flash: false });
+ else { statMcapEl.textContent = '—'; delete statMcapEl.dataset.juiceVal; }
+ }
+ if (statGradEl) {
+ if (priced) updateValue(statGradEl, graduated, (n) => String(Math.round(n)), { flash: false });
+ else { statGradEl.textContent = '—'; delete statGradEl.dataset.juiceVal; }
+ }
}
function resetAggregates() {
@@ -398,8 +408,8 @@ function resetAggregates() {
aggregateRaf = 0;
}
state.marketByMint = new Map();
- if (statMcapEl) statMcapEl.textContent = '—';
- if (statGradEl) statGradEl.textContent = '—';
+ if (statMcapEl) { statMcapEl.textContent = '—'; delete statMcapEl.dataset.juiceVal; }
+ if (statGradEl) { statGradEl.textContent = '—'; delete statGradEl.dataset.juiceVal; }
}
// ── Oracle conviction batch enrichment ───────────────────────────────────────
@@ -657,7 +667,10 @@ function buildTicker(launches) {
// ── hero stats ───────────────────────────────────────────────────────────────
function updateStats(firstLaunch) {
- if (statCountEl) statCountEl.textContent = state.count ? `${state.count}${state.hasMore ? '+' : ''}` : '0';
+ if (statCountEl) updateValue(statCountEl, state.count, (n) => {
+ const v = Math.round(n);
+ return v ? `${v}${state.hasMore ? '+' : ''}` : '0';
+ }, { flash: false });
if (statLatestEl) statLatestEl.textContent = firstLaunch ? timeAgo(firstLaunch.created_at) : '—';
if (statNetworkEl) statNetworkEl.textContent = state.network;
}
@@ -854,6 +867,11 @@ async function liveRefresh() {
freshCards.push(card);
}
enrichCardsWithOracle(freshCards);
+ // Slide the just-landed launches in from the top (newest first) and fire a
+ // single restrained ripple on the hero count — a real "new launch shipped"
+ // beat backed by the live poll, not a timer.
+ enterStagger([...freshCards].reverse());
+ rippleOnce(statCountEl);
state.count += fresh.length;
state.offset += fresh.length;
state.latestCreatedAt = fresh[0].created_at;
diff --git a/src/trader.js b/src/trader.js
index 25911f502..7e41010ed 100644
--- a/src/trader.js
+++ b/src/trader.js
@@ -55,17 +55,13 @@ function solscanAddr(addr) {
}
// --- Score gauge -------------------------------------------------------------
-function gaugeSvg(score) {
- const r = 34, c = 2 * Math.PI * r;
- const pct = Math.max(0, Math.min(100, score)) / 100;
- const dash = (c * pct).toFixed(1);
- const hue = Math.round(pct * 130); // red→green
- return `<svg width="92" height="92" viewBox="0 0 92 92" role="img" aria-label="Trader score ${score}">
- <circle cx="46" cy="46" r="${r}" fill="none" stroke="var(--surface-3)" stroke-width="7"/>
- <circle cx="46" cy="46" r="${r}" fill="none" stroke="hsl(${hue} 70% 55%)" stroke-width="7"
- stroke-linecap="round" stroke-dasharray="${dash} ${c.toFixed(1)}"
- transform="rotate(-90 46 46)"/>
- </svg>`;
+// The 0–100 score reads as a "level", so it gets the shared ring gauge: an arc
+// that sweeps to the real score on render (playRings) with threshold colouring.
+// The big numeric label is overlaid by .tp-gauge-val (and counts up separately),
+// so the ring itself renders no inline label. An explicit colour overrides the
+// success/warn/danger thresholds for the wallet smart-score archetype tint.
+function gauge(score, color) {
+ return ring(Math.max(0, Math.min(100, Math.round(score))), { size: 92, stroke: 7, label: '', ...(color ? { color } : {}) });
}
// --- Equity curve (pure) -----------------------------------------------------
@@ -296,7 +292,7 @@ function render(data) {
${a.description ? `<p class="tp-desc">${escapeHtml(a.description)}</p>` : ''}
</div>
<div class="tp-gauge">
- ${gaugeSvg(m.score)}
+ ${gauge(m.score)}
<div class="tp-gauge-val" style="margin-top:-58px">${m.score}</div>
<div class="tp-gauge-label" style="margin-top:34px">Trader Score</div>
</div>
@@ -319,7 +315,7 @@ function render(data) {
<div class="tp-curve-wrap">
<div class="tp-curve-head">
<span class="tp-curve-title">Realized equity · ${WINDOW_LABEL[ctx.window]}</span>
- <span class="${pnlClass(m.realized_pnl_sol)}" style="font-variant-numeric:tabular-nums;font-weight:var(--weight-semibold)">${fmtSol(m.realized_pnl_sol)}</span>
+ <span id="tp-equity-pnl" class="${pnlClass(m.realized_pnl_sol)}" style="font-variant-numeric:tabular-nums;font-weight:var(--weight-semibold)">${fmtSol(m.realized_pnl_sol)}</span>
</div>
${equityCurveSvg(data.closed)}
</div>
@@ -377,6 +373,18 @@ function render(data) {
wireWalletChips(content);
const panel = document.getElementById('tp-copy-panel');
if (panel) mountCopyPanel(panel, { leaderAgentId: a.id, leaderName: a.name, network: ctx.network });
+
+ // Sweep the score ring to its real fill, and count the headline score + realized
+ // P&L from their previously-shown real values (so switching the window animates
+ // the change instead of snapping; the first paint settles instantly).
+ playRings(content);
+ const scoreEl = content.querySelector('.tp-gauge-val');
+ if (scoreEl) countUp(scoreEl, ctx.prevScore != null ? ctx.prevScore : m.score, m.score, { format: (n) => String(Math.round(n)) });
+ const pnlEl = document.getElementById('tp-equity-pnl');
+ if (pnlEl) countUp(pnlEl, ctx.prevPnl != null ? ctx.prevPnl : m.realized_pnl_sol, m.realized_pnl_sol, { format: fmtSol });
+ ctx.prevScore = m.score;
+ ctx.prevPnl = m.realized_pnl_sol;
+
root.setAttribute('aria-busy', 'false');
}
@@ -665,7 +673,7 @@ function renderWalletProfile(data) {
${a.blurb ? `<p class="tp-desc">${escapeHtml(a.blurb)}</p>` : ''}
</div>
<div class="tp-gauge">
- ${r ? gaugeSvg(Math.round(r.score)) : gaugeSvg(0)}
+ ${r ? gauge(r.score, color) : gauge(0)}
<div class="tp-gauge-val" style="margin-top:-58px;color:${color}">${r ? Math.round(r.score) : '—'}</div>
<div class="tp-gauge-label" style="margin-top:34px">Smart Score</div>
</div>
@@ -693,6 +701,8 @@ function renderWalletProfile(data) {
</div>
`;
+ playRings(content);
+
const shareBtn = content.querySelector('#tp-share-wallet');
shareBtn?.addEventListener('click', () => {
const url = `${location.origin}/trader/${encodeURIComponent(addr)}`;