About: 3D phone running the model offline
Browse files- index.html +3 -3
- scenes3d.js +112 -42
index.html
CHANGED
|
@@ -89,7 +89,7 @@ body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset
|
|
| 89 |
.stage .tl{z-index:2}
|
| 90 |
.m3d{grid-column:8/-1;position:relative;height:clamp(320px,34vw,480px);align-self:center}
|
| 91 |
.m3d canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
|
| 92 |
-
.m3d{-webkit-mask-image:radial-gradient(closest-side,#000
|
| 93 |
.about.has3d .q{grid-column:1/span 7;align-self:center}
|
| 94 |
.stage .tl{position:absolute;bottom:16px;color:var(--on-navy-2)}
|
| 95 |
.stage .tl.l{left:20px}.stage .tl.r{right:20px;color:var(--blue-3)}
|
|
@@ -193,7 +193,7 @@ section.s{padding-block:calc(var(--u)*14)}
|
|
| 193 |
.about .facts2 div+div{border-left:1px solid var(--navy-line);padding-left:var(--gap)}
|
| 194 |
.about .facts2 .mono{color:var(--on-navy-2)}
|
| 195 |
.about .facts2 span:last-child{font-size:17px;font-weight:600}
|
| 196 |
-
@media(max-width:760px){.about .q,.about.has3d .q{grid-column:1/-1}.m3d{grid-column:1/-1;height:
|
| 197 |
|
| 198 |
/* footer */
|
| 199 |
footer{padding-block:calc(var(--u)*12) calc(var(--u)*4 + env(safe-area-inset-bottom,0px))}
|
|
@@ -309,7 +309,7 @@ footer nav a:hover{color:var(--blue)}
|
|
| 309 |
<section class="s about" id="about">
|
| 310 |
<div class="wrap g12">
|
| 311 |
<p class="q split">Frontier agents build. <em>Small models run offline.</em></p>
|
| 312 |
-
<div class="m3d" id="m3d" hidden aria-
|
| 313 |
<div class="facts2">
|
| 314 |
<div class="up"><span class="mono">Agents</span><span>Claude Code · Codex</span></div>
|
| 315 |
<div class="up"><span class="mono">First language</span><span>Azerbaijani</span></div>
|
|
|
|
| 89 |
.stage .tl{z-index:2}
|
| 90 |
.m3d{grid-column:8/-1;position:relative;height:clamp(320px,34vw,480px);align-self:center}
|
| 91 |
.m3d canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
|
| 92 |
+
.m3d{-webkit-mask-image:radial-gradient(closest-side,#000 82%,transparent 100%);mask-image:radial-gradient(closest-side,#000 82%,transparent 100%)}
|
| 93 |
.about.has3d .q{grid-column:1/span 7;align-self:center}
|
| 94 |
.stage .tl{position:absolute;bottom:16px;color:var(--on-navy-2)}
|
| 95 |
.stage .tl.l{left:20px}.stage .tl.r{right:20px;color:var(--blue-3)}
|
|
|
|
| 193 |
.about .facts2 div+div{border-left:1px solid var(--navy-line);padding-left:var(--gap)}
|
| 194 |
.about .facts2 .mono{color:var(--on-navy-2)}
|
| 195 |
.about .facts2 span:last-child{font-size:17px;font-weight:600}
|
| 196 |
+
@media(max-width:760px){.about .q,.about.has3d .q{grid-column:1/-1}.m3d{grid-column:1/-1;height:420px;margin-top:8px}.about .facts2{grid-template-columns:minmax(0,1fr)}.about .facts2 div+div{border-left:0;padding-left:0;border-top:1px solid var(--navy-line);margin-top:24px}}
|
| 197 |
|
| 198 |
/* footer */
|
| 199 |
footer{padding-block:calc(var(--u)*12) calc(var(--u)*4 + env(safe-area-inset-bottom,0px))}
|
|
|
|
| 309 |
<section class="s about" id="about">
|
| 310 |
<div class="wrap g12">
|
| 311 |
<p class="q split">Frontier agents build. <em>Small models run offline.</em></p>
|
| 312 |
+
<div class="m3d" id="m3d" hidden role="img" aria-label="3D phone running the MAIN Lab small model offline, chatting in Azerbaijani"></div>
|
| 313 |
<div class="facts2">
|
| 314 |
<div class="up"><span class="mono">Agents</span><span>Claude Code · Codex</span></div>
|
| 315 |
<div class="up"><span class="mono">First language</span><span>Azerbaijani</span></div>
|
scenes3d.js
CHANGED
|
@@ -235,56 +235,126 @@ function heroScene() {
|
|
| 235 |
return v;
|
| 236 |
}
|
| 237 |
|
| 238 |
-
/* ---------------- about:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
function aboutScene() {
|
| 240 |
const section = document.getElementById('about'), box = document.getElementById('m3d');
|
| 241 |
section.classList.add('has3d'); box.hidden = false;
|
| 242 |
-
const v = makeView(box, { strength: .
|
| 243 |
const { scene, camera } = v;
|
| 244 |
-
const g = new THREE.Group(); scene.add(g);
|
| 245 |
dust(scene, small ? 60 : 120, 14);
|
| 246 |
-
const
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
};
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
const
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
-
const d = new THREE.Object3D(), I = new THREE.Quaternion();
|
| 267 |
-
let yaw = 0, pitch = 0;
|
| 268 |
-
const place = (b, q, obj) => {
|
| 269 |
-
const k = easeInOut(clamp((q - b.lag) / (1 - .32)));
|
| 270 |
-
obj.position.lerpVectors(b.start, b.end, k);
|
| 271 |
-
obj.quaternion.slerpQuaternions(b.q0, I, k);
|
| 272 |
-
obj.scale.setScalar(C * (.55 + .45 * k));
|
| 273 |
-
return k;
|
| 274 |
-
};
|
| 275 |
v.tick = (t, dt) => {
|
| 276 |
const r = section.getBoundingClientRect();
|
| 277 |
-
const q = reduce ? 1 : clamp((innerHeight * .95 - r.top) / (innerHeight * .8));
|
| 278 |
-
yaw += (pointer.x * .
|
| 279 |
-
pitch += (pointer.y * .
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
};
|
| 289 |
return v;
|
| 290 |
}
|
|
|
|
| 235 |
return v;
|
| 236 |
}
|
| 237 |
|
| 238 |
+
/* ---------------- about: a phone running the small model offline ---------------- */
|
| 239 |
+
function roundRect(g, x, y, w, h, r) { g.beginPath(); g.moveTo(x + r, y); g.arcTo(x + w, y, x + w, y + h, r); g.arcTo(x + w, y + h, x, y + h, r); g.arcTo(x, y + h, x, y, r); g.arcTo(x, y, x + w, y, r); g.closePath(); }
|
| 240 |
+
function wrap(g, text, maxW) {
|
| 241 |
+
const words = text.split(' '), lines = []; let line = '';
|
| 242 |
+
for (const w of words) { const t = line ? line + ' ' + w : w; if (g.measureText(t).width > maxW && line) { lines.push(line); line = w; } else line = t; }
|
| 243 |
+
if (line) lines.push(line); return lines;
|
| 244 |
+
}
|
| 245 |
+
/* the chat on the screen: user asks, the on-device model answers (typed out) */
|
| 246 |
+
const CHAT = [
|
| 247 |
+
{ me: true, text: 'Bakı haqqında bir cümlə yaz.' },
|
| 248 |
+
{ me: false, text: 'Bakı Xəzər dənizinin sahilində yerləşən Azərbaycanın paytaxtıdır.' },
|
| 249 |
+
{ me: true, text: 'İnternetsiz işləyirsən?' },
|
| 250 |
+
{ me: false, text: 'Bəli. Tamamilə oflayn, telefonunda işləyirəm.' }
|
| 251 |
+
];
|
| 252 |
+
function drawScreen(g, W, H, step, typed) {
|
| 253 |
+
const F = "'Inter', system-ui, sans-serif";
|
| 254 |
+
const bg = g.createLinearGradient(0, 0, 0, H); bg.addColorStop(0, '#111B38'); bg.addColorStop(1, '#0B1330');
|
| 255 |
+
g.clearRect(0, 0, W, H); g.save(); roundRect(g, 0, 0, W, H, 70); g.clip(); g.fillStyle = bg; g.fillRect(0, 0, W, H);
|
| 256 |
+
/* status bar + island */
|
| 257 |
+
g.fillStyle = '#E3E8F3'; g.font = `600 30px ${F}`; g.fillText('9:41', 54, 66);
|
| 258 |
+
g.fillStyle = '#05091A'; roundRect(g, W / 2 - 92, 26, 184, 52, 26); g.fill();
|
| 259 |
+
g.fillStyle = '#1F2B52'; roundRect(g, W - 190, 38, 140, 38, 19); g.fill();
|
| 260 |
+
g.fillStyle = '#8FB0FF'; g.beginPath(); g.arc(W - 166, 57, 7, 0, 6.3); g.fill();
|
| 261 |
+
g.fillStyle = '#C9D4EC'; g.font = `600 22px ${F}`; g.fillText('Offline', W - 150, 65);
|
| 262 |
+
/* header: Pixel M avatar + model name */
|
| 263 |
+
const ax = 54, ay = 118, s = 9.5;
|
| 264 |
+
g.fillStyle = '#E3E8F3'; roundRect(g, ax, ay, 70, 70, 16); g.fill();
|
| 265 |
+
P.forEach(([x, y]) => { g.fillStyle = x === 2 && y === 2 ? '#2F6BFF' : '#0B1437'; g.fillRect(ax + 11 + x * s, ay + 11 + y * s, s - 2, s - 2); });
|
| 266 |
+
g.fillStyle = '#E8EDF7'; g.font = `700 32px ${F}`; g.fillText('MAIN 270M', ax + 92, ay + 32);
|
| 267 |
+
g.fillStyle = '#8C9BB8'; g.font = `500 23px ${F}`; g.fillText('on-device · Azərbaycan dili', ax + 92, ay + 62);
|
| 268 |
+
g.fillStyle = 'rgba(255,255,255,.08)'; g.fillRect(40, ay + 96, W - 80, 2);
|
| 269 |
+
/* bubbles */
|
| 270 |
+
let y = ay + 130; g.font = `500 29px ${F}`;
|
| 271 |
+
for (let i = 0; i <= step && i < CHAT.length; i++) {
|
| 272 |
+
const m = CHAT[i], txt = (i === step && !m.me) ? m.text.slice(0, typed) : m.text;
|
| 273 |
+
if (!txt) { /* typing dots */ g.fillStyle = '#1C2849'; roundRect(g, 44, y, 120, 60, 30); g.fill(); g.fillStyle = '#8C9BB8'; for (let k = 0; k < 3; k++) { g.beginPath(); g.arc(78 + k * 26, y + 30, 6, 0, 6.3); g.fill(); } y += 80; continue; }
|
| 274 |
+
const lines = wrap(g, m.text, W * .6), bw = Math.max(...lines.map(l => g.measureText(l).width)) + 52, bh = lines.length * 40 + 30;
|
| 275 |
+
const bx = m.me ? W - 44 - bw : 44;
|
| 276 |
+
g.fillStyle = m.me ? '#2F6BFF' : '#1C2849'; roundRect(g, bx, y, bw, bh, 28); g.fill();
|
| 277 |
+
g.fillStyle = m.me ? '#F2F5FB' : '#E3E8F3';
|
| 278 |
+
let left = txt.length;
|
| 279 |
+
lines.forEach((l, k) => { if (left <= 0) return; g.fillText(l.slice(0, left), bx + 26, y + 46 + k * 40); left -= l.length + 1; });
|
| 280 |
+
y += bh + 22;
|
| 281 |
+
}
|
| 282 |
+
/* input bar */
|
| 283 |
+
g.fillStyle = '#18234A'; roundRect(g, 40, H - 132, W - 150, 76, 38); g.fill();
|
| 284 |
+
g.fillStyle = '#6F7A90'; g.font = `500 27px ${F}`; g.fillText('Mesaj yaz…', 76, H - 84);
|
| 285 |
+
g.fillStyle = '#2F6BFF'; g.beginPath(); g.arc(W - 76, H - 94, 38, 0, 6.3); g.fill();
|
| 286 |
+
g.strokeStyle = '#F2F5FB'; g.lineWidth = 5; g.lineCap = 'round'; g.beginPath(); g.moveTo(W - 76, H - 78); g.lineTo(W - 76, H - 110); g.moveTo(W - 90, H - 97); g.lineTo(W - 76, H - 111); g.lineTo(W - 62, H - 97); g.stroke();
|
| 287 |
+
g.restore();
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
function aboutScene() {
|
| 291 |
const section = document.getElementById('about'), box = document.getElementById('m3d');
|
| 292 |
section.classList.add('has3d'); box.hidden = false;
|
| 293 |
+
const v = makeView(box, { strength: .6, radius: .4, threshold: .97 });
|
| 294 |
const { scene, camera } = v;
|
|
|
|
| 295 |
dust(scene, small ? 60 : 120, 14);
|
| 296 |
+
const phone = new THREE.Group(); scene.add(phone);
|
| 297 |
+
const PW = 2, PH = 4.1, PD = .24;
|
| 298 |
+
/* titanium frame + glass back */
|
| 299 |
+
const frame = new THREE.Mesh(new RoundedBoxGeometry(PW, PH, PD, 8, .3), new THREE.MeshStandardMaterial({ color: 0x9AA6C2, metalness: .85, roughness: .28 }));
|
| 300 |
+
phone.add(frame);
|
| 301 |
+
const back = new THREE.Mesh(new RoundedBoxGeometry(PW - .06, PH - .06, .02, 6, .27), new THREE.MeshStandardMaterial({ color: 0x1A2550, metalness: .3, roughness: .45 }));
|
| 302 |
+
back.position.z = -PD / 2 - .002; phone.add(back);
|
| 303 |
+
/* camera module on the back */
|
| 304 |
+
const bump = new THREE.Mesh(new RoundedBoxGeometry(.72, .72, .06, 4, .16), new THREE.MeshStandardMaterial({ color: 0x232F5E, metalness: .5, roughness: .3 }));
|
| 305 |
+
bump.position.set(-PW / 2 + .5, PH / 2 - .5, -PD / 2 - .03); phone.add(bump);
|
| 306 |
+
const lensMat = new THREE.MeshStandardMaterial({ color: 0x05091A, metalness: .9, roughness: .15 });
|
| 307 |
+
[[-.14, .14], [.14, -.14], [-.14, -.14]].forEach(([x, y]) => {
|
| 308 |
+
const l = new THREE.Mesh(new THREE.CylinderGeometry(.11, .11, .08, 32), lensMat); l.rotation.x = Math.PI / 2;
|
| 309 |
+
l.position.set(bump.position.x + x, bump.position.y + y, -PD / 2 - .07); phone.add(l);
|
| 310 |
+
});
|
| 311 |
+
/* side buttons */
|
| 312 |
+
const btnMat = frame.material;
|
| 313 |
+
[[PW / 2 + .015, .7, .5], [-PW / 2 - .015, .9, .28], [-PW / 2 - .015, .45, .42]].forEach(([x, y, h]) => {
|
| 314 |
+
const b = new THREE.Mesh(new RoundedBoxGeometry(.04, h, .09, 2, .02), btnMat); b.position.set(x, y, 0); phone.add(b);
|
| 315 |
+
});
|
| 316 |
+
/* screen: a live canvas texture */
|
| 317 |
+
const cv = document.createElement('canvas'); cv.width = 600; cv.height = 1260;
|
| 318 |
+
const g = cv.getContext('2d');
|
| 319 |
+
const tex = new THREE.CanvasTexture(cv); tex.colorSpace = THREE.SRGBColorSpace; tex.anisotropy = 4;
|
| 320 |
+
const glassW = PW - .1, glassH = PH - .1;
|
| 321 |
+
const screen = new THREE.Mesh(new THREE.PlaneGeometry(glassW, glassH), new THREE.MeshBasicMaterial({ map: tex, transparent: true }));
|
| 322 |
+
screen.position.z = PD / 2 + .012; phone.add(screen);
|
| 323 |
+
const bezel = new THREE.Mesh(new RoundedBoxGeometry(PW - .04, PH - .04, .01, 6, .005), new THREE.MeshStandardMaterial({ color: 0x03050F, roughness: .2, metalness: .1 }));
|
| 324 |
+
bezel.position.z = PD / 2 + .002; phone.add(bezel);
|
| 325 |
+
/* a soft blue glow behind the phone */
|
| 326 |
+
const glow = new THREE.Sprite(new THREE.SpriteMaterial({ map: dotTexture(), color: 0x2F6BFF, transparent: true, opacity: .35, depthWrite: false }));
|
| 327 |
+
glow.scale.set(7, 7, 1); glow.position.z = -1.5; scene.add(glow);
|
| 328 |
+
v.onResize = () => v.fit(3.2, 4.9);
|
| 329 |
+
|
| 330 |
+
let key = '', yaw = 0, pitch = 0, chatT = -1;
|
| 331 |
+
const render = (step, typed) => { const k = step + ':' + typed; if (k === key) return; key = k; drawScreen(g, cv.width, cv.height, step, typed); tex.needsUpdate = true; };
|
| 332 |
+
if (document.fonts && document.fonts.ready) document.fonts.ready.then(() => { key = ''; });
|
| 333 |
+
render(-1, 0);
|
| 334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
v.tick = (t, dt) => {
|
| 336 |
const r = section.getBoundingClientRect();
|
| 337 |
+
const q = reduce ? 1 : clamp((innerHeight * .95 - r.top) / (innerHeight * .8)), e = easeInOut(q);
|
| 338 |
+
yaw += (pointer.x * .35 - yaw) * Math.min(1, dt * 2.5);
|
| 339 |
+
pitch += (pointer.y * .18 - pitch) * Math.min(1, dt * 2.5);
|
| 340 |
+
/* turns from showing its back to facing you as the section scrolls in */
|
| 341 |
+
phone.rotation.set(.08 + pitch + (1 - e) * .25, -.28 + (1 - e) * 2.6 + yaw + Math.sin(t * .5) * .06, (1 - e) * -.12);
|
| 342 |
+
phone.position.set(0, (1 - e) * -.8 + Math.sin(t * .9) * .05, 0);
|
| 343 |
+
camera.position.set(0, .1, v.baseZ); camera.lookAt(0, 0, 0);
|
| 344 |
+
/* the chat plays once the phone faces you, then loops */
|
| 345 |
+
if (reduce) { render(CHAT.length - 1, 999); return; }
|
| 346 |
+
if (q > .85 && chatT < 0) chatT = 0;
|
| 347 |
+
if (chatT >= 0) {
|
| 348 |
+
chatT += dt;
|
| 349 |
+
const cyc = chatT % 16; let tt = cyc, step = -1, typed = 0;
|
| 350 |
+
for (let i = 0; i < CHAT.length; i++) {
|
| 351 |
+
const m = CHAT[i], dur = m.me ? .9 : .7 + m.text.length * .035;
|
| 352 |
+
if (tt < 0) break;
|
| 353 |
+
step = i; typed = m.me ? 999 : Math.max(0, Math.floor((tt - .7) / .035));
|
| 354 |
+
tt -= dur + .5;
|
| 355 |
+
}
|
| 356 |
+
render(step, typed);
|
| 357 |
+
}
|
| 358 |
};
|
| 359 |
return v;
|
| 360 |
}
|