2Btainment commited on
Commit
2243bf9
·
verified ·
1 Parent(s): 79f4641

STUDIUS v1: intro, 3D engine core, 15 nano-widgets

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/einswarm-logo.webp filter=lfs diff=lfs merge=lfs -text
37
+ assets/retro82-bg.webp filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .DS_Store
README.md CHANGED
@@ -1,10 +1,17 @@
1
  ---
2
- title: Studius
3
- emoji: 👁
4
- colorFrom: pink
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
1
  ---
2
+ title: STUDIUS – DAS Studio
3
+ emoji: 🐝
4
+ colorFrom: yellow
5
+ colorTo: gray
6
  sdk: static
7
  pinned: false
8
+ short_description: 3D AI meta-studio simulation by Einswarm
9
  ---
10
 
11
+ # STUDIUS — DAS Studio
12
+
13
+ A game-dashboard-style 3D front-end **simulation** of an AI engine / meta-studio by Einswarm.
14
+ Theme: Omarchy **Retro-82** fused with the Einswarm black/gold hex look. Simulation only — no real backends.
15
+
16
+ - Three.js (bundled in `vendor/`), JetBrains Mono (bundled), no runtime CDNs.
17
+ - Keys: arrows/WASD navigate · Enter open · Esc close · Q quality · M sound.
app.js ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as THREE from './vendor/three.module.min.js';
2
+ import { STUDIOS, stopLoops } from './widgets.js?v=2';
3
+
4
+ const $ = (s) => document.querySelector(s);
5
+ const isMobile = matchMedia('(pointer:coarse)').matches || innerWidth < 700;
6
+ let quality = isMobile ? 'low' : 'high', qMode = 'AUTO';
7
+ const GOLD = 0xf2c94c, ORANGE = 0xfaa968, TEAL = 0x028391, CYAN = 0x8cbfb8, RED = 0xf85525;
8
+
9
+ /* ---------- sound (off by default) ---------- */
10
+ let ac = null, soundOn = false;
11
+ function beep(f = 440, d = .06, type = 'square', v = .04) {
12
+ if (!soundOn) return; try {
13
+ ac = ac || new (window.AudioContext || window.webkitAudioContext)();
14
+ const o = ac.createOscillator(), g = ac.createGain(); o.type = type; o.frequency.value = f;
15
+ g.gain.setValueAtTime(v, ac.currentTime); g.gain.exponentialRampToValueAtTime(.0001, ac.currentTime + d);
16
+ o.connect(g).connect(ac.destination); o.start(); o.stop(ac.currentTime + d);
17
+ } catch (e) {}
18
+ }
19
+ function toggleSound() { soundOn = !soundOn; $('#snd').textContent = soundOn ? '🔊' : '🔇'; beep(880, .1); }
20
+ $('#snd').onclick = toggleSound;
21
+
22
+ /* ---------- three setup ---------- */
23
+ let renderer = null, gl3d = true;
24
+ try {
25
+ renderer = new THREE.WebGLRenderer({ canvas: $('#gl'), antialias: !isMobile, powerPreference: 'high-performance' });
26
+ } catch (e) { gl3d = false; console.warn('WebGL unavailable, 2D fallback'); }
27
+ const scene = new THREE.Scene(); scene.fog = new THREE.FogExp2(0x020c17, 0.028);
28
+ const camera = new THREE.PerspectiveCamera(55, innerWidth / innerHeight, .1, 200);
29
+ const cam = { r: isMobile ? 26 : 21, th: 0.4, ph: 1.15, tr: 21, tth: .4, tph: 1.15 };
30
+ function applyQuality() {
31
+ if (!renderer) return;
32
+ renderer.setPixelRatio(quality === 'high' ? Math.min(devicePixelRatio, 2) : Math.min(devicePixelRatio, 1));
33
+ renderer.setSize(innerWidth, innerHeight, false);
34
+ if (swarm) swarm.count = quality === 'high' ? SW_MAX : SW_MAX / 3 | 0;
35
+ if (dust) dust.geometry.setDrawRange(0, quality === 'high' ? DUST : DUST / 3 | 0);
36
+ $('#q').textContent = 'Q:' + (qMode === 'AUTO' ? 'AUTO·' + quality[0].toUpperCase() : quality.toUpperCase());
37
+ }
38
+ scene.add(new THREE.AmbientLight(0x334455, 1.2));
39
+ const coreLight = new THREE.PointLight(GOLD, 60, 40, 1.6); scene.add(coreLight);
40
+ const rim = new THREE.DirectionalLight(ORANGE, 1.2); rim.position.set(-10, 8, -6); scene.add(rim);
41
+
42
+ /* core */
43
+ const core = new THREE.Group(); scene.add(core);
44
+ const coreMat = new THREE.MeshStandardMaterial({ color: 0x1a1205, emissive: GOLD, emissiveIntensity: 1.2, metalness: .9, roughness: .25, flatShading: true });
45
+ const coreMesh = new THREE.Mesh(new THREE.IcosahedronGeometry(2.2, 1), coreMat); core.add(coreMesh);
46
+ const shell = new THREE.Mesh(new THREE.IcosahedronGeometry(3.1, 1), new THREE.MeshBasicMaterial({ color: ORANGE, wireframe: true, transparent: true, opacity: .35 })); core.add(shell);
47
+ const shell2 = new THREE.Mesh(new THREE.IcosahedronGeometry(3.8, 2), new THREE.MeshBasicMaterial({ color: TEAL, wireframe: true, transparent: true, opacity: .12 })); core.add(shell2);
48
+ const glowTex = (() => { const c = document.createElement('canvas'); c.width = c.height = 128; const x = c.getContext('2d'); const g = x.createRadialGradient(64, 64, 0, 64, 64, 64); g.addColorStop(0, 'rgba(255,230,150,1)'); g.addColorStop(.3, 'rgba(242,201,76,.5)'); g.addColorStop(1, 'rgba(0,0,0,0)'); x.fillStyle = g; x.fillRect(0, 0, 128, 128); return new THREE.CanvasTexture(c); })();
49
+ const glow = new THREE.Sprite(new THREE.SpriteMaterial({ map: glowTex, blending: THREE.AdditiveBlending, depthWrite: false, transparent: true })); glow.scale.set(14, 14, 1); core.add(glow);
50
+ // orbit rings
51
+ for (let i = 0; i < 3; i++) { const ring = new THREE.Mesh(new THREE.TorusGeometry(5 + i * 1.1, .025, 6, 120), new THREE.MeshBasicMaterial({ color: [GOLD, ORANGE, CYAN][i], transparent: true, opacity: .5 })); ring.rotation.x = Math.PI / 2 + i * .35; ring.rotation.y = i * .6; ring.userData.spin = .2 + i * .15; core.add(ring); }
52
+ // hex floor grid
53
+ {
54
+ const pts = []; const R = .9, W = R * Math.sqrt(3);
55
+ for (let q = -14; q <= 14; q++) for (let r = -14; r <= 14; r++) {
56
+ const cx = W * (q + r / 2), cz = 1.5 * R * r; if (cx * cx + cz * cz > 420) continue;
57
+ for (let k = 0; k < 6; k++) { const a = Math.PI / 6 + k * Math.PI / 3, b = a + Math.PI / 3; pts.push(cx + R * Math.cos(a), 0, cz + R * Math.sin(a), cx + R * Math.cos(b), 0, cz + R * Math.sin(b)); }
58
+ }
59
+ const g = new THREE.BufferGeometry(); g.setAttribute('position', new THREE.Float32BufferAttribute(pts, 3));
60
+ const floor = new THREE.LineSegments(g, new THREE.LineBasicMaterial({ color: 0xd4a63a, transparent: true, opacity: .22 })); floor.position.y = -6; scene.add(floor);
61
+ }
62
+ // hex swarm (instanced)
63
+ const SW_MAX = isMobile ? 360 : 900;
64
+ const hexGeo = new THREE.CylinderGeometry(.16, .16, .06, 6);
65
+ const swarm = new THREE.InstancedMesh(hexGeo, new THREE.MeshStandardMaterial({ color: GOLD, emissive: 0x6b4a10, metalness: .8, roughness: .3 }), SW_MAX);
66
+ const swData = [...Array(SW_MAX)].map(() => ({ r: 4.5 + Math.random() * 9, a: Math.random() * 6.28, y: (Math.random() - .5) * 7, s: (.1 + Math.random() * .4) * (Math.random() < .5 ? -1 : 1), w: Math.random() * 6 }));
67
+ const tmp = new THREE.Object3D(), tmpC = new THREE.Color();
68
+ swData.forEach((d, i) => swarm.setColorAt(i, tmpC.set([GOLD, ORANGE, GOLD, CYAN][i % 4])));
69
+ scene.add(swarm);
70
+ // dust / burst particles
71
+ const DUST = isMobile ? 1500 : 4000;
72
+ const dpos = new Float32Array(DUST * 3), dvel = new Float32Array(DUST * 3);
73
+ for (let i = 0; i < DUST; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(10 + Math.random() * 40); dpos.set([v.x, v.y, v.z], i * 3); }
74
+ const dGeo = new THREE.BufferGeometry(); dGeo.setAttribute('position', new THREE.BufferAttribute(dpos, 3));
75
+ const dust = new THREE.Points(dGeo, new THREE.PointsMaterial({ color: ORANGE, size: .09, transparent: true, opacity: .8, blending: THREE.AdditiveBlending, depthWrite: false })); scene.add(dust);
76
+ function burst() { for (let i = 0; i < DUST; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(.3 + Math.random() * 1.2); dpos.set([0, 0, 0], i * 3); dvel.set([v.x, v.y, v.z], i * 3); } bursting = 1; }
77
+ let bursting = 0;
78
+
79
+ /* studio nodes */
80
+ const CATS = ['Alle', 'Text', 'Bild', 'Video', 'Audio', 'Automation', 'Code', 'Community', 'Design'];
81
+ const nodes = []; const nodeGeo = new THREE.CylinderGeometry(.75, .75, .35, 6);
82
+ const streamPts = [];
83
+ STUDIOS.forEach((s, i) => {
84
+ const a = i / STUDIOS.length * Math.PI * 2, R = 10 + (i % 2) * 1.6;
85
+ const col = s.id === 'merge' ? RED : [GOLD, ORANGE, CYAN, TEAL][CATS.indexOf(s.cat) % 4];
86
+ const m = new THREE.Mesh(nodeGeo, new THREE.MeshStandardMaterial({ color: 0x0a0a0a, emissive: col, emissiveIntensity: .45, metalness: .9, roughness: .3 }));
87
+ const edge = new THREE.LineSegments(new THREE.EdgesGeometry(nodeGeo), new THREE.LineBasicMaterial({ color: GOLD })); m.add(edge);
88
+ m.rotation.x = Math.PI / 2; m.userData = { s, a, R, y: Math.sin(i * 1.7) * 2.2, i, col };
89
+ scene.add(m); nodes.push(m);
90
+ // data stream line node→core
91
+ const lg = new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(), new THREE.Vector3()]);
92
+ const line = new THREE.Line(lg, new THREE.LineBasicMaterial({ color: col, transparent: true, opacity: .25 })); scene.add(line); m.userData.line = line;
93
+ for (let k = 0; k < 3; k++) streamPts.push({ n: m, t: Math.random() });
94
+ });
95
+ const spGeo = new THREE.BufferGeometry(); const spPos = new Float32Array(streamPts.length * 3); spGeo.setAttribute('position', new THREE.BufferAttribute(spPos, 3));
96
+ scene.add(new THREE.Points(spGeo, new THREE.PointsMaterial({ color: 0xfff1b0, size: .28, transparent: true, blending: THREE.AdditiveBlending, depthWrite: false, map: glowTex })));
97
+
98
+ /* ---------- HUD, labels ---------- */
99
+ let cat = 'Alle', sel = 0, openId = null;
100
+ const cats = $('#cats');
101
+ CATS.forEach(c => { const b = document.createElement('button'); b.textContent = c.toUpperCase(); b.onclick = () => setCat(c); cats.append(b); });
102
+ function setCat(c) { cat = c; [...cats.children].forEach(b => b.classList.toggle('on', b.textContent === c.toUpperCase())); beep(520); const v = visible(); if (!v.includes(sel)) select(v[0]); }
103
+ function visible() { return nodes.map((n, i) => i).filter(i => cat === 'Alle' || nodes[i].userData.s.cat === cat || nodes[i].userData.s.id === 'merge'); }
104
+ const labels = STUDIOS.map((s, i) => { const d = document.createElement('div'); d.className = 'lbl'; d.innerHTML = `<i>${s.icon}</i>${s.name}`; d.title = s.cat + ' · ' + s.like;
105
+ d.onmouseenter = () => select(i); d.onclick = (e) => { e.stopPropagation(); select(i); open(i); }; $('#labels').append(d); return d; });
106
+ function select(i) { if (i == null) return; if (sel !== i) beep(660, .03); sel = i; labels.forEach((l, k) => l.classList.toggle('sel', k === i)); }
107
+ const pop = $('#pop');
108
+ function open(i) {
109
+ stopLoops(); openId = i; const s = STUDIOS[i]; beep(990, .08, 'triangle');
110
+ pop.innerHTML = `<div class="ph">${s.icon} ${s.name.toUpperCase()}<small>${s.cat} · ${s.like}</small><button aria-label="schließen">✕</button></div><div class="pb"></div>`;
111
+ pop.hidden = false; pop.querySelector('.ph button').onclick = close; s.build(pop.querySelector('.pb')); placePop(); $('#wire').classList.add('on');
112
+ }
113
+ function close() { stopLoops(); openId = null; pop.hidden = true; $('#wire').classList.remove('on'); beep(300); }
114
+ function placePop() {
115
+ if (openId == null || isMobile && innerWidth < 700) return; const p = screenPos(nodes[openId]);
116
+ const W = pop.offsetWidth, H = pop.offsetHeight; let x = p.x + (p.x < innerWidth / 2 ? 90 : -90 - W), y = Math.max(60, Math.min(innerHeight - H - 50, p.y - H / 2));
117
+ pop.style.left = x + 'px'; pop.style.top = y + 'px';
118
+ }
119
+ function screenPos(o) { const v = o.getWorldPosition(new THREE.Vector3()).project(camera); return { x: (v.x + 1) / 2 * innerWidth, y: (1 - v.y) / 2 * innerHeight, z: v.z }; }
120
+ window.addEventListener('studius-merge', () => { burst(); beep(200, .3, 'sawtooth'); });
121
+
122
+ /* ---------- input ---------- */
123
+ const keys = {};
124
+ let started = false;
125
+ addEventListener('keydown', e => {
126
+ if (!started) { start(); return; }
127
+ if (e.target.matches('input,textarea')) return;
128
+ const v = visible(), k = v.indexOf(sel);
129
+ if (['ArrowRight', 'd', 'D', 'ArrowDown', 's', 'S'].includes(e.key)) select(v[(k + 1) % v.length]);
130
+ else if (['ArrowLeft', 'a', 'A', 'ArrowUp', 'w', 'W'].includes(e.key)) select(v[(k - 1 + v.length) % v.length]);
131
+ else if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); open(sel); }
132
+ else if (e.key === 'Escape' || e.key === 'Backspace') close();
133
+ else if (e.key === 'q' || e.key === 'Q') cycleQ();
134
+ else if (e.key === 'm' || e.key === 'M') toggleSound();
135
+ else if (e.key === 'Tab') { e.preventDefault(); setCat(CATS[(CATS.indexOf(cat) + 1) % CATS.length]); }
136
+ });
137
+ const mouse = new THREE.Vector2(9, 9), ray = new THREE.Raycaster(); let drag = null;
138
+ const cv = $('#gl');
139
+ addEventListener('pointermove', e => { mouse.set(e.clientX / innerWidth * 2 - 1, -(e.clientY / innerHeight) * 2 + 1);
140
+ if (drag) { cam.tth -= (e.clientX - drag.x) * .005; cam.tph = Math.max(.35, Math.min(1.5, cam.tph - (e.clientY - drag.y) * .004)); drag = { x: e.clientX, y: e.clientY, moved: drag.moved + Math.abs(e.movementX || 1) }; } });
141
+ cv.addEventListener('pointerdown', e => { drag = { x: e.clientX, y: e.clientY, moved: 0 }; });
142
+ addEventListener('pointerup', e => { if (drag && drag.moved < 6 && e.target === cv && started) { ray.setFromCamera(mouse, camera); const h = ray.intersectObjects(nodes, false)[0]; if (h) { select(h.object.userData.i); open(h.object.userData.i); } } drag = null; });
143
+ addEventListener('wheel', e => { cam.tr = Math.max(12, Math.min(34, cam.tr + e.deltaY * .01)); }, { passive: true });
144
+ function cycleQ() { qMode = qMode === 'AUTO' ? 'HIGH' : qMode === 'HIGH' ? 'LOW' : 'AUTO'; if (qMode !== 'AUTO') quality = qMode.toLowerCase(); applyQuality(); }
145
+ $('#q').onclick = cycleQ;
146
+ addEventListener('resize', () => { camera.aspect = innerWidth / innerHeight; camera.updateProjectionMatrix(); applyQuality(); });
147
+ // gamepad
148
+ let gpCool = 0;
149
+ function pollPad() { const p = navigator.getGamepads ? [...navigator.getGamepads()].find(Boolean) : null; if (!p || gpCool-- > 0) return;
150
+ const x = p.axes[0] || 0, v = visible(), k = v.indexOf(sel);
151
+ if (!started && p.buttons.some(b => b.pressed)) { start(); gpCool = 20; return; }
152
+ if (x > .5 || p.buttons[15]?.pressed) { select(v[(k + 1) % v.length]); gpCool = 12; }
153
+ else if (x < -.5 || p.buttons[14]?.pressed) { select(v[(k - 1 + v.length) % v.length]); gpCool = 12; }
154
+ else if (p.buttons[0]?.pressed) { open(sel); gpCool = 20; } else if (p.buttons[1]?.pressed) { close(); gpCool = 20; }
155
+ }
156
+
157
+ /* ---------- intro ---------- */
158
+ const BOOT = [
159
+ ['EINSWARM BIOS v8.2 (Retro-82) © 2026 2Btainment', ''], ['Memory test ........ 65536K', 'ok'], ['Detecting hex lattice ........', 'ok'],
160
+ ['Loading neural swarm kernel: 128 agents', 'ok'], ['Mounting studios: text bild video audio automation code community design', 'ok'],
161
+ ['Calibrating gold borders', 'w'], ['Spinning up meta-engine core ............', 'ok'], ['>> IGNITION READY', 'ok']];
162
+ async function bootSeq() {
163
+ const pre = $('#boot');
164
+ for (const [t, s] of BOOT) { if (started) return; const line = document.createElement('div'); pre.append(line);
165
+ for (let i = 0; i <= t.length; i += 3) { if (started) return; line.textContent = t.slice(0, i); await new Promise(r => setTimeout(r, 8)); }
166
+ line.innerHTML = t.replace(/</g, '&lt;') + (s ? ` <span class="${s}">[${s === 'w' ? ' WARN ' : ' OK '}]</span>` : ''); beep(1200, .015); await new Promise(r => setTimeout(r, 110)); }
167
+ $('#reveal').classList.add('on'); beep(220, .4, 'sawtooth', .05);
168
+ setTimeout(() => $('#press').classList.add('on'), 900);
169
+ }
170
+ function start() {
171
+ if (started) return; started = true; beep(110, .5, 'sawtooth', .08); burst();
172
+ $('#intro').classList.add('gone'); setTimeout(() => $('#intro').remove(), 1000);
173
+ ['#hud', '#hint', '#core-stats'].forEach(s => $(s).hidden = false); cam.tr = isMobile ? 26 : 21; setCat('Alle'); select(0);
174
+ }
175
+ $('#skip').onclick = (e) => { e.stopPropagation(); start(); };
176
+ $('#intro').addEventListener('pointerdown', (e) => { if (e.target.id !== 'skip') start(); });
177
+ cam.r = 60; cam.tr = 40;
178
+ bootSeq();
179
+
180
+ /* ---------- loop ---------- */
181
+ const clock = new THREE.Clock(); let frames = 0, fpsT = 0, lowStreak = 0, statT = 0;
182
+ const stats = $('#core-stats');
183
+ function frame() {
184
+ requestAnimationFrame(frame);
185
+ const dt = Math.min(clock.getDelta(), .05), t = clock.elapsedTime;
186
+ frames++; fpsT += dt; if (fpsT > 1) { const fps = Math.round(frames / fpsT); $('#fps').textContent = fps + ' fps'; frames = 0; fpsT = 0;
187
+ if (qMode === 'AUTO' && quality === 'high') { lowStreak = fps < 40 ? lowStreak + 1 : 0; if (lowStreak >= 3) { quality = 'low'; applyQuality(); } } }
188
+ pollPad();
189
+ // camera (intro: slow fly; mouse parallax)
190
+ cam.th += (cam.tth - cam.th) * .06 + (started ? dt * .03 : dt * .15); cam.tth += started ? dt * .03 : dt * .15;
191
+ cam.ph += (cam.tph - cam.ph) * .06; cam.r += (cam.tr - cam.r) * .04;
192
+ const mx = mouse.x < 5 ? mouse.x : 0, my = mouse.y < 5 ? mouse.y : 0;
193
+ camera.position.set(cam.r * Math.sin(cam.ph) * Math.cos(cam.th) + mx * 1.5, cam.r * Math.cos(cam.ph) + my * 1.5, cam.r * Math.sin(cam.ph) * Math.sin(cam.th)); camera.lookAt(0, 0, 0);
194
+ // core pulse
195
+ const pulse = 1 + Math.sin(t * 2.4) * .06 + (bursting * .5);
196
+ coreMesh.scale.setScalar(pulse); coreMesh.rotation.y += dt * .4; coreMesh.rotation.x += dt * .15; coreMat.emissiveIntensity = 1 + Math.sin(t * 2.4) * .4;
197
+ shell.rotation.y -= dt * .25; shell2.rotation.x += dt * .1; glow.scale.setScalar(12 + Math.sin(t * 2.4) * 1.5 + bursting * 10);
198
+ core.children.forEach(c => { if (c.userData.spin) c.rotation.z += dt * c.userData.spin; });
199
+ coreLight.intensity = 50 + Math.sin(t * 2.4) * 15;
200
+ // swarm
201
+ const sc = swarm.count;
202
+ for (let i = 0; i < sc; i++) { const d = swData[i]; d.a += d.s * dt * (1 + bursting * 4);
203
+ const r = d.r + Math.sin(t + d.w) * .6 + bursting * 6;
204
+ tmp.position.set(Math.cos(d.a) * r, d.y + Math.sin(t * .7 + d.w) * .8, Math.sin(d.a) * r);
205
+ tmp.rotation.set(t + d.w, d.a, 0); tmp.scale.setScalar(.7 + .3 * Math.sin(t * 3 + d.w)); tmp.updateMatrix(); swarm.setMatrixAt(i, tmp.matrix); }
206
+ swarm.instanceMatrix.needsUpdate = true;
207
+ // dust burst
208
+ if (bursting > 0) { for (let i = 0; i < DUST * 3; i++) { dpos[i] += dvel[i]; dvel[i] *= .985; } dGeo.attributes.position.needsUpdate = true; bursting = Math.max(0, bursting - dt * .5); }
209
+ dust.rotation.y += dt * .02;
210
+ // nodes
211
+ const v = visible();
212
+ nodes.forEach((n, i) => { const u = n.userData; const a = u.a + t * .04; n.position.set(Math.cos(a) * u.R, u.y + Math.sin(t + i) * .3, Math.sin(a) * u.R);
213
+ n.rotation.z += dt * (i === sel ? 1.5 : .3); const on = v.includes(i); const s = (i === sel ? 1.35 : 1) * (on ? 1 : .6); n.scale.lerp(new THREE.Vector3(s, s, s), .15);
214
+ n.material.emissiveIntensity = i === sel ? 1.2 + Math.sin(t * 6) * .3 : on ? .45 : .1;
215
+ const p = u.line.geometry.attributes.position; p.setXYZ(1, n.position.x, n.position.y, n.position.z); p.needsUpdate = true; u.line.material.opacity = on ? (i === sel ? .8 : .25) : .05; });
216
+ streamPts.forEach((s, k) => { s.t = (s.t + dt * .35) % 1; const p = s.n.position; spPos[k * 3] = p.x * (1 - s.t); spPos[k * 3 + 1] = p.y * (1 - s.t); spPos[k * 3 + 2] = p.z * (1 - s.t); });
217
+ spGeo.attributes.position.needsUpdate = true;
218
+ // hover raycast
219
+ if (started && !drag && mouse.x < 5) { ray.setFromCamera(mouse, camera); const h = ray.intersectObjects(nodes, false)[0]; cv.style.cursor = h ? 'pointer' : 'grab'; if (h && h.object.userData.i !== sel) select(h.object.userData.i); }
220
+ if (renderer) renderer.render(scene, camera);
221
+ // labels + wire
222
+ if (started) {
223
+ nodes.forEach((n, i) => { const p = screenPos(n); const l = labels[i]; l.style.display = p.z < 1 ? '' : 'none'; l.style.left = p.x + 'px'; l.style.top = (p.y + 30) + 'px'; l.classList.toggle('dim', !v.includes(i)); });
224
+ if (openId != null && !pop.hidden) { const p = screenPos(nodes[openId]); const r = pop.getBoundingClientRect(); const wl = $('#wl');
225
+ const tx = p.x < r.left ? r.left : r.right; wl.setAttribute('x1', p.x); wl.setAttribute('y1', p.y); wl.setAttribute('x2', tx); wl.setAttribute('y2', r.top + 14);
226
+ }
227
+ if ((statT += dt) > .5) { statT = 0; stats.innerHTML = `<b>META-ENGINE CORE</b><br>Agenten: ${120 + (Math.sin(t) * 8 | 0)} aktiv<br>Tokens/s: ${(4200 + Math.random() * 900) | 0}<br>Studios: ${STUDIOS.length - 1} + merge<br>Last: ${(55 + Math.sin(t * .7) * 20) | 0}% · <span style="color:#028391">SIMULATION</span>`; }
228
+ }
229
+ }
230
+ applyQuality();
231
+ if (gl3d) frame(); else {
232
+ document.body.insertAdjacentHTML('beforeend', '<div style="position:fixed;left:14px;top:60px;z-index:16;color:#faa968;font-size:11px">⚠ WebGL nicht verfügbar – 2D-Modus</div>');
233
+ // minimal 2D loop to keep labels in a ring
234
+ const tick = () => { requestAnimationFrame(tick); const t = performance.now() / 1000; nodes.forEach((n, i) => { const u = n.userData; const a = u.a + t * .04; n.position.set(Math.cos(a) * u.R, u.y, Math.sin(a) * u.R); });
235
+ camera.position.set(0, 18, 18); camera.lookAt(0, 0, 0); camera.updateMatrixWorld(); if (started) nodes.forEach((n, i) => { n.updateMatrixWorld(); const p = screenPos(n); labels[i].style.left = p.x + 'px'; labels[i].style.top = p.y + 'px'; }); };
236
+ tick();
237
+ }
assets/einswarm-logo.webp ADDED

Git LFS Details

  • SHA256: 1d1967a043a16a6eba43f96774b703497a61e69b5a5933620fe00f6e8c4a865f
  • Pointer size: 131 Bytes
  • Size of remote file: 114 kB
assets/einswarm-mascot.webp ADDED
assets/retro82-bg.webp ADDED

Git LFS Details

  • SHA256: 7a10101c1a1ceec3e5bda6d28cd550daf527e3fc0985b7d3a4cef6959a708a9e
  • Pointer size: 131 Bytes
  • Size of remote file: 485 kB
fonts/jetbrains-mono-latin-400-normal.woff2 ADDED
Binary file (21.2 kB). View file
 
fonts/jetbrains-mono-latin-700-normal.woff2 ADDED
Binary file (21.9 kB). View file
 
index.html CHANGED
@@ -1,19 +1,49 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!doctype html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
6
+ <meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Expires" content="0">
7
+ <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
8
+ <title>STUDIUS · DAS Studio — Einswarm</title>
9
+ <link rel="icon" href="assets/einswarm-mascot.webp">
10
+ <link rel="stylesheet" href="style.css?v=1">
11
+ </head>
12
+ <body>
13
+ <canvas id="gl"></canvas>
14
+ <div id="hexbg"></div>
15
+
16
+ <!-- INTRO -->
17
+ <section id="intro">
18
+ <pre id="boot"></pre>
19
+ <div id="reveal">
20
+ <img id="mascot" src="assets/einswarm-mascot.webp" alt="Einswarm Maskottchen">
21
+ <img id="logo" src="assets/einswarm-logo.webp" alt="Einswarm Logo">
22
+ <h1 class="glitch" data-t="STUDIUS">STUDIUS</h1>
23
+ <p class="sub">DAS STUDIO · META-ENGINE v0.82</p>
24
+ </div>
25
+ <div id="press">▶ PRESS ANY KEY / TAP TO IGNITE</div>
26
+ <button id="skip" type="button">SKIP ⏭</button>
27
+ </section>
28
+
29
+ <!-- HUD -->
30
+ <header id="hud" hidden>
31
+ <div class="brand"><img src="assets/einswarm-mascot.webp" alt=""><b>STUDIUS</b><span>by EINSWARM</span></div>
32
+ <nav id="cats"></nav>
33
+ <div class="hudr">
34
+ <span id="fps">-- fps</span>
35
+ <button id="q" type="button" title="Qualität (Q)">Q:AUTO</button>
36
+ <button id="snd" type="button" title="Sound (M)">🔇</button>
37
+ </div>
38
+ </header>
39
+ <div id="core-stats" hidden></div>
40
+ <div id="labels"></div>
41
+ <svg id="wire"><line id="wl" x1="0" y1="0" x2="0" y2="0"/></svg>
42
+ <div id="pop" hidden></div>
43
+ <footer id="hint" hidden>←→ / WASD wählen · ENTER öffnen · ESC zurück · Maus/Touch: Hover & Klick · Ziehen = Orbit</footer>
44
+
45
+ <a id="bmc" href="https://www.buymeacoffee.com/2btainment" target="_blank" rel="noopener noreferrer">Buy me a coffee</a>
46
+ <noscript><p style="color:#f2c94c;padding:2em">STUDIUS braucht JavaScript.</p></noscript>
47
+ <script type="module" src="app.js?v=3"></script>
48
+ </body>
49
  </html>
style.css CHANGED
@@ -1,28 +1,84 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face{font-family:JBM;src:url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2");font-weight:400;font-display:swap}
2
+ @font-face{font-family:JBM;src:url(fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2");font-weight:700;font-display:swap}
3
+ :root{
4
+ /* Einswarm */ --bk:#050505;--gold:#f2c94c;--gold2:#d4a63a;--golddim:#7a5d1c;
5
+ /* Omarchy Retro-82 */ --r-bg:#05182e;--r-bg2:#020c17;--r-acc:#faa968;--r-or:#e97b3c;--r-red:#f85525;--r-teal:#028391;--r-cy:#8cbfb8;--r-fg:#f6dcac;--r-mut:#2a6b78;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
7
+ *{box-sizing:border-box}
8
+ html,body{margin:0;height:100%;overflow:hidden;background:var(--bk);color:var(--r-fg);font-family:JBM,ui-monospace,Menlo,monospace;-webkit-tap-highlight-color:transparent}
9
+ #gl{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0}
10
+ #hexbg{position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.22;
11
+ background:radial-gradient(ellipse at 50% 120%,rgba(250,169,104,.25),transparent 60%),
12
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97'%3E%3Cpath d='M28 0L56 16v32L28 64 0 48V16zM28 64v33' fill='none' stroke='%23d4a63a' stroke-width='1'/%3E%3C/svg%3E");}
13
+ body::after{content:"";position:fixed;inset:0;pointer-events:none;z-index:50;background:repeating-linear-gradient(0deg,rgba(0,0,0,.18) 0 1px,transparent 1px 3px);mix-blend-mode:multiply}
14
+ button{font:inherit;color:inherit;cursor:pointer}
15
+ /* intro */
16
+ #intro{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;flex-direction:column;
17
+ background:radial-gradient(circle at 50% 50%,rgba(5,24,46,.85),rgba(2,12,23,.97) 70%);transition:opacity .9s}
18
+ #intro.gone{opacity:0;pointer-events:none}
19
+ #boot{position:absolute;left:4vw;top:4vh;margin:0;font-size:clamp(10px,1.4vw,14px);line-height:1.45;color:var(--r-cy);text-shadow:0 0 6px var(--r-teal);white-space:pre-wrap;max-width:92vw}
20
+ #boot .ok{color:var(--gold)} #boot .w{color:var(--r-acc)}
21
+ #reveal{display:flex;flex-direction:column;align-items:center;opacity:0;transform:scale(.6);transition:all 1.2s cubic-bezier(.2,1.4,.3,1)}
22
+ #reveal.on{opacity:1;transform:none}
23
+ #mascot{display:none}
24
+ #logo{width:min(70vw,340px);filter:drop-shadow(0 0 30px rgba(242,201,76,.55));animation:hover 3s ease-in-out infinite}
25
+ @keyframes hover{50%{transform:translateY(-10px) rotate(-2deg)}}
26
+ .glitch{font-size:clamp(40px,9vw,110px);letter-spacing:.18em;margin:.1em 0 0;color:var(--gold);position:relative;
27
+ text-shadow:0 0 18px rgba(242,201,76,.7),3px 0 var(--r-red),-3px 0 var(--r-teal)}
28
+ .glitch::after{content:attr(data-t);position:absolute;left:0;top:0;color:var(--r-acc);clip-path:inset(40% 0 45% 0);animation:gl 2.2s steps(2) infinite;opacity:.8}
29
+ @keyframes gl{0%,90%{transform:none}92%{transform:translateX(6px)}95%{transform:translateX(-5px)}}
30
+ .sub{letter-spacing:.4em;color:var(--r-cy);font-size:clamp(9px,1.3vw,13px)}
31
+ #press{position:absolute;bottom:14vh;color:var(--r-acc);letter-spacing:.3em;font-size:clamp(11px,1.6vw,16px);opacity:0;animation:blink 1.1s steps(2) infinite}
32
+ #press.on{opacity:1}
33
+ @keyframes blink{50%{visibility:hidden}}
34
+ #skip{position:absolute;top:16px;right:16px;background:rgba(0,0,0,.5);border:1px solid var(--gold2);padding:6px 14px;letter-spacing:.2em;color:var(--gold)}
35
+ /* hud */
36
+ #hud{position:fixed;top:0;left:0;right:0;z-index:20;display:flex;align-items:center;gap:12px;padding:10px 14px;
37
+ background:linear-gradient(180deg,rgba(0,0,0,.85),transparent);border-bottom:1px solid rgba(212,166,58,.35)}
38
+ .brand{display:flex;align-items:center;gap:8px}.brand img{width:34px}.brand b{color:var(--gold);letter-spacing:.2em}.brand span{font-size:10px;color:var(--r-cy)}
39
+ #cats{display:flex;gap:4px;flex:1;overflow-x:auto;scrollbar-width:none}
40
+ #cats button{background:rgba(5,24,46,.6);border:1px solid var(--golddim);padding:5px 10px;font-size:11px;letter-spacing:.12em;white-space:nowrap;
41
+ clip-path:polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%)}
42
+ #cats button.on{background:var(--gold);color:#000;border-color:var(--gold)}
43
+ .hudr{display:flex;gap:6px;align-items:center;font-size:11px}
44
+ .hudr button{background:#000;border:1px solid var(--gold2);padding:4px 8px;color:var(--gold)}
45
+ #fps{color:var(--r-teal);min-width:48px}
46
+ #core-stats{position:fixed;left:14px;bottom:44px;z-index:15;font-size:11px;line-height:1.6;color:var(--r-cy);border-left:2px solid var(--gold);padding:6px 10px;background:rgba(0,0,0,.45)}
47
+ #core-stats b{color:var(--gold)}
48
+ #labels{position:fixed;inset:0;z-index:10;pointer-events:none}
49
+ .lbl{position:absolute;transform:translate(-50%,-50%);pointer-events:auto;cursor:pointer;font-size:11px;letter-spacing:.1em;padding:4px 8px;white-space:nowrap;
50
+ background:rgba(0,0,0,.72);border:1px solid var(--golddim);color:var(--r-fg);transition:background .15s,transform .15s}
51
+ .lbl i{font-style:normal;color:var(--r-acc);margin-right:4px}
52
+ .lbl.sel{border-color:var(--gold);background:rgba(242,201,76,.16);color:var(--gold);box-shadow:0 0 14px rgba(242,201,76,.5);transform:translate(-50%,-50%) scale(1.12)}
53
+ .lbl.dim{opacity:.25}
54
+ #wire{position:fixed;inset:0;width:100%;height:100%;z-index:11;pointer-events:none}
55
+ #wl{stroke:var(--gold);stroke-width:1;stroke-dasharray:3 3;opacity:0}
56
+ #wire.on #wl{opacity:.9}
57
+ /* popup */
58
+ #pop{position:fixed;z-index:30;width:min(320px,92vw);background:rgba(3,10,18,.94);border:1px solid var(--gold);color:var(--r-fg);
59
+ box-shadow:0 0 0 1px #000,0 0 30px rgba(242,201,76,.25);font-size:12px;animation:pin .18s ease-out;
60
+ clip-path:polygon(14px 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%,0 14px)}
61
+ @keyframes pin{from{transform:scale(.85);opacity:0}}
62
+ #pop .ph{display:flex;align-items:center;gap:6px;padding:6px 10px;background:linear-gradient(90deg,var(--gold2),var(--r-acc));color:#000;font-weight:700;letter-spacing:.1em}
63
+ #pop .ph small{font-weight:400;opacity:.7;margin-left:auto}
64
+ #pop .ph button{background:#000;color:var(--gold);border:0;padding:0 6px}
65
+ #pop .pb{padding:10px}
66
+ #pop input,#pop textarea{width:100%;background:#000;border:1px solid var(--r-mut);color:var(--r-fg);font:inherit;padding:5px}
67
+ #pop .row{display:flex;gap:6px;align-items:center;margin-top:6px;flex-wrap:wrap}
68
+ #pop .btn{background:var(--gold);color:#000;border:0;padding:4px 10px;font-weight:700}
69
+ #pop .btn.alt{background:transparent;color:var(--gold);border:1px solid var(--gold2)}
70
+ #pop canvas{width:100%;display:block;background:#000;border:1px solid var(--r-mut);touch-action:none}
71
+ .chat{height:110px;overflow:auto;background:#000;border:1px solid var(--r-mut);padding:6px;margin-bottom:6px}
72
+ .chat p{margin:0 0 5px}.chat .u{color:var(--r-acc)}.chat .a{color:var(--r-cy)}
73
+ .prog{height:6px;background:#000;border:1px solid var(--r-mut)}.prog i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--r-teal),var(--gold));transition:width .2s}
74
+ .track{position:relative;height:18px;background:#000;border:1px solid #222;margin-top:3px}
75
+ .clip{position:absolute;top:1px;bottom:1px;cursor:grab;font-size:9px;color:#000;padding-left:3px;overflow:hidden}
76
+ .grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}
77
+ .grid div{aspect-ratio:1;border:1px solid var(--golddim);display:flex;align-items:flex-end;padding:3px;font-size:9px;cursor:pointer}
78
+ .code{background:#000;border:1px solid var(--r-mut);padding:6px;font-size:11px;min-height:70px;white-space:pre;overflow:auto;color:var(--r-cy)}
79
+ .k{color:var(--r-red)}.s{color:var(--gold)}
80
+ input[type=range]{accent-color:var(--gold);flex:1}
81
+ #hint{position:fixed;bottom:0;left:0;right:0;z-index:15;text-align:center;font-size:10px;padding:8px 150px 8px 8px;color:var(--r-mut);letter-spacing:.1em}
82
+ #bmc{position:fixed;right:14px;bottom:12px;z-index:60;background:#FFDD00;color:#000;font:700 13px/1 system-ui,sans-serif;padding:10px 14px;border-radius:8px;text-decoration:none;box-shadow:0 2px 10px rgba(0,0,0,.5)}
83
+ @media (max-width:700px){.brand span,#hint{display:none}#core-stats{bottom:60px;font-size:10px}#hud{flex-wrap:wrap}#cats{order:3;flex-basis:100%}
84
+ #pop{left:4vw!important;right:4vw;width:auto;bottom:60px;top:auto!important}}
vendor/three.module.min.js ADDED
The diff for this file is too large to render. See raw diff
 
widgets.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // STUDIUS nano-widgets — pure simulation, no backends.
2
+ const $ = (h) => { const t = document.createElement('template'); t.innerHTML = h.trim(); return t.content.firstChild; };
3
+ const G = '#f2c94c', OR = '#faa968', TE = '#028391', CY = '#8cbfb8', RD = '#f85525';
4
+ const loops = new Set();
5
+ export function stopLoops(){ loops.forEach(id=>cancelAnimationFrame(id)); loops.clear(); }
6
+ function loop(fn){ let id; const f=(t)=>{ fn(t); id=requestAnimationFrame(f); loops.add(id); }; id=requestAnimationFrame(f); loops.add(id); }
7
+ function cv(el,h=110){ const c=el.querySelector('canvas'); const w=c.clientWidth||300; c.width=w*devicePixelRatio; c.height=h*devicePixelRatio; c.style.height=h+'px'; const x=c.getContext('2d'); x.scale(devicePixelRatio,devicePixelRatio); return [c,x,w,h]; }
8
+ function fakeProgress(el,ms,done){ const i=el.querySelector('.prog i'); let p=0; const t=setInterval(()=>{ p+=100/(ms/80); i.style.width=Math.min(p,100)+'%'; if(p>=100){clearInterval(t); done&&done();} },80); }
9
+
10
+ export const STUDIOS = [
11
+ {id:'chat',cat:'Text',icon:'💬',name:'Chat',like:'ChatGPT-like',build(el){
12
+ el.innerHTML=`<div class="chat"><p class="a">◆ STUDIUS-Core bereit. Frag mich etwas.</p></div><div class="row"><input placeholder="Nachricht… (Enter)"><button class="btn">➤</button></div>`;
13
+ const log=el.querySelector('.chat'),inp=el.querySelector('input');
14
+ const R=['Simuliere Antwort über 7 Agenten im Schwarm…','Gute Frage! Der Schwarm schlägt 3 Varianten vor.','Ich habe das an das Coding-Studio weitergeleitet (simuliert).','Zusammenfassung: Klar, machbar, mit Gold-Rand. 🐝'];
15
+ const send=()=>{ if(!inp.value.trim())return; log.insertAdjacentHTML('beforeend',`<p class="u">› ${inp.value.replace(/</g,'&lt;')}</p>`); inp.value='';
16
+ const p=$(`<p class="a">◆ </p>`); log.append(p); const txt=R[Math.random()*R.length|0]; let k=0; const t=setInterval(()=>{p.textContent='◆ '+txt.slice(0,++k); log.scrollTop=1e4; if(k>=txt.length)clearInterval(t);},18); };
17
+ el.querySelector('button').onclick=send; inp.onkeydown=e=>{e.stopPropagation(); if(e.key==='Enter')send();};
18
+ }},
19
+ {id:'image',cat:'Bild',icon:'🖌',name:'Image Edit',like:'Photoshop-like',build(el){
20
+ el.innerHTML=`<canvas></canvas><div class="row">Hue<input type="range" min="0" max="360" value="0"> <button class="btn alt">Pinsel</button><button class="btn alt">Reset</button></div>`;
21
+ const [c,x,w,h]=cv(el,120); let hue=0, brush=false, paint=[];
22
+ const draw=()=>{ const g=x.createLinearGradient(0,0,w,h); g.addColorStop(0,`hsl(${30+hue},80%,55%)`); g.addColorStop(1,`hsl(${200+hue},70%,20%)`); x.fillStyle=g; x.fillRect(0,0,w,h);
23
+ x.fillStyle=`hsl(${45+hue},90%,60%)`; x.beginPath(); x.arc(w*.7,h*.4,24,0,7); x.fill(); x.fillStyle='#000'; for(let i=0;i<5;i++){x.beginPath();x.moveTo(i*w/4-40,h);x.lineTo(i*w/4+20,h*.55);x.lineTo(i*w/4+80,h);x.fill();}
24
+ x.fillStyle=G; paint.forEach(p=>{x.beginPath();x.arc(p[0],p[1],4,0,7);x.fill();}); };
25
+ draw(); el.querySelector('input').oninput=e=>{hue=+e.target.value;draw();};
26
+ const [b1,b2]=el.querySelectorAll('.btn'); b1.onclick=()=>{brush=!brush;b1.classList.toggle('alt');}; b2.onclick=()=>{paint=[];hue=0;el.querySelector('input').value=0;draw();};
27
+ c.onpointermove=e=>{ if(brush&&e.buttons){ const r=c.getBoundingClientRect(); paint.push([e.clientX-r.left,e.clientY-r.top]); draw(); } };
28
+ }},
29
+ {id:'videogen',cat:'Video',icon:'🎬',name:'Video Gen',like:'Sora-like',build(el){
30
+ el.innerHTML=`<input value="Goldene Biene fliegt durch Hex-Stadt bei Sonnenuntergang"><div class="row"><button class="btn">Generieren</button><span class="st">bereit</span></div><div class="prog" style="margin:6px 0"><i></i></div><canvas></canvas>`;
31
+ const [c,x,w,h]=cv(el,100); let on=false; el.querySelector('input').onkeydown=e=>e.stopPropagation();
32
+ el.querySelector('.btn').onclick=()=>{ el.querySelector('.st').textContent='Diffusion… (simuliert)'; fakeProgress(el,1800,()=>{on=true;el.querySelector('.st').textContent='▶ 4s · 720p';}); };
33
+ loop(t=>{ x.fillStyle='#000';x.fillRect(0,0,w,h); if(!on){ for(let i=0;i<300;i++){x.fillStyle=`rgba(242,201,76,${Math.random()*.4})`;x.fillRect(Math.random()*w,Math.random()*h,2,2);} return;}
34
+ const s=t/1000; const g=x.createLinearGradient(0,0,0,h); g.addColorStop(0,'#05182e');g.addColorStop(1,OR); x.fillStyle=g;x.fillRect(0,0,w,h);
35
+ x.fillStyle='#020c17'; for(let i=0;i<10;i++){const bx=((i*47-s*30)%(w+60)+w+60)%(w+60)-30; x.fillRect(bx,h-20-(i*13%40),26,60);}
36
+ const bx=w/2+Math.sin(s*1.3)*w*.3, by=h*.4+Math.sin(s*3)*10; x.fillStyle=G;x.beginPath();x.ellipse(bx,by,9,6,0,0,7);x.fill(); x.fillStyle='rgba(246,220,172,.7)';x.beginPath();x.ellipse(bx-2,by-7,6,3+Math.sin(s*40)*2,0,0,7);x.fill(); });
37
+ }},
38
+ {id:'videoedit',cat:'Video',icon:'✂',name:'Video Edit',like:'CapCut-like',build(el){
39
+ el.innerHTML=`<div style="font-size:10px;color:${CY}">Clips ziehen · Playhead läuft</div><div class="tl" style="position:relative"></div><div class="row"><button class="btn">▶/❚❚</button><span class="tc">00:00</span></div>`;
40
+ const tl=el.querySelector('.tl'); const tracks=[[['Intro',0,30,G],['Swarm',32,40,OR]],[['Titel',10,25,CY]],[['Musik',0,90,TE]]];
41
+ tracks.forEach(tr=>{ const d=$(`<div class="track"></div>`); tr.forEach(([n,l,wd,col])=>{ const c=$(`<div class="clip" style="left:${l}%;width:${wd}%;background:${col}">${n}</div>`);
42
+ c.onpointerdown=e=>{ e.stopPropagation(); c.setPointerCapture(e.pointerId); const sx=e.clientX, sl=parseFloat(c.style.left); c.onpointermove=m=>{ c.style.left=Math.max(0,Math.min(100-wd,sl+(m.clientX-sx)/d.clientWidth*100))+'%'; }; c.onpointerup=()=>c.onpointermove=null; };
43
+ d.append(c); }); tl.append(d); });
44
+ const ph=$(`<div style="position:absolute;top:0;bottom:0;width:2px;background:${RD};left:0"></div>`); tl.append(ph); let play=true,p=0;
45
+ el.querySelector('.btn').onclick=()=>play=!play; loop(()=>{ if(play){p=(p+.15)%100; ph.style.left=p+'%'; el.querySelector('.tc').textContent='00:'+String(Math.floor(p*.3)).padStart(2,'0');} });
46
+ }},
47
+ {id:'audio',cat:'Audio',icon:'〰',name:'Audio Edit',like:'Audition-like',build(el){
48
+ el.innerHTML=`<canvas></canvas><div class="row">Gain<input type="range" min="10" max="200" value="100"><button class="btn alt">Normalize</button></div>`;
49
+ const [c,x,w,h]=cv(el,90); let gain=1, sel=null; const N=Math.floor(w); const data=[...Array(N)].map((_,i)=>Math.sin(i*.07)*Math.sin(i*.013)*.8+(Math.random()-.5)*.3);
50
+ el.querySelector('input').oninput=e=>gain=e.target.value/100; el.querySelector('.btn').onclick=()=>gain=1/Math.max(...data.map(Math.abs));
51
+ c.onpointerdown=e=>{const r=c.getBoundingClientRect(); sel=[e.clientX-r.left,e.clientX-r.left]; c.onpointermove=m=>sel[1]=m.clientX-r.left; c.onpointerup=()=>c.onpointermove=null;};
52
+ loop(t=>{ x.fillStyle='#000';x.fillRect(0,0,w,h); if(sel){x.fillStyle='rgba(2,131,145,.35)';x.fillRect(Math.min(...sel),0,Math.abs(sel[1]-sel[0]),h);}
53
+ x.strokeStyle=G;x.beginPath(); for(let i=0;i<N;i++){const v=Math.max(-1,Math.min(1,data[i]*gain)); x.moveTo(i,h/2-v*h/2.2); x.lineTo(i,h/2+v*h/2.2);} x.stroke();
54
+ const px=(t/20)%w; x.fillStyle=RD;x.fillRect(px,0,1.5,h); });
55
+ }},
56
+ {id:'stems',cat:'Audio',icon:'🎚',name:'Stem Split',like:'Moises-like',build(el){
57
+ const S=[['Vocals',G],['Drums',OR],['Bass',TE],['Other',CY]];
58
+ el.innerHTML=`<div class="row"><button class="btn">Trennen</button><div class="prog" style="flex:1"><i></i></div></div><div class="st"></div>`;
59
+ el.querySelector('.btn').onclick=()=>fakeProgress(el,1200,()=>{ const st=el.querySelector('.st'); st.innerHTML=S.map(([n,c])=>`<div class="row"><span style="width:52px;color:${c}">${n}</span><input type="range" value="80"><button class="btn alt" data-m>M</button></div>`).join('');
60
+ st.querySelectorAll('[data-m]').forEach(b=>b.onclick=()=>b.classList.toggle('alt')); });
61
+ }},
62
+ {id:'music',cat:'Audio',icon:'🎵',name:'Music Gen',like:'Suno-like',build(el){
63
+ el.innerHTML=`<input value="Synthwave über Bienen im Retro-82 Sonnenuntergang"><div class="row"><button class="btn">♪ Song erzeugen</button></div><div class="songs"></div>`;
64
+ el.querySelector('input').onkeydown=e=>e.stopPropagation();
65
+ el.querySelector('.btn').onclick=()=>{ const s=el.querySelector('.songs'); const n=['Golden Hive','Hex Sunset','Swarm Drive'][s.children.length%3];
66
+ const d=$(`<div class="row" style="border:1px solid #333;padding:4px"><span style="background:linear-gradient(135deg,${OR},${TE});width:26px;height:26px;display:inline-block"></span><span>${n}<br><small style="color:${CY}">2:4${s.children.length} · v4 sim</small></span><span class="eq" style="margin-left:auto;letter-spacing:-2px;color:${G}"></span></div>`); s.prepend(d);
67
+ let k=0; const t=setInterval(()=>{ if(!d.isConnected)return clearInterval(t); d.querySelector('.eq').textContent=[...Array(8)].map(()=>'▁▂▃▄▅▆▇'[Math.random()*7|0]).join(''); if(++k>200)clearInterval(t);},120); };
68
+ }},
69
+ {id:'auto',cat:'Automation',icon:'⛓',name:'Automation',like:'n8n-like',build(el){
70
+ el.innerHTML=`<canvas></canvas><div class="row"><button class="btn">▶ Execute workflow</button><span class="st" style="color:${CY}">Knoten ziehbar</span></div>`;
71
+ const [c,x,w,h]=cv(el,120); const N=[['Webhook',20,50],['KI-Agent',w*.38,25],['Filter',w*.38,85],['Slack',w*.7,50]].map(a=>({n:a[0],x:a[1],y:a[2],on:0}));
72
+ const E=[[0,1],[0,2],[1,3],[2,3]]; let drag=null, run=-1, rt=0;
73
+ c.onpointerdown=e=>{const r=c.getBoundingClientRect(),mx=e.clientX-r.left,my=e.clientY-r.top; drag=N.find(n=>mx>n.x&&mx<n.x+70&&my>n.y-12&&my<n.y+12); c.setPointerCapture(e.pointerId); c.onpointermove=m=>{if(drag){drag.x=m.clientX-r.left-35;drag.y=m.clientY-r.top;}}; c.onpointerup=()=>{drag=null;c.onpointermove=null;};};
74
+ el.querySelector('.btn').onclick=()=>{run=0;rt=0;N.forEach(n=>n.on=0);};
75
+ loop(()=>{ x.fillStyle='#020c17';x.fillRect(0,0,w,h); if(run>=0){rt++; if(rt%30===0){N[[0,1,2,3][run]].on=1; run++; if(run>3){run=-1; el.querySelector('.st').textContent='✔ 4/4 Knoten OK (sim)';}}}
76
+ E.forEach(([a,b])=>{const A=N[a],B=N[b];x.strokeStyle=A.on&&B.on?G:'#2a6b78';x.beginPath();x.moveTo(A.x+70,A.y);x.bezierCurveTo(A.x+100,A.y,B.x-30,B.y,B.x,B.y);x.stroke();});
77
+ N.forEach(n=>{x.fillStyle=n.on?'#3a2f10':'#000';x.strokeStyle=n.on?G:OR;x.fillRect(n.x,n.y-12,70,24);x.strokeRect(n.x,n.y-12,70,24);x.fillStyle=n.on?G:'#f6dcac';x.font='10px JBM';x.fillText(n.n,n.x+6,n.y+4);}); });
78
+ }},
79
+ {id:'agent',cat:'Automation',icon:'🤖',name:'Agent Builder',like:'Agent builder',build(el){
80
+ const tools=['Web-Suche','Code','Datei','Mail','Kalender','Bild'];
81
+ el.innerHTML=`<input value="Recherche-Biene"><div style="margin:6px 0;font-size:10px;color:${CY}">Tools wählen:</div><div class="row tl">${tools.map(t=>`<button class="btn alt">${t}</button>`).join('')}</div><div class="row"><button class="btn go">Agent deployen</button></div><div class="code"></div>`;
82
+ el.querySelector('input').onkeydown=e=>e.stopPropagation();
83
+ el.querySelectorAll('.tl .btn').forEach(b=>b.onclick=()=>b.classList.toggle('alt'));
84
+ el.querySelector('.go').onclick=()=>{ const sel=[...el.querySelectorAll('.tl .btn:not(.alt)')].map(b=>b.textContent); el.querySelector('.code').innerHTML=`<span class="k">agent</span> <span class="s">"${el.querySelector('input').value}"</span>\n tools: [${sel.join(', ')||'–'}]\n model: einswarm-core (sim)\n status: <span class="s">● LIVE im Schwarm</span>`; };
85
+ }},
86
+ {id:'code',cat:'Code',icon:'⌨',name:'Coding Studio',like:'IDE',build(el){
87
+ el.innerHTML=`<textarea rows="5" spellcheck="false">function swarm(n){\n return Array.from({length:n},(_,i)=>'🐝'+i)\n}\nswarm(5)</textarea><div class="row"><button class="btn">▶ Run</button><button class="btn alt">✨ KI-Fix</button></div><div class="code out">// Ausgabe</div>`;
88
+ const ta=el.querySelector('textarea'); ta.onkeydown=e=>e.stopPropagation(); const out=el.querySelector('.out');
89
+ const [r,f]=el.querySelectorAll('.btn'); r.onclick=()=>{ try{ out.textContent='> '+JSON.stringify(Function('"use strict";'+ta.value.replace(/\n([^\n]*)$/,'\nreturn $1'))()); }catch(e){ out.textContent='✖ '+e.message; } };
90
+ f.onclick=()=>{ out.textContent='✨ KI schlägt vor: Typen ergänzen, Tests schreiben (simuliert)'; };
91
+ }},
92
+ {id:'community',cat:'Community',icon:'🌐',name:'Community Hub',like:'websim-like',build(el){
93
+ const items=['Hex Racer','Bee Synth','Gold Chat','Retro OS','Swarm Map','Pixel Hive'];
94
+ el.innerHTML=`<div class="grid">${items.map((n,i)=>`<div style="background:linear-gradient(${i*60}deg,#05182e,${[G,OR,TE][i%3]}33)">${n}<br>♥ <b>${(i*37+12)}</b></div>`).join('')}</div><div class="row"><button class="btn">+ Eigene Sim hosten</button></div>`;
95
+ el.querySelectorAll('.grid div').forEach(d=>d.onclick=()=>{ const b=d.querySelector('b'); b.textContent=+b.textContent+1; d.style.borderColor=G; });
96
+ el.querySelector('.btn').onclick=e=>e.target.textContent='✔ veröffentlicht unter /sim/neu (sim)';
97
+ }},
98
+ {id:'sandbox',cat:'Code',icon:'🧪',name:'Sandbox',like:'Container',build(el){
99
+ el.innerHTML=`<div class="code term">$ </div><div class="row"><input placeholder="Befehl: ls, whoami, swarm, help"></div>`;
100
+ const t=el.querySelector('.term'), i=el.querySelector('input'); const C={ls:'agents/ studios/ hive.toml',whoami:'rob@studius-sandbox',swarm:'🐝 128 Agenten aktiv · 0 Fehler',help:'ls whoami swarm clear'};
101
+ i.onkeydown=e=>{e.stopPropagation(); if(e.key==='Enter'){ const v=i.value.trim(); if(v==='clear')t.textContent='$ '; else t.textContent+=v+'\n'+(C[v]||'command not found: '+v)+'\n$ '; i.value=''; t.scrollTop=1e4; } };
102
+ }},
103
+ {id:'design',cat:'Design',icon:'📐',name:'Design Board',like:'Figma/Excalidraw-like',build(el){
104
+ el.innerHTML=`<canvas></canvas><div class="row"><button class="btn" data-t="rect">▭</button><button class="btn alt" data-t="hex">⬡</button><button class="btn alt" data-t="text">T</button><span style="font-size:10px;color:${CY}">klicken = Form setzen</span></div>`;
105
+ const [c,x,w,h]=cv(el,120); let tool='rect'; const shapes=[{t:'hex',x:60,y:60},{t:'rect',x:150,y:50},{t:'text',x:200,y:95}];
106
+ el.querySelectorAll('[data-t]').forEach(b=>b.onclick=()=>{tool=b.dataset.t; el.querySelectorAll('[data-t]').forEach(o=>o.classList.toggle('alt',o!==b));});
107
+ c.onclick=e=>{const r=c.getBoundingClientRect(); shapes.push({t:tool,x:e.clientX-r.left,y:e.clientY-r.top});};
108
+ loop(()=>{ x.fillStyle='#0b0b0b';x.fillRect(0,0,w,h); x.fillStyle='#1d1d1d'; for(let i=0;i<w;i+=12)for(let j=0;j<h;j+=12)x.fillRect(i,j,1,1);
109
+ shapes.forEach(s=>{x.strokeStyle=s.t==='hex'?G:OR;x.lineWidth=1.5; if(s.t==='rect')x.strokeRect(s.x-22,s.y-14,44,28); else if(s.t==='hex'){x.beginPath();for(let k=0;k<7;k++){const a=k*Math.PI/3;x.lineTo(s.x+20*Math.cos(a),s.y+20*Math.sin(a));}x.stroke();} else {x.fillStyle=CY;x.font='12px JBM';x.fillText('Idee',s.x,s.y);} }); });
110
+ }},
111
+ {id:'canvas',cat:'Design',icon:'🎨',name:'Canvas',like:'Freihand',build(el){
112
+ el.innerHTML=`<canvas></canvas><div class="row">${[G,OR,TE,RD,'#f6dcac'].map(c=>`<button class="btn" style="background:${c};width:22px;height:18px;padding:0" data-c="${c}"></button>`).join('')}<button class="btn alt cl">Leeren</button></div>`;
113
+ const [c,x,w,h]=cv(el,120); let col=G,last=null; x.fillStyle='#000';x.fillRect(0,0,w,h);
114
+ el.querySelectorAll('[data-c]').forEach(b=>b.onclick=()=>col=b.dataset.c); el.querySelector('.cl').onclick=()=>{x.fillStyle='#000';x.fillRect(0,0,w,h);};
115
+ c.onpointerdown=e=>{c.setPointerCapture(e.pointerId);const r=c.getBoundingClientRect();last=[e.clientX-r.left,e.clientY-r.top];};
116
+ c.onpointermove=e=>{ if(!last)return; const r=c.getBoundingClientRect(),p=[e.clientX-r.left,e.clientY-r.top]; x.strokeStyle=col;x.lineWidth=3;x.lineCap='round';x.beginPath();x.moveTo(...last);x.lineTo(...p);x.stroke();last=p;};
117
+ c.onpointerup=()=>last=null;
118
+ }},
119
+ {id:'merge',cat:'+',icon:'+',name:'Merge',like:'Studio andocken',build(el){
120
+ const more=['3D-Studio','Game-Studio','Podcast','Übersetzer','Daten-Lab','Avatar'];
121
+ el.innerHTML=`<div style="font-size:11px;color:${CY};margin-bottom:6px">Weitere Studios in den Kern mergen (Simulation):</div><div class="row">${more.map(m=>`<button class="btn alt">+ ${m}</button>`).join('')}</div><div class="code" style="min-height:30px">STUDIUS-Kern: 15 Module</div>`;
122
+ let n=15; el.querySelectorAll('.btn').forEach(b=>b.onclick=()=>{ if(b.disabled)return; b.disabled=true; b.textContent='✔ '+b.textContent.slice(2); b.classList.remove('alt'); el.querySelector('.code').textContent=`STUDIUS-Kern: ${++n} Module · Merge OK (sim)`; window.dispatchEvent(new CustomEvent('studius-merge')); });
123
+ }},
124
+ ];