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: add star field canvas and perspective grid to enhance visual depth

nirholas468265f870e8
diff --git a/public/features/features.css b/public/features/features.css
index 97dad3fc3..c812d0ebd 100644
--- a/public/features/features.css
+++ b/public/features/features.css
@@ -104,6 +104,25 @@
pointer-events: auto;
}
+/* ── Star field canvas ───────────────────────────────────────────────────── */
+
+.layer-stars-canvas {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ pointer-events: none;
+}
+
+/* ── Perspective grid SVG (Act 1 mid layer) ─────────────────────────────── */
+
+.layer-perspective-grid {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+}
+
/* ── Background layer styles (pure CSS, no images) ──────────────────────── */
.layer-bg {
@@ -149,11 +168,11 @@
.layer-orb {
position: absolute;
- width: clamp(280px, 38vw, 560px);
+ width: clamp(400px, 55vw, 800px);
aspect-ratio: 1;
border-radius: 50%;
- filter: blur(60px);
- opacity: 0.55;
+ filter: blur(80px);
+ opacity: 0.65;
}
.layer-orb--gold {
@@ -767,4 +786,8 @@
opacity: 1;
transition: none;
}
+
+ .layer-stars-canvas {
+ display: none;
+ }
}
diff --git a/public/features/features.js b/public/features/features.js
index 605e76666..959517a6e 100644
--- a/public/features/features.js
+++ b/public/features/features.js
@@ -228,9 +228,47 @@ function setupCopyEmbed() {
});
}
+// ── Star field canvas renderer ───────────────────────────────────────────
+
+function initStarFields() {
+ for (const canvas of ROOT.querySelectorAll('[data-role="star-canvas"]')) {
+ const dpr = Math.min(window.devicePixelRatio || 1, 2);
+ const w = window.innerWidth * dpr;
+ const h = window.innerHeight * 4 * dpr; // tall enough to cover 140vh act
+ canvas.width = w;
+ canvas.height = h;
+ const ctx = canvas.getContext('2d');
+ const tint = canvas.dataset.tint || '255,255,255';
+ const count = parseInt(canvas.dataset.count || '250', 10);
+ for (let i = 0; i < count; i++) {
+ const x = Math.random() * w;
+ const y = Math.random() * h;
+ const r = (Math.random() * 1.4 + 0.3) * dpr;
+ const a = Math.random() * 0.65 + 0.2;
+ ctx.beginPath();
+ ctx.arc(x, y, r, 0, Math.PI * 2);
+ ctx.fillStyle = `rgba(${tint},${a})`;
+ ctx.fill();
+ }
+ // A handful of brighter "star clusters"
+ for (let i = 0; i < 12; i++) {
+ const x = Math.random() * w;
+ const y = Math.random() * h;
+ const grd = ctx.createRadialGradient(x, y, 0, x, y, 6 * dpr);
+ grd.addColorStop(0, `rgba(${tint},0.9)`);
+ grd.addColorStop(1, `rgba(${tint},0)`);
+ ctx.beginPath();
+ ctx.arc(x, y, 6 * dpr, 0, Math.PI * 2);
+ ctx.fillStyle = grd;
+ ctx.fill();
+ }
+ }
+}
+
// ── Boot ─────────────────────────────────────────────────────────────────
function init() {
+ initStarFields();
paintChainRibbon();
setupReveal();
setupLazyBoot();
diff --git a/public/features/index.html b/public/features/index.html
index 7038de830..c1c7c1360 100644
--- a/public/features/index.html
+++ b/public/features/index.html
@@ -54,11 +54,41 @@
<main class="parallax" data-role="parallax-root">
<!-- ─── ACT 1 — Live 3D, in your browser ─────────────────────────── -->
<section class="parallax-act" data-act="1" aria-labelledby="act1-title">
- <div class="parallax-layer" style="--depth: 8" aria-hidden="true">
+ <div class="parallax-layer" style="--depth: 10" aria-hidden="true">
<div class="layer-bg layer-bg--nebula"></div>
+ <canvas class="layer-stars-canvas" data-role="star-canvas" data-tint="255,220,130" data-count="280"></canvas>
</div>
<div class="parallax-layer" style="--depth: 5" aria-hidden="true">
- <div class="layer-grid"></div>
+ <svg class="layer-perspective-grid" viewBox="0 0 1600 900" preserveAspectRatio="xMidYMid slice" role="presentation">
+ <!-- Lines radiating from vanishing point (800, 450) -->
+ <g stroke="rgba(255,215,106,0.07)" stroke-width="1" fill="none">
+ <line x1="800" y1="450" x2="0" y2="0"/>
+ <line x1="800" y1="450" x2="267" y2="0"/>
+ <line x1="800" y1="450" x2="533" y2="0"/>
+ <line x1="800" y1="450" x2="800" y2="0"/>
+ <line x1="800" y1="450" x2="1067" y2="0"/>
+ <line x1="800" y1="450" x2="1333" y2="0"/>
+ <line x1="800" y1="450" x2="1600" y2="0"/>
+ <line x1="800" y1="450" x2="0" y2="900"/>
+ <line x1="800" y1="450" x2="267" y2="900"/>
+ <line x1="800" y1="450" x2="533" y2="900"/>
+ <line x1="800" y1="450" x2="800" y2="900"/>
+ <line x1="800" y1="450" x2="1067" y2="900"/>
+ <line x1="800" y1="450" x2="1333" y2="900"/>
+ <line x1="800" y1="450" x2="1600" y2="900"/>
+ <line x1="800" y1="450" x2="0" y2="225"/>
+ <line x1="800" y1="450" x2="0" y2="675"/>
+ <line x1="800" y1="450" x2="1600" y2="225"/>
+ <line x1="800" y1="450" x2="1600" y2="675"/>
+ </g>
+ <!-- Concentric distance rings -->
+ <g stroke="rgba(255,215,106,0.05)" stroke-width="1" fill="none">
+ <ellipse cx="800" cy="450" rx="160" ry="90"/>
+ <ellipse cx="800" cy="450" rx="320" ry="180"/>
+ <ellipse cx="800" cy="450" rx="480" ry="270"/>
+ <ellipse cx="800" cy="450" rx="700" ry="400"/>
+ </g>
+ </svg>
</div>
<div class="parallax-layer" style="--depth: 2" aria-hidden="true">
<div class="layer-orb layer-orb--gold"></div>
@@ -116,8 +146,9 @@
id="act-empathy"
aria-labelledby="act2-title"
>
- <div class="parallax-layer" style="--depth: 8" aria-hidden="true">
+ <div class="parallax-layer" style="--depth: 10" aria-hidden="true">
<div class="layer-bg layer-bg--violet"></div>
+ <canvas class="layer-stars-canvas" data-role="star-canvas" data-tint="200,160,255" data-count="220"></canvas>
</div>
<div class="parallax-layer" style="--depth: 5" aria-hidden="true">
<svg
@@ -199,8 +230,9 @@
id="act-onchain"
aria-labelledby="act3-title"
>
- <div class="parallax-layer" style="--depth: 8" aria-hidden="true">
+ <div class="parallax-layer" style="--depth: 10" aria-hidden="true">
<div class="layer-bg layer-bg--mint"></div>
+ <canvas class="layer-stars-canvas" data-role="star-canvas" data-tint="110,231,183" data-count="240"></canvas>
</div>
<div class="parallax-layer" style="--depth: 5" aria-hidden="true">
<div class="layer-chains" data-role="chain-ribbon"></div>
diff --git a/src/viewer.js b/src/viewer.js
index 6d74e599d..0a87fe19c 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -302,9 +302,9 @@ export class Viewer {
const target = center.clone();
const pos = center.clone();
- pos.x += size / 2.0;
- pos.y += size / 5.0;
- pos.z += size / 2.0;
+ pos.x += size / 4.0;
+ pos.y += size / 8.0;
+ pos.z += size * 0.85;
if (animate) {
this._tweenCamera(pos, target, durationMs);
@@ -530,9 +530,9 @@ export class Viewer {
framedPos.fromArray(this.options.cameraPosition);
} else {
framedPos.copy(center);
- framedPos.x += size / 2.0;
- framedPos.y += size / 5.0;
- framedPos.z += size / 2.0;
+ framedPos.x += size / 4.0;
+ framedPos.y += size / 8.0;
+ framedPos.z += size * 0.85;
}
// In kiosk / embed modes (and on subsequent loads), snap straight to