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(holo): add the holo page, and extend the oracle alert digest
nirholas8c0a54d25fb0
diff --git a/.env.example b/.env.exampleindex 4bf7f938a..5b062f2e4 100644--- a/.env.example+++ b/.env.example@@ -1432,11 +1432,20 @@ TELEGRAM_CHANGELOG_CHAT_ID=-1003927666373# commit firehose out of the holder-facing changelog channel.TELEGRAM_COMMITS_CHAT_ID=-# Telegram Oracle signals channel — prime/strong conviction coins posted here-# by the oracle-score cron. Separate from ops alerts and the changelog channel.-# Leave blank to disable. Set ORACLE_ALERT_MIN_TIER=prime to only post the top tier.+# Telegram Oracle signals channel — the live feed of three.ws/oracle. The+# oracle-score cron (every 2 min) posts each coin that first crosses the tier+# floor (ORACLE_ALERT_MIN_TIER) OR the raw score floor (ORACLE_FEED_MIN_SCORE,+# default 56 = the Lean boundary); agent entries and profitable exits post from+# the agent/settle loops; oracle-digest posts a daily channel summary at 08:00+# UTC. Separate from ops alerts and the changelog channel. Leave blank to+# disable. A public @handle here also lights up the "Join the live Telegram+# feed" button on /oracle (via /api/oracle/stats).TELEGRAM_ORACLE_CHAT_ID=ORACLE_ALERT_MIN_TIER=strong+# Score floor for channel posts, independent of tier. 56 tracks the top of the+# real score distribution (~a dozen posts/day). Set 101 to disable the score+# path and post only on tier crossings.+ORACLE_FEED_MIN_SCORE=56# ── x402 spending ledger ─────────────────────────────────────────────────────# Set to "1" to allow the per-user x402 spending ledger to fall back to andiff --git a/api/cron/oracle-digest.js b/api/cron/oracle-digest.jsindex ec8b57e43..c64399480 100644--- a/api/cron/oracle-digest.js+++ b/api/cron/oracle-digest.js@@ -1,14 +1,19 @@// GET /api/cron/oracle-digest — daily Oracle conviction digest via Telegram.//-// Runs once daily (08:00 UTC) and sends each armed Oracle subscriber a personal-// summary of:-// • Their agent's armed status and mode-// • Today's action count, wins, losses, open positions-// • Realized PnL for the past 24 hours-// • Up to 3 top-conviction coins currently above their threshold+// Runs once daily (08:00 UTC). Three lanes://-// Only fires for watches with telegram_chat_id set. Fire-and-forget per-// subscriber — one failure never blocks others. Respects CRON_SECRET auth.+// 1. Channel digest — a platform-wide summary posted to the public signals+// channel (TELEGRAM_ORACLE_CHAT_ID): coins scored, top conviction of the+// day, agent action stats. Fires whenever the channel is configured,+// even with zero personal subscribers, so the feed always has a daily+// anchor post.+// 2. Owner digests — each armed Oracle subscriber (telegram_chat_id on+// their watch) gets their agent's armed status, action count, W/L,+// realized PnL, and top coins above their threshold.+// 3. Follower digests — users following agents they don't own.+//+// Fire-and-forget per recipient — one failure never blocks others. Respects+// CRON_SECRET auth.import { error, json, method, wrapCron } from '../_lib/http.js';import { env } from '../_lib/env.js';@@ -171,6 +176,62 @@ async function sendDigest(chatId, text) {}}+/** Platform-wide 24h stats for the channel digest. Exported for tests. */+export async function platformDayStats(network) {+ const since = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();+ const [scored] = await sql`+ select count(*)::int as n+ from oracle_conviction+ where network = ${network} and scored_at > ${since}::timestamptz+ `.catch(() => [{ n: 0 }]);+ const [actions] = await sql`+ select count(*)::int as total,+ count(*) filter (where outcome = 'win')::int as wins,+ count(*) filter (where outcome = 'loss')::int as losses,+ coalesce(sum(realized_pnl_sol), 0) as pnl+ from oracle_watch_actions+ where network = ${network} and acted_at > ${since}::timestamptz+ `.catch(() => [{ total: 0, wins: 0, losses: 0, pnl: 0 }]);+ const top = await sql`+ select mint, symbol, score, tier, category+ from oracle_conviction+ where network = ${network} and scored_at > ${since}::timestamptz+ order by score desc+ limit 5+ `.catch(() => []);+ return { scored: scored?.n ?? 0, actions: actions ?? { total: 0, wins: 0, losses: 0, pnl: 0 }, top };+}++/** Render the channel digest message. Exported for tests. */+export function buildChannelDigest({ scored, actions, top }) {+ const lines = [+ `🔮 <b>Oracle daily digest</b>`,+ `Scored <b>${scored.toLocaleString('en-US')}</b> pump.fun launches in the last 24h.`,+ ``,+ ];++ if (top.length) {+ lines.push(`<b>Top conviction today</b>`);+ for (const c of top) {+ const e = TIER_EMOJI[c.tier] || '⚪';+ const cat = c.category && c.category !== 'unknown' ? ` · ${esc(c.category)}` : '';+ lines.push(`${e} <b>$${esc(c.symbol || c.mint.slice(0, 6))}</b> · <code>${c.score}</code>${cat} · <a href="https://three.ws/oracle/coin/${encodeURIComponent(c.mint)}">view</a>`);+ }+ lines.push(``);+ } else {+ lines.push(`<i>No launches cleared the scoring floor today.</i>`, ``);+ }++ if (actions.total > 0) {+ const pnl = Number(actions.pnl) || 0;+ const pnlStr = pnl !== 0 ? ` · PnL <b>${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL</b>` : '';+ lines.push(`<b>Agents</b> ${actions.total} action${actions.total !== 1 ? 's' : ''} · ${actions.wins}W / ${actions.losses}L${pnlStr}`, ``);+ }++ lines.push(`<a href="https://three.ws/oracle">Open the live feed →</a>`);+ return lines.join('\n');+}+function buildMessage(watch, stats, coins) {const armedLabel = watch.armed? (watch.mode === 'live' ? '🟢 Armed · live' : '🟡 Armed · simulate')@@ -218,12 +279,21 @@ export default wrapCron(async (req, res) => {const token = process.env.TELEGRAM_BOT_TOKEN;if (!token) return json(res, 200, { ok: true, sent: 0, reason: 'TELEGRAM_BOT_TOKEN not set' });- const watches = await subscribedWatches(network);- if (!watches.length) return json(res, 200, { ok: true, sent: 0 });-let sent = 0;let failed = 0;+ // Channel digest — the public signals channel gets a platform-wide daily+ // anchor post whenever it is configured, independent of personal subscribers.+ let channelSent = false;+ const channelChatId = process.env.TELEGRAM_ORACLE_CHAT_ID;+ if (channelChatId) {+ const day = await platformDayStats(network);+ channelSent = await sendDigest(channelChatId, buildChannelDigest(day));+ if (channelSent) sent++; else failed++;+ }++ const watches = await subscribedWatches(network);+// Digest for armed agent ownersfor (const watch of watches) {const [stats, coins] = await Promise.all([@@ -251,5 +321,5 @@ export default wrapCron(async (req, res) => {if (ok) sent++; else failed++;}- return json(res, 200, { ok: true, network, subscribers: watches.length + followers.length, sent, failed });+ return json(res, 200, { ok: true, network, channel: channelChatId ? channelSent : null, subscribers: watches.length + followers.length, sent, failed });});diff --git a/api/oracle/stats.js b/api/oracle/stats.jsindex e8436cc0e..2ba21b1be 100644--- a/api/oracle/stats.js+++ b/api/oracle/stats.js@@ -26,6 +26,11 @@** open_actions — oracle_watch_actions rows still open (not yet settled)* agents_armed — distinct agent_ids currently armed (armed = true)+ * telegram_channel — public t.me URL of the Oracle signals channel, when+ * TELEGRAM_ORACLE_CHAT_ID is a public @handle (null for+ * numeric/private IDs or when unconfigured). The /oracle+ * page renders its "Join the Telegram feed" button from+ * this, so the button appears only when the feed is live.** Public, no auth, aggressively cached (60s). Used by the dashboard* overview card and the oracle landing-page hero.@@ -38,6 +43,17 @@ import { QUOTE_MINT_LIST } from '../_lib/quote-mints.js';const NETWORKS = new Set(['mainnet', 'devnet']);+/**+ * Public join URL for the Oracle signals channel. Only @handle chat IDs are+ * public — a numeric -100… ID is a private channel with no join link, so it+ * is deliberately not exposed.+ */+function telegramChannelUrl() {+ const chatId = (process.env.TELEGRAM_ORACLE_CHAT_ID || '').trim();+ if (!/^@[A-Za-z0-9_]{3,32}$/.test(chatId)) return null;+ return `https://t.me/${chatId.slice(1)}`;+}+export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;if (!method(req, res, ['GET'])) return;@@ -141,6 +157,7 @@ export default wrap(async (req, res) => {market_base_rate: marketBaseRate,market_best_ath: o.market_best_ath != null ? Number(o.market_best_ath) : null,agents_armed: Number(ar.agents_armed) || 0,+ telegram_channel: telegramChannelUrl(),}, {'cache-control': 'public, max-age=60, s-maxage=60, stale-while-revalidate=120',});diff --git a/data/pages.json b/data/pages.jsonindex 71b7aa5f4..6a87cd3c4 100644--- a/data/pages.json+++ b/data/pages.json@@ -1063,6 +1063,15 @@"changefreq": "daily","added": "2026-07-31","showcase": true+ },+ {+ "path": "/holo",+ "title": "Holo Sticker",+ "description": "A live holographic foil sticker rendered in your browser: tilt it with your pointer, peel the corner, switch foils, die-cut your own text, and download the frame as a PNG. Fully procedural, no assets.",+ "priority": 0.6,+ "changefreq": "weekly",+ "showcase": true,+ "added": "2026-08-02"}]},diff --git a/docs/oracle.md b/docs/oracle.mdindex f5eac1fe1..992c7345e 100644--- a/docs/oracle.md+++ b/docs/oracle.md@@ -219,6 +219,8 @@ This is where the engine earns its keep. One score, many consumers.**Alerts and the social layer.** Armed agents alert their owners on Telegram on entries and on conviction drops for held coins. And any user can follow any agent at `/api/oracle/follow`, the watch tier of social copy-trading: pick an agent, set your own minimum score, and get pinged when it acts. The test-alert endpoint lets you verify your wiring before anything real fires.+**The Telegram channel feed.** The whole Oracle also runs as a public Telegram channel, so you can hold the feed in your pocket without keeping a tab open. Three kinds of posts flow into it. Live signals: the scoring cron sweeps every two minutes and posts each coin the first time it crosses the feed floor, either by tier (`ORACLE_ALERT_MIN_TIER`, prime and strong by default) or by raw score (`ORACLE_FEED_MIN_SCORE`, default 56, the Lean boundary tracking the top slice of the live distribution). Agent activity: live entries and profitable exits post as they happen, with the agent's track-record link. A daily digest at 08:00 UTC anchors the channel with the day's scored count, top conviction, and platform-wide agent results. Every post carries the coin's mint, score, tier, and pillar breakdown, plus links back to the pump.fun page and the Oracle coin page. The channel is set by `TELEGRAM_ORACLE_CHAT_ID`; when it is a public @handle, `/api/oracle/stats` exposes the join URL and the /oracle hero renders a "Join the live Telegram feed" button. Each coin posts exactly once, deduplicated in-process and durably via `oracle_conviction.alerted_at`.+**The coin pages.** Every Oracle coin page (`/oracle/coin/<mint>`) renders in the markets-hub design, the same editorial system as `/coin/bitcoin`: breadcrumbs, a coin header with the live price and 24h/7d change chips, a conviction card with the score dial and four pillar bars, and stacked full-width sections. It fuses conviction with a live market intel aggregator that fans out to six real sources in parallel: DexScreener, the pump.fun API, GeckoTerminal, GoPlus, Birdeye, and CoinGecko. Price, liquidity, FDV, bonding curve progress, holder count, top ten concentration, mint and freeze authority, all in one view, every number traced to a live upstream. Each source is isolated, so one being down degrades that slice to null instead of failing the page. A Launch Intelligence section brings the Coin Radar engine's first-90-seconds read onto the same page: quality score, organic versus bundle, risk flags, the full signal breakdown, smart-money buyers, and the top-trader ledger. It also shows the who-is-in breakdown: every early wallet labeled by archetype and track record. That trader-classification surface is what the product is built around. The price chart keeps the TradingView-grade DexScreener candles embed alongside a native line view and an agent-trades view that plots every three.ws agent buy and sell on the series.## The x402 layer: intel with a price tagdiff --git a/pages/holo.html b/pages/holo.htmlnew file mode 100644index 000000000..8525e47ce--- /dev/null+++ b/pages/holo.html@@ -0,0 +1,129 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <script>/* three.ws theme boot: no-flash */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />+ <title>Holo Sticker · three.ws</title>+ <meta name="description" content="A real-time holographic foil sticker rendered in your browser. Tilt it with your pointer, peel the corner, switch foils, die-cut any text into a sticker, and download the frame as a PNG. All procedural, no assets." />+ <link rel="canonical" href="https://three.ws/holo" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/manifest.webmanifest" />+ <link rel="stylesheet" href="/style.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/mobile.css" />+ <link rel="stylesheet" href="/src/holo.css" />+ <meta property="og:type" content="website" />+ <meta property="og:title" content="Holo Sticker · three.ws" />+ <meta property="og:description" content="A live holographic foil sticker in your browser: tilt it, peel it, die-cut your own text, download the PNG." />+ <meta property="og:url" content="https://three.ws/holo" />+ <meta property="og:image" content="https://three.ws/api/page-og?s=labs&t=Holo+Sticker&d=A+live+holographic+foil+sticker+in+your+browser.+Tilt+it%2C+peel+it%2C+die-cut+your+own+text.&p=%2Fholo" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:title" content="Holo Sticker · three.ws" />+ <meta name="twitter:description" content="A live holographic foil sticker in your browser: tilt it, peel it, die-cut your own text, download the PNG." />+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=labs&t=Holo+Sticker&d=A+live+holographic+foil+sticker+in+your+browser.&p=%2Fholo" />+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />+ <meta property="og:locale" content="en_US" />+ <meta property="og:image:alt" content="Holo Sticker / three.ws" />+ <meta name="twitter:site" content="@trythreews" />+</head>+<body>+ <header class="site-header"><div id="nav-container"></div></header>+ <script src="/nav.js"></script>++ <main class="hs-wrap">+ <section class="hs-hero">+ <h1>Holo Sticker</h1>+ <p>+ A holographic foil sticker, rendered live. The die-cut outline, the iridescent foil, the light it+ reflects, and the peeling corner are all computed in your browser: no images, no model files.+ Tilt it with your pointer the way you would tilt the real thing, or type your own text and get it+ cut into a sticker of its own.+ </p>+ </section>++ <div class="hs-grid">+ <section class="hs-stage-col">+ <div class="hs-stage" id="stage" data-state="loading" data-hint="on" tabindex="0" role="img" aria-label="Interactive 3D holographic sticker. Drag or use arrow keys to tilt.">+ <canvas id="holoCanvas" aria-hidden="true"></canvas>+ <p class="hs-hint" aria-hidden="true">drag to tilt</p>+ <div class="hs-error">+ <p>+ This page needs WebGL and your browser did not provide a context. Enable hardware+ acceleration or try another browser, then reload.+ </p>+ </div>+ </div>+ </section>++ <aside class="hs-rail">+ <section class="hs-panel">+ <h2 class="hs-panel-h">Mark</h2>+ <div class="hs-chips" id="markChips" role="radiogroup" aria-label="Sticker mark">+ <button type="button" class="hs-chip is-on" role="radio" aria-checked="true" data-mark="chevrons">Chevrons</button>+ <button type="button" class="hs-chip" role="radio" aria-checked="false" data-mark="three">$THREE</button>+ <button type="button" class="hs-chip" role="radio" aria-checked="false" data-mark="threews">three.ws</button>+ <button type="button" class="hs-chip" role="radio" aria-checked="false" data-mark="custom">Your text</button>+ </div>+ <div class="hs-custom" id="customRow" hidden>+ <label class="hs-label" for="customInput">Text to die-cut (up to 16 characters)</label>+ <span class="hs-input-row">+ <input type="text" id="customInput" class="hs-input" maxlength="16" placeholder="gm" spellcheck="false" autocomplete="off" />+ <button type="button" class="hs-btn hs-btn-secondary" id="btnCustom">Cut it</button>+ </span>+ </div>+ </section>++ <section class="hs-panel">+ <h2 class="hs-panel-h">Foil</h2>+ <div class="hs-chips" id="foilChips" role="radiogroup" aria-label="Foil finish"></div>+ </section>++ <section class="hs-panel">+ <h2 class="hs-panel-h">Peel</h2>+ <label class="hs-label" for="peelRange">Corner peel <b id="peelVal">24%</b></label>+ <input type="range" id="peelRange" class="hs-range" min="0" max="100" step="1" value="24" />+ </section>++ <section class="hs-panel hs-actions">+ <button type="button" class="hs-btn hs-btn-primary" id="btnPng">Download PNG</button>+ <button type="button" class="hs-btn hs-btn-secondary" id="btnResetView">Reset</button>+ </section>++ <section class="hs-panel hs-how">+ <h2 class="hs-panel-h">How it works</h2>+ <p>+ The mark is rasterized, dilated by a disc the way a cutter adds a margin, and traced back+ into vector outlines with marching squares, holes included. The foil is a physical material+ with thin-film iridescence, and the peel is a vertex-shader cylinder roll, so the light on+ the curled lip is real.+ </p>+ </section>+ </aside>+ </div>++ <section class="hs-next">+ <h2>Next</h2>+ <div class="hs-next-grid">+ <a class="hs-next-card" href="/create">+ <strong>Make a 3D avatar</strong>+ <span>Generate a rigged, animated avatar from a prompt or a photo.</span>+ </a>+ <a class="hs-next-card" href="/render-lab">+ <strong>Render Lab</strong>+ <span>Compose real avatar renders against the live API and copy the exact call.</span>+ </a>+ <a class="hs-next-card" href="/animations">+ <strong>Animation Gallery</strong>+ <span>Every animation clip in the library, previewed live on a real rig.</span>+ </a>+ </div>+ </section>+ </main>++ <script type="module" src="/src/holo.js"></script>+ <script type="module" src="/i18n.js"></script>+</body>+</html>diff --git a/pages/oracle.html b/pages/oracle.htmlindex 1915e3334..9fd790c01 100644--- a/pages/oracle.html+++ b/pages/oracle.html@@ -651,6 +651,13 @@<span class="eyebrow" data-i18n-html="oracle.live_fused_conviction"><i id="liveDot"></i> <span id="liveLabel">Live · fused conviction</span></span><h1 data-i18n-html="oracle.stop_guessing_the_coin_know_the_conviction">Stop guessing the coin.<br><span>Know the conviction.</span></h1><p data-i18n-html="oracle.oracle_fuses_four_reads_on_every_pump">Oracle fuses four reads on every pump.fun launch — <b>who's</b> buying it (proven-wallet pedigree), <b>how</b> it's being bought (bundle vs. organic structure), <b>what</b> it is (cultural narrative), and <b>how</b> it's moving — into one transparent 0–100 conviction score. The more coins and wallets we watch, the sharper every score. Then arm your 3D agent to act on the plays that clear your bar. <a href="/oracle/docs" style="color:var(--ink);border-bottom:1px solid var(--stroke-strong);white-space:nowrap">Read the docs ↗</a></p>+ <a class="btn" id="tgFeedBtn" href="#" target="_blank" rel="noopener" hidden+ style="margin-top:14px"+ title="Every top-conviction signal, agent entry, and win, pushed live to Telegram"+ aria-label="Join the Oracle Telegram signal feed">+ <svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M21.9 4.06a1.5 1.5 0 0 0-2.03-1.1L2.9 9.6c-1.24.48-1.2 2.24.06 2.66l4.53 1.51 1.72 5.36c.38 1.17 1.86 1.5 2.7.6l2.34-2.5 4.6 3.38c1.02.75 2.47.2 2.72-1.04l2.4-13.5a1.5 1.5 0 0 0-.07-1.01ZM9.1 13.03l8.03-5.02c.4-.25.8.3.46.62l-6.4 5.93a1.5 1.5 0 0 0-.47.9l-.27 2.13-1.35-4.56Z"/></svg>+ <span>Join the live Telegram feed</span>+ </a><div class="statline" id="statline"><div class="stat" title="Conviction scores produced in the last 24 hours"><span data-i18n="oracle.scored_24h">Scored 24h</span><b id="stScored">—</b><span class="stat-sub" id="stScoredSub"></span>diff --git a/src/holo.css b/src/holo.cssnew file mode 100644index 000000000..b248d4ed6--- /dev/null+++ b/src/holo.css@@ -0,0 +1,121 @@+/* Holo Sticker: page chrome rides the platform tokens; the stage itself is+ deliberately black in both themes, because the piece is foil on a void. */++:root {+ --hs-maxw: 1180px;+ --hs-rail: 340px;+ --hs-gap: 18px;+}++* { box-sizing: border-box; }+html, body { margin: 0; background: var(--bg-0); color: var(--ink); }+body { font-family: var(--font-body, 'Inter', system-ui, sans-serif); min-height: 100vh; }+.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg-0) 82%, transparent); backdrop-filter: blur(10px); }++.hs-wrap { max-width: var(--hs-maxw); margin: 0 auto; padding: 0 18px 96px; }++.hs-hero { padding: 34px 0 20px; }+.hs-hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.02em; color: var(--ink-bright, var(--ink)); }+.hs-hero p { margin: 0; max-width: 74ch; color: var(--ink-dim); line-height: 1.65; }++.hs-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--hs-rail); gap: var(--hs-gap); align-items: start; }+.hs-rail { display: flex; flex-direction: column; gap: var(--hs-gap); position: sticky; top: 76px; }++@media (max-width: 1000px) {+ .hs-grid { grid-template-columns: minmax(0, 1fr); }+ .hs-rail { position: static; }+}++/* ── stage ──────────────────────────────────────────────────────────── */+.hs-stage {+ position: relative;+ aspect-ratio: 1 / 1;+ max-height: 78vh;+ border-radius: var(--radius-card, 14px);+ border: 1px solid var(--card-border);+ background: #000;+ overflow: hidden;+ cursor: grab;+ touch-action: none;+}+.hs-stage:active { cursor: grabbing; }+.hs-stage:focus-visible { outline: 2px solid var(--accent, #7c8cff); outline-offset: 2px; }+.hs-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 400ms ease; }+.hs-stage[data-state="ready"] canvas { opacity: 1; }++.hs-hint {+ position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);+ margin: 0; padding: 5px 14px; border-radius: 999px;+ font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;+ color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.07);+ border: 1px solid rgba(255, 255, 255, 0.1);+ pointer-events: none; opacity: 1; transition: opacity 500ms ease;+}+.hs-stage[data-hint="off"] .hs-hint, .hs-stage[data-state="error"] .hs-hint { opacity: 0; }++.hs-error { position: absolute; inset: 0; display: none; place-items: center; padding: 24px; }+.hs-stage[data-state="error"] .hs-error { display: grid; }+.hs-error p { margin: 0; max-width: 42ch; text-align: center; color: rgba(255, 255, 255, 0.75); line-height: 1.6; }++/* ── panels ─────────────────────────────────────────────────────────── */+.hs-panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-card, 14px); padding: 16px; }+.hs-panel-h { margin: 0 0 12px; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dim); font-weight: 600; }+.hs-how p { margin: 0; font-size: 0.85rem; color: var(--ink-dim); line-height: 1.6; }++.hs-chips { display: flex; flex-wrap: wrap; gap: 8px; }+.hs-chip {+ padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 500;+ color: var(--ink-dim); background: var(--surface-1); border: 1px solid var(--card-border);+ cursor: pointer; transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;+}+.hs-chip:hover { color: var(--ink-bright, var(--ink)); border-color: var(--ink-dim); transform: translateY(-1px); }+.hs-chip:active { transform: translateY(0); }+.hs-chip:focus-visible { outline: 2px solid var(--accent, #7c8cff); outline-offset: 2px; }+.hs-chip.is-on { color: var(--ink-bright, var(--ink)); background: var(--surface-2); border-color: var(--accent, #7c8cff); }++.hs-custom { margin-top: 12px; }+.hs-label { display: block; font-size: 0.82rem; color: var(--ink-dim); margin-bottom: 8px; }+.hs-label b { color: var(--ink-bright, var(--ink)); font-weight: 600; }+.hs-input-row { display: flex; gap: 8px; }+.hs-input {+ flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; font: inherit; font-size: 0.9rem;+ color: var(--ink); background: var(--surface-1); border: 1px solid var(--card-border);+ transition: border-color 140ms ease;+}+.hs-input:focus { outline: none; border-color: var(--accent, #7c8cff); }+.hs-input[aria-invalid="true"] { border-color: var(--danger, #f87171); }++.hs-range { width: 100%; accent-color: var(--accent, #7c8cff); cursor: pointer; }+.hs-range:focus-visible { outline: 2px solid var(--accent, #7c8cff); outline-offset: 4px; border-radius: 4px; }++.hs-actions { display: flex; gap: 10px; }+.hs-btn {+ padding: 9px 16px; border-radius: 10px; font: inherit; font-size: 0.9rem; font-weight: 600;+ cursor: pointer; border: 1px solid transparent;+ transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;+}+.hs-btn:hover { transform: translateY(-1px); }+.hs-btn:active { transform: translateY(0); }+.hs-btn:focus-visible { outline: 2px solid var(--accent, #7c8cff); outline-offset: 2px; }+.hs-btn-primary { flex: 1; color: #0b0d12; background: var(--accent, #7c8cff); }+.hs-btn-primary:hover { filter: brightness(1.08); }+.hs-btn-secondary { color: var(--ink); background: var(--surface-1); border-color: var(--card-border); }+.hs-btn-secondary:hover { border-color: var(--ink-dim); }++/* ── next ───────────────────────────────────────────────────────────── */+.hs-next { margin-top: 42px; }+.hs-next h2 { font-size: 1.05rem; margin: 0 0 14px; color: var(--ink-bright, var(--ink)); }+.hs-next-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }+.hs-next-card {+ display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius-card, 14px);+ background: var(--card-bg); border: 1px solid var(--card-border); text-decoration: none; color: inherit;+ transition: border-color 140ms ease, transform 140ms ease;+}+.hs-next-card:hover { border-color: var(--ink-dim); transform: translateY(-2px); }+.hs-next-card:focus-visible { outline: 2px solid var(--accent, #7c8cff); outline-offset: 2px; }+.hs-next-card strong { color: var(--ink-bright, var(--ink)); }+.hs-next-card span { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.55; }++@media (prefers-reduced-motion: reduce) {+ .hs-stage canvas, .hs-hint, .hs-chip, .hs-btn, .hs-next-card { transition: none; }+}diff --git a/src/holo.js b/src/holo.jsnew file mode 100644index 000000000..a5058b98a--- /dev/null+++ b/src/holo.js@@ -0,0 +1,757 @@+// Holo Sticker: a real-time holographic foil sticker rendered with physical+// materials, born from the die-cut sticker aesthetic (black void, iridescent+// foil, one corner peeling up).+//+// Everything on screen is procedural. The mark is rasterized to an offscreen+// 2D canvas, the die-cut base is that raster dilated by a disc (which is what+// a real sticker cutter does), and both outlines are vectorized back into+// THREE.Shape contours with a marching-squares tracer, so any mark, including+// arbitrary text typed into the panel, becomes a correctly cut sticker with+// rounded corners, notches between islands, and holes inside letters.+//+// The peel is a vertex-shader cylinder roll injected into MeshPhysicalMaterial+// via onBeforeCompile: geometry past a fold line wraps around a virtual+// cylinder, normals rotate with it, so the lighting on the curled lip is real.++import * as THREE from 'three';++const $ = (id) => document.getElementById(id);++/* ── mark rasterization ─────────────────────────────────────────────── */++const RASTER = 640; // offscreen raster resolution, px++function makeCanvas(size) {+ const c = document.createElement('canvas');+ c.width = c.height = size;+ return c;+}++// The chevron mark: three skewed bars stacked like the Solana logomark. All+// slants are 45 degrees so the die-cut notches between bars come out crisp.+function drawChevronMark(ctx, size) {+ const h = size * 0.148; // bar height+ const g = size * 0.082; // gap between bars+ const s = h; // 45 degree skew+ const w = size * 0.62; // long-edge length+ const totalW = w + s;+ const totalH = 3 * h + 2 * g;+ const x0 = (size - totalW) / 2;+ const y0 = (size - totalH) / 2;+ const corner = size * 0.018;++ // Top and bottom bars skew one way, the middle bar mirrors them.+ const bar = (yTop, flip) => {+ const yBot = yTop + h;+ return flip+ ? [[x0, yTop], [x0 + w, yTop], [x0 + w + s, yBot], [x0 + s, yBot]]+ : [[x0 + s, yTop], [x0 + s + w, yTop], [x0 + w, yBot], [x0, yBot]];+ };+ const bars = [bar(y0, false), bar(y0 + h + g, true), bar(y0 + 2 * (h + g), false)];++ ctx.fillStyle = '#fff';+ ctx.strokeStyle = '#fff';+ ctx.lineJoin = 'round';+ ctx.lineWidth = corner * 2; // round-join stroke rounds the corners+ for (const pts of bars) {+ ctx.beginPath();+ pts.forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y)));+ ctx.closePath();+ ctx.fill();+ ctx.stroke();+ }+}++function drawTextMark(ctx, size, text) {+ const pad = size * 0.1;+ let fontSize = size * 0.36;+ const font = (px) => `900 ${px}px Inter, 'Helvetica Neue', Arial, system-ui, sans-serif`;+ ctx.font = font(fontSize);+ const w = ctx.measureText(text).width;+ if (w > size - pad * 2) fontSize *= (size - pad * 2) / w;+ fontSize = Math.max(fontSize, size * 0.06);+ ctx.font = font(fontSize);+ ctx.textAlign = 'center';+ ctx.textBaseline = 'middle';+ ctx.fillStyle = '#fff';+ ctx.fillText(text, size / 2, size / 2 + fontSize * 0.04);+}++// Dilate the mark by a disc: stamp the mark image around a circle. This is the+// die-cut margin, and it merges nearby islands exactly like a real cut line.+function dilate(markCanvas, radius) {+ const c = makeCanvas(markCanvas.width);+ const ctx = c.getContext('2d');+ const steps = 48;+ for (let i = 0; i < steps; i++) {+ const a = (i / steps) * Math.PI * 2;+ ctx.drawImage(markCanvas, Math.cos(a) * radius, Math.sin(a) * radius);+ }+ ctx.drawImage(markCanvas, 0, 0);+ return c;+}++/* ── contour tracing (marching squares) ─────────────────────────────── */++// Trace all closed contours of the alpha channel. Returns arrays of [x, y]+// points in canvas pixel coordinates. Saddle cells use a fixed pairing so+// every edge midpoint has degree exactly 2 and loop stitching cannot fork.+function traceContours(canvas) {+ const size = canvas.width;+ const data = canvas.getContext('2d').getImageData(0, 0, size, size).data;+ const pad = 2;+ const W = size + pad * 2;+ const grid = new Uint8Array(W * W);+ for (let y = 0; y < size; y++) {+ for (let x = 0; x < size; x++) {+ if (data[(y * size + x) * 4 + 3] > 127) grid[(y + pad) * W + (x + pad)] = 1;+ }+ }+ const at = (x, y) => grid[y * W + x];++ // Midpoint keys in doubled integer coordinates, per cell (x, y):+ // T = (2x+1, 2y) R = (2x+2, 2y+1) B = (2x+1, 2y+2) L = (2x, 2y+1)+ const T = 0, R = 1, B = 2, L = 3;+ const midKey = (x, y, e) => {+ const mx = e === L ? 2 * x : e === R ? 2 * x + 2 : 2 * x + 1;+ const my = e === T ? 2 * y : e === B ? 2 * y + 2 : 2 * y + 1;+ return my * (2 * W + 2) + mx;+ };+ const SEGS = [+ null, [[L, B]], [[B, R]], [[L, R]],+ [[T, R]], [[T, R], [L, B]], [[T, B]], [[T, L]],+ [[T, L]], [[T, B]], [[T, L], [B, R]], [[T, R]],+ [[L, R]], [[B, R]], [[L, B]], null,+ ];++ const segments = [];+ const byPoint = new Map();+ const link = (key, seg) => {+ const list = byPoint.get(key);+ if (list) list.push(seg);+ else byPoint.set(key, [seg]);+ };+ for (let y = 0; y < W - 1; y++) {+ for (let x = 0; x < W - 1; x++) {+ const idx = at(x, y) * 8 + at(x + 1, y) * 4 + at(x + 1, y + 1) * 2 + at(x, y + 1);+ const spec = SEGS[idx];+ if (!spec) continue;+ for (const [e1, e2] of spec) {+ const seg = { a: midKey(x, y, e1), b: midKey(x, y, e2), used: false };+ segments.push(seg);+ link(seg.a, seg);+ link(seg.b, seg);+ }+ }+ }++ const stride = 2 * W + 2;+ const toPoint = (key) => [(key % stride) / 2 - pad, Math.floor(key / stride) / 2 - pad];+ const contours = [];+ for (const start of segments) {+ if (start.used) continue;+ start.used = true;+ const loop = [start.a, start.b];+ let cur = start.b;+ while (cur !== start.a) {+ const next = (byPoint.get(cur) || []).find((s) => !s.used);+ if (!next) break;+ next.used = true;+ cur = next.a === cur ? next.b : next.a;+ loop.push(cur);+ }+ if (loop.length > 8 && cur === start.a) {+ loop.pop();+ contours.push(loop.map(toPoint));+ }+ }+ return contours;+}++// Chaikin corner cutting on a closed loop, then drop near-duplicate points.+function smoothLoop(points, iterations) {+ let pts = points;+ for (let it = 0; it < iterations; it++) {+ const out = [];+ for (let i = 0; i < pts.length; i++) {+ const [ax, ay] = pts[i];+ const [bx, by] = pts[(i + 1) % pts.length];+ out.push([ax * 0.75 + bx * 0.25, ay * 0.75 + by * 0.25]);+ out.push([ax * 0.25 + bx * 0.75, ay * 0.25 + by * 0.75]);+ }+ pts = out;+ }+ const minDist = 1.4;+ const kept = [];+ let last = null;+ for (const p of pts) {+ if (!last || Math.hypot(p[0] - last[0], p[1] - last[1]) >= minDist) {+ kept.push(p);+ last = p;+ }+ }+ return kept.length >= 3 ? kept : pts;+}++const signedArea = (pts) => {+ let a = 0;+ for (let i = 0; i < pts.length; i++) {+ const [x1, y1] = pts[i];+ const [x2, y2] = pts[(i + 1) % pts.length];+ a += x1 * y2 - x2 * y1;+ }+ return a / 2;+};++const pointInPoly = ([px, py], pts) => {+ let inside = false;+ for (let i = 0, j = pts.length - 1; i < pts.length; j = i++) {+ const [xi, yi] = pts[i];+ const [xj, yj] = pts[j];+ if (yi > py !== yj > py && px < ((xj - xi) * (py - yi)) / (yj - yi) + xi) inside = !inside;+ }+ return inside;+};++// Turn traced contours into THREE.Shape objects with holes, in world units.+// transform maps canvas px to world XY (shared by base and mark so they align).+function contoursToShapes(contours, transform) {+ const entries = contours+ .map((pts) => ({ pts, area: Math.abs(signedArea(pts)) }))+ .filter((e) => e.area > 30)+ .sort((a, b) => b.area - a.area);+ for (const e of entries) {+ e.depth = entries.filter((o) => o !== e && o.area > e.area && pointInPoly(e.pts[0], o.pts)).length;+ }+ const toVec = (pts) => pts.map(([x, y]) => new THREE.Vector2(...transform(x, y)));+ const shapes = [];+ for (const e of entries) {+ if (e.depth % 2 !== 0) continue;+ const shape = new THREE.Shape(toVec(e.pts));+ const holes = entries.filter(+ (h) => h.depth === e.depth + 1 && pointInPoly(h.pts[0], e.pts)+ );+ for (const h of holes) shape.holes.push(new THREE.Path(toVec(h.pts)));+ shapes.push(shape);+ }+ return shapes;+}++/* ── sticker build ──────────────────────────────────────────────────── */++const WORLD_W = 3.1; // sticker width in world units+const BASE_DEPTH = 0.028;+const MARK_DEPTH = 0.05;++function buildStickerGeometry(markDraw) {+ const markCanvas = makeCanvas(RASTER);+ markDraw(markCanvas.getContext('2d'), RASTER);+ const baseCanvas = dilate(markCanvas, RASTER * 0.044);++ const baseContours = traceContours(baseCanvas).map((c) => smoothLoop(c, 3));+ const markContours = traceContours(markCanvas).map((c) => smoothLoop(c, 3));+ if (!baseContours.length || !markContours.length) return null;++ let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;+ for (const c of baseContours) {+ for (const [x, y] of c) {+ if (x < minX) minX = x;+ if (x > maxX) maxX = x;+ if (y < minY) minY = y;+ if (y > maxY) maxY = y;+ }+ }+ const scale = WORLD_W / (maxX - minX);+ const cx = (minX + maxX) / 2;+ const cy = (minY + maxY) / 2;+ const transform = (x, y) => [(x - cx) * scale, (cy - y) * scale];++ const baseShapes = contoursToShapes(baseContours, transform);+ const markShapes = contoursToShapes(markContours, transform);+ if (!baseShapes.length) return null;++ const base = new THREE.ExtrudeGeometry(baseShapes, {+ depth: BASE_DEPTH,+ bevelEnabled: true,+ bevelThickness: 0.016,+ bevelSize: 0.016,+ bevelSegments: 3,+ });+ const mark = markShapes.length+ ? new THREE.ExtrudeGeometry(markShapes, {+ depth: MARK_DEPTH,+ bevelEnabled: true,+ bevelThickness: 0.02,+ bevelSize: 0.02,+ bevelSegments: 4,+ })+ : null;+ if (mark) mark.translate(0, 0, BASE_DEPTH + 0.002);++ const halfH = ((maxY - minY) / 2) * scale;+ return { base, mark, halfW: WORLD_W / 2, halfH };+}++/* ── environment: the light the foil reflects ───────────────────────── */++const FOILS = {+ holo: {+ label: 'Rainbow holo',+ blobs: ['#ff4fd8', '#8a5cff', '#39d98a', '#31c4ff', '#ffd166', '#ff5c7a'],+ color: 0x9aa1a8,+ roughness: 0.16,+ iridescence: 1,+ },+ chrome: {+ label: 'Chrome',+ blobs: ['#cfd6de', '#9fb0c0', '#eef3f8', '#7d8b9a'],+ color: 0xd7dde3,+ roughness: 0.07,+ iridescence: 0.18,+ },+ gold: {+ label: 'Gold foil',+ blobs: ['#ffd166', '#ff9f43', '#fff3c4', '#b98a2f'],+ color: 0xd8ae4e,+ roughness: 0.2,+ iridescence: 0.35,+ },+ neon: {+ label: 'Neon',+ blobs: ['#ff2fd6', '#00e5ff', '#7c4dff', '#00ffa3'],+ color: 0x8f96b3,+ roughness: 0.14,+ iridescence: 1,+ },+};++// Blob placement is fixed, not random, so a reload gives the same sticker.+const BLOB_SEATS = [+ [0.12, 0.3, 0.34], [0.44, 0.62, 0.3], [0.71, 0.24, 0.36], [0.9, 0.66, 0.3],+ [0.28, 0.78, 0.26], [0.6, 0.4, 0.24], [0.05, 0.62, 0.22], [0.82, 0.4, 0.2],+];++function makeEnvTexture(blobColors) {+ const c = document.createElement('canvas');+ c.width = 1024;+ c.height = 512;+ const ctx = c.getContext('2d');+ ctx.fillStyle = '#05060a';+ ctx.fillRect(0, 0, c.width, c.height);+ BLOB_SEATS.forEach(([u, v, r], i) => {+ const color = blobColors[i % blobColors.length];+ const x = u * c.width;+ const y = v * c.height;+ const rad = r * c.height;+ const g = ctx.createRadialGradient(x, y, 0, x, y, rad);+ g.addColorStop(0, color);+ g.addColorStop(1, 'rgba(0,0,0,0)');+ ctx.globalAlpha = 0.85;+ ctx.fillStyle = g;+ ctx.fillRect(x - rad, y - rad, rad * 2, rad * 2);+ });+ // Two soft white streaks: the "softbox" bands that give foil its sheen.+ ctx.globalAlpha = 1;+ for (const [y0, hgt, alpha] of [[0.16, 0.05, 0.9], [0.58, 0.03, 0.65]]) {+ const g = ctx.createLinearGradient(0, (y0 - hgt) * c.height, 0, (y0 + hgt) * c.height);+ g.addColorStop(0, 'rgba(255,255,255,0)');+ g.addColorStop(0.5, `rgba(255,255,255,${alpha})`);+ g.addColorStop(1, 'rgba(255,255,255,0)');+ ctx.fillStyle = g;+ ctx.fillRect(0, (y0 - hgt) * c.height, c.width, hgt * 2 * c.height);+ }+ const tex = new THREE.CanvasTexture(c);+ tex.mapping = THREE.EquirectangularReflectionMapping;+ tex.colorSpace = THREE.SRGBColorSpace;+ return tex;+}++// Fine grain so the foil reads as material, not as a perfect mirror.+function makeGrainTexture() {+ const size = 256;+ const c = makeCanvas(size);+ const ctx = c.getContext('2d');+ const img = ctx.createImageData(size, size);+ for (let i = 0; i < img.data.length; i += 4) {+ const v = 200 + Math.floor(Math.random() * 55);+ img.data[i] = img.data[i + 1] = img.data[i + 2] = v;+ img.data[i + 3] = 255;+ }+ ctx.putImageData(img, 0, 0);+ const tex = new THREE.CanvasTexture(c);+ tex.wrapS = tex.wrapT = THREE.RepeatWrapping;+ tex.repeat.set(1.6, 1.6);+ return tex;+}++/* ── peel: cylinder-roll vertex deformation ─────────────────────────── */++const peelUniforms = {+ uFoldN: { value: new THREE.Vector2(Math.SQRT1_2, Math.SQRT1_2) },+ uFoldT: { value: 1000 },+ uRadius: { value: 0.2 },+ uMaxPhi: { value: Math.PI * 1.22 },+};++function injectPeel(material) {+ material.onBeforeCompile = (shader) => {+ Object.assign(shader.uniforms, peelUniforms);+ shader.vertexShader = shader.vertexShader+ .replace(+ '#include <common>',+ `#include <common>+ uniform vec2 uFoldN;+ uniform float uFoldT;+ uniform float uRadius;+ uniform float uMaxPhi;`+ )+ .replace(+ '#include <beginnormal_vertex>',+ `#include <beginnormal_vertex>+ {+ float tP = dot(position.xy, uFoldN) - uFoldT;+ if (tP > 0.0) {+ float phi = min(tP / uRadius, uMaxPhi);+ float s = sin(phi), c = cos(phi);+ float nn = dot(objectNormal.xy, uFoldN);+ vec2 tang = objectNormal.xy - uFoldN * nn;+ objectNormal.xy = tang + uFoldN * (nn * c - objectNormal.z * s);+ objectNormal.z = nn * s + objectNormal.z * c;+ }+ }`+ )+ .replace(+ '#include <begin_vertex>',+ `#include <begin_vertex>+ {+ float tP = dot(transformed.xy, uFoldN) - uFoldT;+ if (tP > 0.0) {+ float phi = min(tP / uRadius, uMaxPhi);+ float rest = max(tP - uRadius * uMaxPhi, 0.0);+ float s = sin(phi), c = cos(phi);+ float rz = uRadius - transformed.z;+ vec2 atFold = transformed.xy - uFoldN * tP;+ transformed.xy = atFold + uFoldN * (rz * s + rest * c);+ transformed.z = uRadius - rz * c + rest * s;+ }+ }`+ );+ };+ material.customProgramCacheKey = () => 'holo-peel';+ return material;+}++/* ── page wiring ────────────────────────────────────────────────────── */++const MARKS = {+ chevrons: { label: 'Chevrons', draw: drawChevronMark },+ three: { label: '$THREE', draw: (ctx, size) => drawTextMark(ctx, size, '$THREE') },+ threews: { label: 'three.ws', draw: (ctx, size) => drawTextMark(ctx, size, 'three.ws') },+};++const state = {+ mark: 'chevrons',+ customText: '',+ foil: 'holo',+ peel: 0.24,+};++const stage = $('stage');+const canvas = $('holoCanvas');+const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;++let renderer;+try {+ renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: false });+ if (!renderer.getContext()) throw new Error('no context');+} catch {+ stage.dataset.state = 'error';+ renderer = null;+}++if (renderer) init(renderer);++function init(renderer) {+ renderer.toneMapping = THREE.ACESFilmicToneMapping;+ renderer.toneMappingExposure = 1.12;+ renderer.setClearColor(0x000000, 1);++ const scene = new THREE.Scene();+ const camera = new THREE.PerspectiveCamera(34, 1, 0.1, 40);+ camera.position.set(0, 0, 7.4);++ const key = new THREE.DirectionalLight(0xffffff, 1.15);+ key.position.set(2.4, 3.2, 4.5);+ scene.add(key);+ const rim = new THREE.DirectionalLight(0x8fb8ff, 0.35);+ rim.position.set(-3, -2, 2.5);+ scene.add(rim);++ const grain = makeGrainTexture();+ const baseMaterial = injectPeel(new THREE.MeshPhysicalMaterial({+ metalness: 1,+ clearcoat: 1,+ clearcoatRoughness: 0.12,+ iridescenceIOR: 1.32,+ iridescenceThicknessRange: [120, 480],+ roughnessMap: grain,+ side: THREE.DoubleSide,+ envMapIntensity: 1.25,+ }));+ const markMaterial = injectPeel(new THREE.MeshPhysicalMaterial({+ metalness: 1,+ clearcoat: 1,+ clearcoatRoughness: 0.18,+ iridescenceIOR: 1.28,+ iridescenceThicknessRange: [160, 620],+ roughnessMap: grain,+ bumpMap: grain,+ bumpScale: 0.35,+ side: THREE.DoubleSide,+ envMapIntensity: 1.4,+ }));++ const group = new THREE.Group();+ scene.add(group);+ let sticker = { halfW: WORLD_W / 2, halfH: WORLD_W / 2 };++ const pmrem = new THREE.PMREMGenerator(renderer);+ const envCache = new Map();+ function applyFoil(name) {+ const foil = FOILS[name];+ if (!envCache.has(name)) {+ const equirect = makeEnvTexture(foil.blobs);+ envCache.set(name, pmrem.fromEquirectangular(equirect).texture);+ equirect.dispose();+ }+ scene.environment = envCache.get(name);+ baseMaterial.color.set(foil.color).multiplyScalar(0.55);+ baseMaterial.roughness = Math.min(foil.roughness + 0.06, 1);+ baseMaterial.iridescence = foil.iridescence;+ markMaterial.color.set(foil.color);+ markMaterial.roughness = foil.roughness;+ markMaterial.iridescence = foil.iridescence;+ }++ function rebuild() {+ const draw = state.mark === 'custom'+ ? (ctx, size) => drawTextMark(ctx, size, state.customText)+ : MARKS[state.mark].draw;+ const built = buildStickerGeometry(draw);+ if (!built) return false;+ for (const child of [...group.children]) {+ group.remove(child);+ child.geometry.dispose();+ }+ group.add(new THREE.Mesh(built.base, baseMaterial));+ if (built.mark) group.add(new THREE.Mesh(built.mark, markMaterial));+ sticker = built;+ return true;+ }++ function updatePeel(amount) {+ const cornerT = (sticker.halfW + sticker.halfH) * Math.SQRT1_2;+ peelUniforms.uFoldT.value = amount <= 0.001+ ? cornerT + 1+ : cornerT - amount * 1.35;+ peelUniforms.uRadius.value = 0.13 + amount * 0.1;+ }++ /* interaction: pointer tilt with spring, drag for full control */+ const target = { x: 0, y: 0 };+ const current = { x: 0, y: 0 };+ let dragging = false;+ let dragBase = null;+ let interacted = false;++ const markInteracted = () => {+ if (!interacted) {+ interacted = true;+ stage.dataset.hint = 'off';+ }+ };++ stage.addEventListener('pointermove', (e) => {+ const rect = stage.getBoundingClientRect();+ const nx = ((e.clientX - rect.left) / rect.width) * 2 - 1;+ const ny = ((e.clientY - rect.top) / rect.height) * 2 - 1;+ if (dragging && dragBase) {+ target.y = dragBase.ry + (nx - dragBase.nx) * 2.4;+ target.x = dragBase.rx + (ny - dragBase.ny) * 2.4;+ } else {+ target.y = nx * 0.42;+ target.x = ny * 0.34;+ }+ });+ stage.addEventListener('pointerdown', (e) => {+ markInteracted();+ dragging = true;+ const rect = stage.getBoundingClientRect();+ dragBase = {+ nx: ((e.clientX - rect.left) / rect.width) * 2 - 1,+ ny: ((e.clientY - rect.top) / rect.height) * 2 - 1,+ rx: target.x,+ ry: target.y,+ };+ stage.setPointerCapture(e.pointerId);+ });+ const endDrag = () => {+ dragging = false;+ dragBase = null;+ };+ stage.addEventListener('pointerup', endDrag);+ stage.addEventListener('pointercancel', endDrag);+ stage.addEventListener('pointerleave', () => {+ if (!dragging) target.x = target.y = 0;+ });+ stage.addEventListener('keydown', (e) => {+ const step = 0.12;+ const moves = {+ ArrowLeft: () => (target.y -= step),+ ArrowRight: () => (target.y += step),+ ArrowUp: () => (target.x -= step),+ ArrowDown: () => (target.x += step),+ };+ if (moves[e.key]) {+ e.preventDefault();+ markInteracted();+ moves[e.key]();+ target.x = THREE.MathUtils.clamp(target.x, -1.1, 1.1);+ target.y = THREE.MathUtils.clamp(target.y, -1.1, 1.1);+ }+ });++ function resize() {+ const rect = stage.getBoundingClientRect();+ const w = Math.max(1, Math.round(rect.width));+ const h = Math.max(1, Math.round(rect.height));+ renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));+ renderer.setSize(w, h, false);+ camera.aspect = w / h;+ camera.updateProjectionMatrix();+ }+ new ResizeObserver(resize).observe(stage);++ const clock = new THREE.Clock();+ function frame() {+ const t = clock.getElapsedTime();+ const wobble = reducedMotion ? 0 : 1;+ current.x += (target.x - current.x) * 0.09;+ current.y += (target.y - current.y) * 0.09;+ group.rotation.x = current.x + Math.sin(t * 0.5) * 0.03 * wobble;+ group.rotation.y = current.y + Math.sin(t * 0.35) * 0.05 * wobble;+ group.rotation.z = -0.05;+ group.position.y = Math.sin(t * 0.6) * 0.04 * wobble;+ const breathe = reducedMotion ? 0 : Math.sin(t * 0.8) * 0.028;+ updatePeel(THREE.MathUtils.clamp(state.peel + breathe, 0, 1));+ renderer.render(scene, camera);+ requestAnimationFrame(frame);+ }++ /* controls */+ const markChips = $('markChips');+ const customRow = $('customRow');+ const customInput = $('customInput');++ function renderMarkChips() {+ markChips.querySelectorAll('.hs-chip').forEach((b) => {+ b.classList.toggle('is-on', b.dataset.mark === state.mark);+ b.setAttribute('aria-checked', String(b.dataset.mark === state.mark));+ });+ customRow.hidden = state.mark !== 'custom';+ }+ markChips.addEventListener('click', (e) => {+ const btn = e.target.closest('[data-mark]');+ if (!btn) return;+ const mark = btn.dataset.mark;+ if (mark === 'custom') {+ state.mark = 'custom';+ renderMarkChips();+ customInput.focus();+ if (state.customText) rebuild();+ return;+ }+ state.mark = mark;+ renderMarkChips();+ rebuild();+ });+ const applyCustom = () => {+ const text = customInput.value.trim().slice(0, 16);+ if (!text) {+ customInput.setAttribute('aria-invalid', 'true');+ return;+ }+ customInput.removeAttribute('aria-invalid');+ state.mark = 'custom';+ state.customText = text;+ renderMarkChips();+ rebuild();+ };+ $('btnCustom').addEventListener('click', applyCustom);+ customInput.addEventListener('keydown', (e) => {+ if (e.key === 'Enter') applyCustom();+ else customInput.removeAttribute('aria-invalid');+ });++ const foilChips = $('foilChips');+ for (const [id, foil] of Object.entries(FOILS)) {+ const b = document.createElement('button');+ b.type = 'button';+ b.className = 'hs-chip';+ b.dataset.foil = id;+ b.setAttribute('role', 'radio');+ b.textContent = foil.label;+ foilChips.appendChild(b);+ }+ function renderFoilChips() {+ foilChips.querySelectorAll('.hs-chip').forEach((b) => {+ b.classList.toggle('is-on', b.dataset.foil === state.foil);+ b.setAttribute('aria-checked', String(b.dataset.foil === state.foil));+ });+ }+ foilChips.addEventListener('click', (e) => {+ const btn = e.target.closest('[data-foil]');+ if (!btn) return;+ state.foil = btn.dataset.foil;+ renderFoilChips();+ applyFoil(state.foil);+ });++ const peelRange = $('peelRange');+ peelRange.value = String(Math.round(state.peel * 100));+ peelRange.addEventListener('input', () => {+ state.peel = Number(peelRange.value) / 100;+ $('peelVal').textContent = `${peelRange.value}%`;+ });+ $('peelVal').textContent = `${peelRange.value}%`;++ $('btnPng').addEventListener('click', () => {+ renderer.render(scene, camera);+ canvas.toBlob((blob) => {+ if (!blob) return;+ const a = document.createElement('a');+ a.href = URL.createObjectURL(blob);+ a.download = 'holo-sticker.png';+ a.click();+ URL.revokeObjectURL(a.href);+ }, 'image/png');+ });+ $('btnResetView').addEventListener('click', () => {+ target.x = target.y = 0;+ state.peel = 0.24;+ peelRange.value = '24';+ $('peelVal').textContent = '24%';+ });++ /* boot */+ resize();+ applyFoil(state.foil);+ renderMarkChips();+ renderFoilChips();+ if (rebuild()) {+ stage.dataset.state = 'ready';+ frame();+ } else {+ stage.dataset.state = 'error';+ }+}diff --git a/src/oracle.js b/src/oracle.jsindex d86c2ff2b..06da3a2ff 100644--- a/src/oracle.js+++ b/src/oracle.js@@ -952,6 +952,14 @@ async function loadGlobalStats() {set('#stBaseSub', data.market_resolved? `${(data.market_wins ?? 0).toLocaleString()} / ${data.market_resolved.toLocaleString()} launches`: '');++ // Telegram signal feed: the button only exists when the deployment has a+ // public signals channel configured, so it never renders a dead link.+ const tgBtn = $('#tgFeedBtn');+ if (tgBtn && data.telegram_channel) {+ tgBtn.href = data.telegram_channel;+ tgBtn.hidden = false;+ }} catch { /* non-fatal — feed-window fallbacks already rendered */ }}diff --git a/vercel.json b/vercel.jsonindex 352416c64..96d06543d 100644--- a/vercel.json+++ b/vercel.json@@ -5180,6 +5180,14 @@"src": "/render-lab/","dest": "/render-lab.html"},+ {+ "src": "/holo",+ "dest": "/holo.html"+ },+ {+ "src": "/holo/",+ "dest": "/holo.html"+ },{"src": "/features","dest": "/features.html"diff --git a/vite.config.js b/vite.config.jsindex 5f6cea1b4..bd5062657 100644--- a/vite.config.js+++ b/vite.config.js@@ -371,6 +371,7 @@ const appConfig = {'agent-identities': resolve(__dirname, 'pages/agent-identities.html'),'mcp-tools': resolve(__dirname, 'pages/mcp-tools.html'),'render-lab': resolve(__dirname, 'pages/render-lab.html'),+ holo: resolve(__dirname, 'pages/holo.html'),bundles: resolve(__dirname, 'pages/bundles.html'),'embed-doctor': resolve(__dirname, 'pages/embed-doctor.html'),crews: resolve(__dirname, 'pages/crews.html'),