Sl8th commited on
Commit
dd6dffb
Β·
verified Β·
1 Parent(s): 0ad926e

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +566 -441
index.html CHANGED
@@ -3,488 +3,613 @@
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Mala-Motion Suite β€” Portfolio</title>
7
  <style>
8
- * { box-sizing:border-box; margin:0; padding:0; }
9
  :root {
10
- --bg:#0f1013; --panel:#17181d; --panel2:#1e2027; --border:#2a2d36;
11
- --text:#e8e9ec; --muted:#8b8f9c;
12
- --orange:#ff6b1a; --orange2:#ffa25e; --orange-dim:rgba(255,107,26,.14);
 
 
 
 
 
 
13
  }
14
- body { font-family:Inter,Segoe UI,system-ui,-apple-system,sans-serif; background:var(--bg); color:var(--text);
15
- height:100vh; display:flex; flex-direction:column; overflow:hidden; }
16
- .topbar { height:48px; background:var(--panel); border-bottom:1px solid var(--border);
17
- display:flex; align-items:center; gap:10px; padding:0 14px; flex-shrink:0; }
18
- .logo { width:26px; height:26px; border-radius:7px; background:linear-gradient(135deg,var(--orange),#ff2e63);
19
- display:grid; place-items:center; font-weight:800; font-size:14px; color:#fff; }
20
- .title { font-weight:650; font-size:14px; } .title span { color:var(--orange2); }
21
- .pill { font-size:11px; color:var(--muted); border:1px solid var(--border); padding:4px 9px;
22
- border-radius:999px; background:#121319; white-space:nowrap; }
23
- .pill b { color:var(--orange2); }
 
 
 
 
 
 
 
 
 
24
  .spacer { flex:1; }
25
- .btn { font-size:12px; border:1px solid var(--border); background:var(--panel2); color:var(--text);
26
- padding:7px 12px; border-radius:8px; cursor:pointer; white-space:nowrap; }
27
- .btn:hover { border-color:var(--orange); }
28
- .btn.acc { background:var(--orange); border-color:var(--orange); color:#111; font-weight:700; }
29
- .btn.locked { border-color:var(--orange); color:var(--orange2); }
 
30
  .main { flex:1; display:flex; min-height:0; }
31
- /* Slim editorial sidebar β€” no bulky cards */
32
- .sidebar { width:212px; background:var(--panel); border-right:1px solid var(--border); padding:12px;
33
- display:flex; flex-direction:column; gap:8px; flex-shrink:0; overflow:auto; }
34
- .sidebar h3 { font-size:10px; text-transform:uppercase; letter-spacing:.14em; color:var(--muted); margin:6px 2px 2px; }
35
- .rail { display:flex; align-items:center; gap:0; font-size:10px; color:var(--muted); padding:2px; }
36
- .rail .st { display:flex; align-items:center; gap:5px; white-space:nowrap; }
37
- .rail .ln { flex:1; height:1px; background:linear-gradient(90deg,var(--orange),transparent); margin:0 6px; min-width:8px; }
38
- .dot { width:8px; height:8px; border-radius:50%; background:var(--orange); box-shadow:0 0 8px var(--orange); flex-shrink:0; }
39
- .afile { display:flex; align-items:center; gap:8px; padding:6px 8px; border:1px solid transparent;
40
- border-radius:8px; font-size:11px; cursor:default; }
41
- .afile:hover { border-color:var(--border); background:var(--panel2); }
42
- .afile img { width:30px; height:30px; object-fit:cover; border-radius:6px; border:1px solid var(--border); }
43
- .afile .nm { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
44
- .afile .sz { font-size:10px; color:var(--muted); }
45
- .afile button { margin-left:auto; font-size:10px; font-weight:700; border:1px solid var(--border); background:#121319;
46
- color:var(--text); padding:3px 8px; border-radius:6px; cursor:pointer; }
47
- .afile button:hover { border-color:var(--orange); color:var(--orange2); }
48
- .side-note { font-size:10px; color:var(--muted); line-height:1.6; padding:0 2px; }
49
- /* Viewport */
50
- .viewport { flex:1; position:relative; overflow:hidden; background:#0b0c0f; cursor:grab; min-width:0; }
51
- .viewport.panning { cursor:grabbing; }
52
- #fogGL { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
53
- #grid { position:absolute; inset:0; pointer-events:none;
54
- background-image:radial-gradient(circle,#2e323e 1px,transparent 1px); background-size:26px 26px; }
55
- #links { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
56
- #links path { stroke:var(--orange); stroke-width:1.5; fill:none; opacity:.75; }
57
- #links circle { fill:var(--orange); }
58
- #world { position:absolute; left:0; top:0; transform-origin:0 0; }
59
- .hint { position:absolute; top:12px; left:50%; transform:translateX(-50%); font-size:11px; color:var(--muted);
60
- background:rgba(23,24,29,.92); border:1px solid var(--border); padding:6px 12px; border-radius:999px;
61
- pointer-events:none; white-space:nowrap; z-index:5; }
62
- /* Permanent floating note CTA β€” screen-fixed, survives pan/zoom */
63
- .notecta { position:absolute; bottom:14px; left:50%; transform:translateX(-50%); z-index:6;
64
- display:flex; align-items:center; gap:9px; padding:9px 18px; border-radius:999px; cursor:pointer;
65
- background:rgba(18,19,25,.86); backdrop-filter:blur(8px);
66
- border:1px solid var(--orange); box-shadow:0 0 14px rgba(255,107,26,.45), inset 0 0 8px rgba(255,107,26,.08);
67
- color:var(--text); font:600 12px/1 Inter,Segoe UI,system-ui,sans-serif; white-space:nowrap;
68
- transition:box-shadow .2s, transform .15s; }
69
- .notecta:hover { box-shadow:0 0 22px rgba(255,107,26,.7), inset 0 0 10px rgba(255,107,26,.14); transform:translateX(-50%) translateY(-1px); }
70
- .notecta:active { transform:translateX(-50%) translateY(0); }
71
- .notecta svg { width:16px; height:16px; stroke:var(--orange2); filter:drop-shadow(0 0 4px rgba(255,162,94,.9)); flex-shrink:0; }
72
- .notecta small { font-weight:400; color:var(--muted); }
73
- @media (max-width:680px){ .notecta small { display:none; } }
74
- .zoomctl { position:absolute; right:12px; bottom:12px; display:flex; gap:4px; z-index:5;
75
- background:rgba(23,24,29,.92); border:1px solid var(--border); border-radius:9px; padding:4px; }
76
- .zoomctl button { font-size:12px; border:1px solid transparent; background:transparent; color:var(--text);
77
- padding:4px 9px; border-radius:6px; cursor:pointer; }
78
- .zoomctl button:hover { border-color:var(--orange); color:var(--orange2); }
79
- .zoomctl span { font-size:11px; color:var(--muted); align-self:center; padding:0 4px; min-width:44px; text-align:center; }
80
- #toast { position:absolute; top:52px; left:50%; transform:translateX(-50%); font-size:11px; color:var(--orange2);
81
- background:rgba(23,24,29,.95); border:1px solid var(--orange); padding:6px 14px; border-radius:999px;
82
- opacity:0; transition:opacity .25s; pointer-events:none; z-index:6; }
83
- /* Minimal media tiles β€” thin frames, no bulky cards */
84
- .tile { position:absolute; border:1px solid var(--border); border-radius:10px; overflow:hidden; background:#0b0c0f; }
85
- .tile img { width:100%; display:block; pointer-events:none; }
86
- .tile .cap { display:flex; align-items:center; gap:7px; font-size:10px; color:var(--muted);
87
- padding:7px 10px; border-top:1px solid var(--border); background:rgba(23,24,29,.9); }
88
- .tile .cap b { color:var(--text); font-weight:600; }
89
- .tile .x { margin-left:auto; border:1px solid var(--border); background:transparent; color:var(--muted);
90
- border-radius:999px; width:18px; height:18px; font-size:10px; cursor:pointer; line-height:1; }
91
- .tile .x:hover { border-color:#ff4d4d; color:#ff8080; }
92
- body.locked .tile .x, body.locked .studio-only { display:none !important; }
93
- body.locked .tile { cursor:default; }
94
- body:not(.locked) .tile { cursor:move; }
95
- .tile.textile { padding:22px 24px; max-width:340px; }
96
- .tile.textile h2 { font-size:22px; font-weight:750; letter-spacing:-.01em; line-height:1.25; }
97
- .tile.textile h2 em { color:var(--orange2); font-style:normal; }
98
- .tile.textile p { font-size:11px; color:var(--muted); margin-top:8px; line-height:1.7; }
99
- /* Sticky notes β€” ultra-minimal */
100
- .note { position:absolute; width:196px; background:rgba(30,32,39,.97); border:1px solid var(--border);
101
- border-left:2px solid var(--orange); border-radius:4px 10px 10px 10px; box-shadow:0 8px 24px rgba(0,0,0,.45); }
102
- .note-head { display:flex; align-items:center; gap:6px; padding:7px 9px 0; cursor:grab; }
103
- .note-head .who { font-size:10px; font-weight:700; color:var(--orange2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
104
- .note-head time { margin-left:auto; font-size:9px; color:var(--muted); }
105
- .note-head .nx { border:none; background:transparent; color:var(--muted); cursor:pointer; font-size:11px; }
106
- .note-head .nx:hover { color:#ff8080; }
107
- .note textarea { width:100%; background:transparent; border:none; outline:none; resize:none; color:var(--text);
108
- font:12px/1.6 Inter,Segoe UI,system-ui,sans-serif; padding:6px 9px 9px; min-height:64px; }
109
- .note textarea::placeholder { color:#5b5f6c; }
110
- /* Studio notebook */
111
- .notebook { width:248px; background:var(--panel); border-left:1px solid var(--border); display:flex;
112
- flex-direction:column; flex-shrink:0; min-height:0; }
113
- .notebook.hide { display:none; }
114
- .nb-head { padding:11px 12px 8px; border-bottom:1px solid var(--border); }
115
- .nb-head .t { font-size:10px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
116
- .nb-head .t span { color:var(--orange2); }
117
- .nb-head .s { font-size:10px; color:var(--muted); margin-top:3px; }
118
- #nbText { flex:1; background:#121319; color:var(--text); border:none; outline:none; resize:none;
119
- font:12px/1.7 ui-monospace,Consolas,monospace; padding:12px; }
120
- #nbText[readonly] { opacity:.55; }
121
- .nb-foot { display:flex; align-items:center; gap:6px; padding:8px 10px; border-top:1px solid var(--border); font-size:10px; color:var(--muted); }
122
  .mini-btn { font-size:10px; font-weight:700; border:1px solid var(--border); background:#121319; color:var(--text);
123
- padding:4px 9px; border-radius:7px; cursor:pointer; white-space:nowrap; }
124
  .mini-btn:hover { border-color:var(--orange); color:var(--orange2); }
125
  .mini-btn.acc { background:var(--orange); border-color:var(--orange); color:#111; }
126
- .status { height:30px; background:var(--panel); border-top:1px solid var(--border); display:flex;
127
- align-items:center; gap:14px; padding:0 14px; font-size:11px; color:var(--muted); flex-shrink:0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  .status b { color:var(--text); }
129
  .live { width:8px; height:8px; border-radius:50%; background:#38e06c; box-shadow:0 0 7px #38e06c; display:inline-block; margin-right:6px; }
130
- body.locked .live { background:var(--orange); box-shadow:0 0 7px var(--orange); }
131
  </style>
132
  </head>
133
- <body class="locked">
134
 
135
  <div class="topbar">
136
  <div class="logo">M</div>
137
- <div class="title">Mala-Motion <span>Portfolio</span></div>
138
- <div class="pill" id="modePill"><b>πŸ”’ visitor</b> &nbsp;Β·&nbsp; view-only</div>
139
  <div class="spacer"></div>
140
- <button class="btn" id="nbToggle" title="toggle studio notebook">πŸ““ notebook</button>
141
- <button class="btn locked" id="lockBtn" title="toggle studio edit mode">πŸ”’ visitor</button>
142
  </div>
143
 
144
  <div class="main">
 
145
  <div class="sidebar">
146
- <h3>Pipeline</h3>
147
- <div class="rail"><span class="st"><span class="dot"></span>anidoodle</span><span class="ln"></span><span class="st"><span class="dot"></span>webgl</span><span class="ln"></span><span class="st"><span class="dot"></span>lottie</span></div>
148
- <h3>Media Β· public\assets\</h3>
149
- <div id="assetTree"><div class="side-note">reading manifest…</div></div>
150
- <div class="side-note studio-only">studio: β€œplace” drops the file onto the canvas center.</div>
151
- <h3>Visit</h3>
152
- <div class="side-note">Double-click empty canvas to leave a sticky note. Notes auto-pin to the nearest artwork.</div>
 
 
 
 
 
 
 
 
 
153
  </div>
154
 
155
- <div class="viewport" id="viewport">
 
156
  <canvas id="fogGL"></canvas>
157
- <div id="grid"></div>
158
- <svg id="links"></svg>
159
- <div id="world"></div>
160
- <div class="hint" id="hint">drag to pan Β· scroll to zoom Β· double-click for a sticky note</div>
161
- <div id="toast"></div>
162
- <button class="notecta" id="noteCta" title="drop a sticky note at the center of your view">
163
- <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
164
- <path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/>
165
- </svg>
166
- <span>✍️ Leave a note on my workspace</span><small>(Double-click canvas to drop a note)</small>
167
- </button>
168
- <div class="zoomctl">
169
- <button id="zin" title="zoom in">+</button><span id="zoomLbl">100%</span><button id="zout" title="zoom out">βˆ’</button><button id="zreset" title="reset view">β€Ύ</button>
 
 
 
 
 
 
170
  </div>
171
- </div>
172
 
173
- <aside class="notebook" id="notebook">
174
- <div class="nb-head"><div class="t">Studio <span>notebook</span></div><div class="s" id="nbState">production logs Β· design briefs</div></div>
175
- <textarea id="nbText" placeholder="pin production logs or design briefs here…"></textarea>
176
- <div class="nb-foot"><span id="nbCount">0 words</span><span style="flex:1"></span>
177
- <button class="mini-btn studio-only" id="nbExport">export .md</button>
178
- <button class="mini-btn acc studio-only" id="nbSave">save</button>
 
 
 
 
179
  </div>
180
- </aside>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  </div>
182
 
183
  <div class="status">
184
- <span><span class="live"></span><b id="stMode">visitor Β· locked</b></span>
185
- <span id="stCounts">0 artworks Β· 0 notes</span>
186
- <span style="margin-left:auto">Mala-Motion Suite Β· public portfolio Β· :8080</span>
187
  </div>
188
 
189
  <script>
190
- 'use strict';
191
- /* ---------- state ---------- */
192
- const vp = document.getElementById('viewport'), world = document.getElementById('world'),
193
- grid = document.getElementById('grid'), links = document.getElementById('links'),
194
- hint = document.getElementById('hint'), toast = document.getElementById('toast'),
195
- zoomLbl = document.getElementById('zoomLbl');
196
- const cam = { x: 0, y: 0, k: 1 };
197
- let locked = localStorage.getItem('mala-mode') !== 'studio';
198
- const tiles = [], notes = [];
199
- let toastT = null;
200
- function say(m){ toast.textContent = m; toast.style.opacity = 1; clearTimeout(toastT); toastT = setTimeout(()=>toast.style.opacity=0, 1800); }
201
-
202
- /* ---------- camera: pan + zoom ---------- */
203
- function applyCam(){
204
- const r = vp.getBoundingClientRect();
205
- const ox = r.width/2 - cam.x*cam.k, oy = r.height/2 - cam.y*cam.k;
206
- world.style.transform = `translate(${ox}px,${oy}px) scale(${cam.k})`;
207
- const g = 26*cam.k;
208
- grid.style.backgroundSize = `${g}px ${g}px`;
209
- grid.style.backgroundPosition = `${ox % g}px ${oy % g}px`;
210
- zoomLbl.textContent = Math.round(cam.k*100) + '%';
211
- renderLinks();
212
- }
213
- function toWorld(cx, cy){ const r = vp.getBoundingClientRect();
214
- return { x: (cx - r.left - r.width/2)/cam.k + cam.x, y: (cy - r.top - r.height/2)/cam.k + cam.y }; }
215
- function toScreen(wx, wy){ const r = vp.getBoundingClientRect();
216
- return { x: (wx - cam.x)*cam.k + r.width/2, y: (wy - cam.y)*cam.k + r.height/2 }; }
217
- function sizeLinks(){ const r = vp.getBoundingClientRect();
218
- links.setAttribute('viewBox', `0 0 ${r.width} ${r.height}`); }
219
- window.addEventListener('resize', ()=>{ sizeLinks(); applyCam(); sizeFog(); });
220
-
221
- let pan = null;
222
- vp.addEventListener('pointerdown', e => {
223
- if (e.target.closest('.tile,.note,button,textarea,input,.zoomctl,.hint')) return;
224
- pan = { sx: e.clientX, sy: e.clientY, cx: cam.x, cy: cam.y, moved: 0 };
225
- vp.setPointerCapture(e.pointerId); vp.classList.add('panning');
226
- });
227
- vp.addEventListener('pointermove', e => {
228
- if (!pan) return;
229
- const dx = e.clientX - pan.sx, dy = e.clientY - pan.sy;
230
- pan.moved = Math.max(pan.moved, Math.abs(dx) + Math.abs(dy));
231
- cam.x = pan.cx - dx/cam.k; cam.y = pan.cy - dy/cam.k; applyCam();
232
- });
233
- vp.addEventListener('pointerup', ()=>{ pan = null; vp.classList.remove('panning'); });
234
- vp.addEventListener('wheel', e => {
235
- e.preventDefault();
236
- const r = vp.getBoundingClientRect();
237
- const k2 = Math.min(2.5, Math.max(0.3, cam.k * Math.exp(-e.deltaY * 0.0015)));
238
- const wx = (e.clientX - r.left - r.width/2)/cam.k + cam.x;
239
- const wy = (e.clientY - r.top - r.height/2)/cam.k + cam.y;
240
- cam.x = wx - (e.clientX - r.left - r.width/2)/k2;
241
- cam.y = wy - (e.clientY - r.top - r.height/2)/k2;
242
- cam.k = k2; applyCam();
243
- }, { passive: false });
244
- document.getElementById('zin').onclick = ()=>{ cam.k = Math.min(2.5, cam.k*1.2); applyCam(); };
245
- document.getElementById('zout').onclick = ()=>{ cam.k = Math.max(0.3, cam.k/1.2); applyCam(); };
246
- document.getElementById('zreset').onclick = ()=>{ cam.x = 0; cam.y = 0; cam.k = 1; applyCam(); };
247
- /* Floating CTA: one click drops a note at view center (same as double-click) */
248
- document.getElementById('noteCta').onclick = () => {
249
- const r = vp.getBoundingClientRect();
250
- const p = toWorld(r.left + r.width/2, r.top + r.height/2);
251
- addNote(p.x - 98, p.y - 20, '', true);
252
- say('πŸ“ note dropped β€” type, then double-click anywhere for more');
253
- };
254
 
255
- /* ---------- media tiles (slim frames) ---------- */
256
- function addTile(src, name, w){
257
- const id = 't' + Date.now() + Math.floor(Math.random()*999);
258
- const el = document.createElement('div');
259
- el.className = 'tile'; el.style.width = (w || 420) + 'px';
260
- el.style.left = (-210 + tiles.length*40) + 'px'; el.style.top = (-160 + tiles.length*30) + 'px';
261
- el.innerHTML = `<img src="${src}" alt="" draggable="false" />
262
- <div class="cap"><span class="dot"></span><b>${name}</b><button class="x" title="remove">Γ—</button></div>`;
263
- world.appendChild(el);
264
- const t = { id, el, x: parseFloat(el.style.left), y: parseFloat(el.style.top), w: w || 420, h: 220, src, name };
265
- el.querySelector('img').addEventListener('load', ev => {
266
- const im = ev.target; t.h = (w || 420) * im.naturalHeight / Math.max(1, im.naturalWidth) + 34;
267
- renderLinks(); counts();
268
- });
269
- el.querySelector('.x').onclick = e => { e.stopPropagation(); removeTile(id); };
270
- el.addEventListener('pointerdown', e => {
271
- if (e.target.closest('button')) return;
272
- if (locked) { say('πŸ”’ visitor mode β€” artwork is locked'); return; }
273
- e.stopPropagation();
274
- const sx = e.clientX, sy = e.clientY, ox = t.x, oy = t.y;
275
- const mv = ev => { t.x = ox + (ev.clientX - sx)/cam.k; t.y = oy + (ev.clientY - sy)/cam.k;
276
- el.style.left = t.x + 'px'; el.style.top = t.y + 'px'; renderLinks(); };
277
- const up = () => { window.removeEventListener('pointermove', mv); window.removeEventListener('pointerup', up); };
278
- window.addEventListener('pointermove', mv); window.addEventListener('pointerup', up);
279
- });
280
- tiles.push(t); renderLinks(); counts(); return t;
281
- }
282
- function removeTile(id){
283
- if (locked) { say('πŸ”’ visitor mode β€” artwork is locked'); return; }
284
- const i = tiles.findIndex(t => t.id === id);
285
- if (i > -1) { tiles[i].el.remove(); tiles.splice(i, 1); renderLinks(); counts(); }
286
- }
287
- function addTextTile(){
288
- const el = document.createElement('div');
289
- el.className = 'tile textile'; el.style.left = '-560px'; el.style.top = '-140px';
290
- el.innerHTML = `<h2>Watercolor <em>bus studies</em> β€” reel ’26</h2>
291
- <p>Frame-by-frame anidoodle rigs β†’ WebGL preview β†’ Lottie export. Drag to pan, scroll to zoom, double-click anywhere to sign the wall.</p>`;
292
- world.appendChild(el);
293
- tiles.push({ id: 'text0', el, x: -560, y: -140, w: 340, h: 190, text: true });
294
- }
295
-
296
- /* ---------- sticky notes + connector pins ---------- */
297
- vp.addEventListener('dblclick', e => {
298
- if (e.target.closest('.tile,.note,button,textarea,input,.zoomctl,.sidebar,.notebook')) return;
299
- const p = toWorld(e.clientX, e.clientY);
300
- addNote(p.x - 98, p.y - 20, '', true);
301
- });
302
- function addNote(x, y, text, focus){
303
- const id = 'n' + Date.now() + Math.floor(Math.random()*999);
304
- const el = document.createElement('div');
305
- el.className = 'note'; el.style.left = x + 'px'; el.style.top = y + 'px';
306
- const now = new Date();
307
- el.innerHTML = `<div class="note-head"><span class="dot"></span><span class="who">guest</span>
308
- <time>${String(now.getHours()).padStart(2,'0')}:${String(now.getMinutes()).padStart(2,'0')}</time>
309
- <button class="nx" title="remove note">Γ—</button></div>
310
- <textarea placeholder="leave feedback or sign here…" rows="3"></textarea>`;
311
- const ta = el.querySelector('textarea');
312
- ta.value = text || '';
313
- ta.spellcheck = false;
314
- world.appendChild(el);
315
- const n = { id, el, ta, x, y };
316
- el.querySelector('.nx').onclick = e => { e.stopPropagation();
317
- el.remove(); notes.splice(notes.indexOf(n), 1); renderLinks(); counts(); };
318
- el.querySelector('.note-head').addEventListener('pointerdown', e => {
319
- if (e.target.closest('button')) return;
320
- e.stopPropagation();
321
- const sx = e.clientX, sy = e.clientY, ox = n.x, oy = n.y;
322
- const mv = ev => { n.x = ox + (ev.clientX - sx)/cam.k; n.y = oy + (ev.clientY - sy)/cam.k;
323
- el.style.left = n.x + 'px'; el.style.top = n.y + 'px'; renderLinks(); };
324
- const up = () => { window.removeEventListener('pointermove', mv); window.removeEventListener('pointerup', up); };
325
- window.addEventListener('pointermove', mv); window.addEventListener('pointerup', up);
326
- });
327
- ta.addEventListener('input', () => { ta.style.height = 'auto'; ta.style.height = ta.scrollHeight + 'px'; });
328
- notes.push(n); renderLinks(); counts();
329
- if (focus) { const who = el.querySelector('.who'); who.textContent = 'guest Β· ' + (notes.length); ta.focus(); }
330
- return n;
331
- }
332
- function nearestTile(nx, ny){
333
- let best = null, bd = 1e12;
334
- for (const t of tiles) {
335
- const cx = Math.min(Math.max(nx, t.x), t.x + t.w);
336
- const cy = Math.min(Math.max(ny, t.y), t.y + t.h);
337
- const d = (nx - cx)**2 + (ny - cy)**2;
338
- if (d < bd) { bd = d; best = { t, cx, cy }; }
339
  }
340
- return best;
341
- }
342
- function renderLinks(){
343
- if (!links.clientWidth) sizeLinks();
344
- let s = '';
345
- for (const n of notes) {
346
- const a = toScreen(n.x + 98, n.y + 4);
347
- const hit = nearestTile(n.x + 98, n.y);
348
- if (!hit) continue;
349
- const b = toScreen(hit.cx, hit.cy);
350
- const mx = (a.x + b.x)/2;
351
- s += `<path d="M ${a.x.toFixed(1)} ${a.y.toFixed(1)} C ${mx.toFixed(1)} ${a.y.toFixed(1)}, ${mx.toFixed(1)} ${b.y.toFixed(1)}, ${b.x.toFixed(1)} ${b.y.toFixed(1)}"/>`
352
- + `<circle cx="${a.x.toFixed(1)}" cy="${a.y.toFixed(1)}" r="3.2"/><circle cx="${b.x.toFixed(1)}" cy="${b.y.toFixed(1)}" r="3.2"/>`;
353
  }
354
- links.innerHTML = s;
355
- }
356
- function counts(){
357
- document.getElementById('stCounts').textContent = `${tiles.length} artwork${tiles.length===1?'':'s'} Β· ${notes.length} note${notes.length===1?'':'s'}`;
358
- }
 
 
 
 
 
 
 
 
 
359
 
360
- /* ---------- lock: visitor vs studio ---------- */
361
- const lockBtn = document.getElementById('lockBtn'), modePill = document.getElementById('modePill'),
362
- nbText = document.getElementById('nbText');
363
- function setLocked(v){
364
- locked = v;
365
- document.body.classList.toggle('locked', v);
366
- localStorage.setItem('mala-mode', v ? 'visitor' : 'studio');
367
- lockBtn.textContent = v ? 'πŸ”’ visitor' : 'πŸ”“ studio';
368
- lockBtn.classList.toggle('locked', v);
369
- modePill.innerHTML = v ? '<b>πŸ”’ visitor</b> &nbsp;Β·&nbsp; view-only' : '<b>πŸ”“ studio</b> &nbsp;Β·&nbsp; editing on';
370
- document.getElementById('stMode').textContent = v ? 'visitor Β· locked' : 'studio Β· unlocked';
371
- nbText.readOnly = v;
372
- document.getElementById('nbState').textContent = v ? 'studio only β€” unlock to edit' : 'production logs Β· design briefs';
373
- hint.textContent = v ? 'drag to pan Β· scroll to zoom Β· double-click for a sticky note'
374
- : 'studio mode β€” drag artworks to arrange Β· double-click for notes';
375
- }
376
- lockBtn.onclick = ()=> setLocked(!locked);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
 
378
- /* ---------- asset browser (manifest-driven, G: only) ---------- */
379
- const tree = document.getElementById('assetTree');
380
- const fmt = n => n > 1048576 ? (n/1048576).toFixed(1)+' MB' : Math.max(1, Math.round(n/1024))+' KB';
381
- fetch('assets/manifest.json', { cache: 'no-store' }).then(r => r.json()).then(j => {
382
- tree.innerHTML = '';
383
- (j.files || []).forEach(f => {
384
- if (!/\.(png|jpe?g|gif|webp|svg)$/i.test(f.name)) return;
385
- const src = 'assets/' + f.name;
386
- const row = document.createElement('div');
387
- row.className = 'afile';
388
- row.innerHTML = `<img loading="lazy" src="${src}" alt="" /><div><div class="nm">${f.name}</div><div class="sz">${fmt(f.size||0)}</div></div><button class="studio-only">place</button>`;
389
- const btn = row.querySelector('button');
390
- if (btn) btn.onclick = () => {
391
- addTile(src, f.name, 420);
392
- const t = tiles[tiles.length-1];
393
- t.x = cam.x - 210; t.y = cam.y - 120;
394
- t.el.style.left = t.x+'px'; t.el.style.top = t.y+'px'; renderLinks();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  };
396
- row.ondblclick = () => { if (!locked && btn) btn.onclick(); };
397
- tree.appendChild(row);
398
- });
399
- if (!tree.children.length) tree.innerHTML = '<div class="side-note">no images in manifest.</div>';
400
- }).catch(()=>{ tree.innerHTML = '<div class="side-note">manifest unavailable β€” serve via Start_Suite.bat.</div>'; });
401
-
402
- /* ---------- studio notebook ---------- */
403
- const nbCount = document.getElementById('nbCount');
404
- function nbWords(){ const w = nbText.value.trim().split(/\s+/).filter(Boolean).length;
405
- nbCount.textContent = (nbText.value.trim()? w : 0) + ' words'; }
406
- nbText.addEventListener('input', nbWords);
407
- fetch('studio-notes.md', { cache: 'no-store' }).then(r => { if(!r.ok) throw 0; return r.text(); }).then(t => {
408
- nbText.value = localStorage.getItem('mala-notes') || t; nbWords();
409
- }).catch(()=>{ nbText.value = localStorage.getItem('mala-notes') || '# Mala-Motion β€” production log\n\n- '; nbWords(); });
410
- document.getElementById('nbSave').onclick = () => {
411
- localStorage.setItem('mala-notes', nbText.value); say('πŸ““ notebook saved locally'); };
412
- document.getElementById('nbExport').onclick = () => {
413
- const a = document.createElement('a');
414
- a.href = URL.createObjectURL(new Blob([nbText.value], { type: 'text/markdown' }));
415
- a.download = 'mala-notes.md'; a.click(); setTimeout(()=>URL.revokeObjectURL(a.href), 2000); };
416
- document.getElementById('nbToggle').onclick = () =>
417
- document.getElementById('notebook').classList.toggle('hide');
418
 
419
- /* ---------- orange fog backdrop (screen-space WebGL) ---------- */
420
- let fogSize = null;
421
- (function(){
422
- const cv = document.getElementById('fogGL');
423
- let gl = null;
424
- try { gl = cv.getContext('webgl', { antialias:false, alpha:false }) || cv.getContext('experimental-webgl'); } catch(e){}
425
- if (!gl) { cv.style.display = 'none'; return; }
426
- const VS = 'attribute vec2 p;void main(){gl_Position=vec4(p,0.,1.);}';
427
- const FS = `precision mediump float;
428
- uniform vec2 u_res; uniform float u_time; uniform vec2 u_mouse;
429
- float hash(vec2 p){ return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453); }
430
- float noise(vec2 p){ vec2 i=floor(p),f=fract(p); f=f*f*(3.-2.*f);
431
- return mix(mix(hash(i),hash(i+vec2(1,0)),f.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y); }
432
- float fbm(vec2 p){ float v=0.,a=.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.03; a*=.5; } return v; }
433
- void main(){
434
- vec2 uv = gl_FragCoord.xy/u_res;
435
- vec2 asp = vec2(u_res.x/u_res.y,1.0);
436
- vec2 p = (uv-.5)*asp, m = (u_mouse-.5)*asp;
437
- float md = length(p-m);
438
- float t = u_time;
439
- vec2 pull = (m-p)*exp(-md*3.0)*0.9;
440
- vec2 q = p*1.4 + pull + vec2(t*.05,t*.03);
441
- float n = fbm(q + fbm(q + t*.04));
442
- float fog = smoothstep(.32,.92,n)*.5;
443
- float glow = exp(-md*4.0)*.5;
444
- vec3 base = vec3(.043,.047,.059);
445
- vec3 col = mix(base, mix(vec3(1.,.42,.1),vec3(1.,.63,.37),n), fog*.85);
446
- col += vec3(1.,.63,.37)*glow*(.25+fog);
447
- col *= 1.-.35*length(uv-.5);
448
- gl_FragColor = vec4(col,1.);
449
- }`;
450
- function sh(type, src){ const s = gl.createShader(type); gl.shaderSource(s,src); gl.compileShader(s);
451
- return gl.getShaderParameter(s, gl.COMPILE_STATUS) ? s : null; }
452
- const vs = sh(gl.VERTEX_SHADER, VS), fs = sh(gl.FRAGMENT_SHADER, FS);
453
- if (!vs || !fs) { cv.style.display = 'none'; return; }
454
- const pr = gl.createProgram();
455
- gl.attachShader(pr,vs); gl.attachShader(pr,fs); gl.linkProgram(pr);
456
- if (!gl.getProgramParameter(pr, gl.LINK_STATUS)) { cv.style.display = 'none'; return; }
457
- gl.useProgram(pr);
458
- gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
459
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1,-1,3,-1,-1,3]), gl.STATIC_DRAW);
460
- const loc = gl.getAttribLocation(pr,'p');
461
- gl.enableVertexAttribArray(loc); gl.vertexAttribPointer(loc,2,gl.FLOAT,false,0,0);
462
- const U = n => gl.getUniformLocation(pr,n);
463
- const uRes = U('u_res'), uTime = U('u_time'), uMouse = U('u_mouse');
464
- let mx = .5, my = .5, tmx = .5, tmy = .5;
465
- vp.addEventListener('mousemove', e => { const r = vp.getBoundingClientRect();
466
- tmx = (e.clientX-r.left)/r.width; tmy = 1-(e.clientY-r.top)/r.height; });
467
- fogSize = function(){
468
- const dpr = Math.min(window.devicePixelRatio||1, 1.25);
469
- const w = Math.max(1, Math.floor(vp.clientWidth*dpr)), h = Math.max(1, Math.floor(vp.clientHeight*dpr));
470
- if (cv.width!==w || cv.height!==h){ cv.width=w; cv.height=h; gl.viewport(0,0,w,h); }
471
- };
472
- fogSize();
473
- const t0 = performance.now();
474
- (function frame(){ requestAnimationFrame(frame);
475
- if (document.hidden) return;
476
- fogSize(); mx += (tmx-mx)*.06; my += (tmy-my)*.06;
477
- gl.uniform2f(uRes,cv.width,cv.height); gl.uniform1f(uTime,(performance.now()-t0)/1000);
478
- gl.uniform2f(uMouse,mx,my); gl.drawArrays(gl.TRIANGLES,0,3);
479
  })();
480
- })();
481
- function sizeFog(){ if (fogSize) fogSize(); }
482
 
483
- /* ---------- boot ---------- */
484
- addTextTile();
485
- addTile('assets/watercolor_bus.png', 'watercolor_bus.png', 460);
486
- setLocked(locked);
487
- sizeLinks(); applyCam(); counts();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  </script>
489
  </body>
490
  </html>
 
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Mala-Motion Suite β€” Node Workspace</title>
7
  <style>
8
+ * { box-sizing: border-box; margin: 0; padding: 0; }
9
  :root {
10
+ --bg: #0f1013;
11
+ --panel: #17181d;
12
+ --panel2: #1e2027;
13
+ --border: #2a2d36;
14
+ --text: #e8e9ec;
15
+ --muted: #8b8f9c;
16
+ --orange: #ff6b1a;
17
+ --orange2: #ffa25e;
18
+ --orange-dim: rgba(255,107,26,.14);
19
  }
20
+ body {
21
+ font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
22
+ background: var(--bg); color: var(--text);
23
+ height: 100vh; display: flex; flex-direction: column; overflow: hidden;
24
+ }
25
+ /* Top bar */
26
+ .topbar {
27
+ height: 48px; background: var(--panel); border-bottom: 1px solid var(--border);
28
+ display: flex; align-items: center; gap: 12px; padding: 0 14px; flex-shrink: 0;
29
+ }
30
+ .logo { width: 26px; height: 26px; border-radius: 7px;
31
+ background: linear-gradient(135deg, var(--orange), #ff2e63);
32
+ display:grid; place-items:center; font-weight:800; font-size:14px; color:#fff;
33
+ }
34
+ .title { font-weight: 650; font-size: 14px; letter-spacing:.2px; }
35
+ .title span { color: var(--orange2); }
36
+ .pill { font-size:11px; color:var(--muted); border:1px solid var(--border);
37
+ padding:4px 9px; border-radius:999px; background:#121319; }
38
+ .pill b { color:#7CFF6B; font-weight:700; }
39
  .spacer { flex:1; }
40
+ .btn { font-size:12px; border:1px solid var(--border); background:var(--panel2);
41
+ color:var(--text); padding:7px 12px; border-radius:8px; cursor:pointer; }
42
+ .btn.primary { background:var(--orange); border-color:var(--orange); color:#111; font-weight:700; }
43
+ .btn:hover { filter:brightness(1.1); }
44
+
45
+ /* Layout */
46
  .main { flex:1; display:flex; min-height:0; }
47
+ .sidebar { width:220px; background:var(--panel); border-right:1px solid var(--border);
48
+ padding:12px; display:flex; flex-direction:column; gap:10px; flex-shrink:0; }
49
+ .sidebar h3, .inspector h3 { font-size:11px; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); margin:4px 2px 6px; }
50
+ .asset { background:var(--panel2); border:1px solid var(--border); border-radius:10px;
51
+ padding:10px 11px; cursor:grab; transition:.15s; }
52
+ .asset:hover { border-color:var(--orange); background:var(--orange-dim); }
53
+ .asset .k { font-size:12px; font-weight:650; display:flex; align-items:center; gap:8px; }
54
+ .dot { width:9px; height:9px; border-radius:50%; background:var(--orange); box-shadow:0 0 8px var(--orange); flex-shrink:0; }
55
+ .asset small { color:var(--muted); font-size:11px; display:block; margin-top:4px; line-height:1.4; }
56
+ .asset .tag { display:inline-block; margin-top:7px; font-size:10px; padding:2px 7px; border-radius:999px;
57
+ background:#121319; border:1px solid var(--border); color:var(--orange2); }
58
+
59
+ /* Canvas */
60
+ .canvas-wrap { flex:1; position:relative; overflow:hidden;
61
+ background:
62
+ radial-gradient(circle, #2b2e38 1px, transparent 1px);
63
+ background-size:22px 22px; background-color:#0b0c0f;
64
+ }
65
+ .canvas-hint { position:absolute; top:12px; left:50%; transform:translateX(-50%);
66
+ font-size:11px; color:var(--muted); background:rgba(23,24,29,.9);
67
+ border:1px solid var(--border); padding:6px 12px; border-radius:999px; pointer-events:none; }
68
+ svg.wires { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:1; }
69
+ svg.wires path { stroke: var(--orange); stroke-width:2; fill:none; opacity:.9; filter: drop-shadow(0 0 4px rgba(255,107,26,.6)); }
70
+ svg.wires path.ghost { stroke:#3a3e4b; opacity:.9; filter:none; }
71
+ /* Fluid orange fog layer (WebGL) β€” sits over the grid, under nodes */
72
+ #fogGL { position:absolute; inset:0; width:100%; height:100%; z-index:0; display:block; pointer-events:none; }
73
+ .canvas-hint { z-index:4; }
74
+ .node { z-index:2; }
75
+ .mood { z-index:3; }
76
+ .fog-controls { display:flex; gap:6px; }
77
+ .fog-controls button { flex:1; font-size:11px; font-weight:700; border:1px solid var(--orange);
78
+ background:var(--orange-dim); color:var(--orange2); padding:6px 0; border-radius:7px; cursor:pointer; }
79
+ .fog-controls button:hover { background:var(--orange); color:#111; }
80
+ .fog-controls button.off { border-color:var(--border); background:#121319; color:var(--muted); }
81
+ .fog-lab { font-size:10px; color:var(--muted); display:flex; align-items:center; gap:8px; }
82
+ .fog-lab input { flex:1; accent-color:var(--orange); }
83
+
84
+ .node {
85
+ position:absolute; width:230px; background:var(--panel2);
86
+ border:1px solid var(--border); border-radius:12px; overflow:hidden;
87
+ box-shadow:0 10px 30px rgba(0,0,0,.5); user-select:none;
88
+ }
89
+ .node.selected { border-color:var(--orange); box-shadow:0 0 0 1px var(--orange), 0 10px 30px rgba(0,0,0,.5); }
90
+ .node-head { padding:9px 12px; font-size:12px; font-weight:700; display:flex; align-items:center; gap:8px;
91
+ background:#23252e; border-bottom:1px solid var(--border); cursor:grab; }
92
+ .node-head .type { margin-left:auto; font-size:10px; font-weight:700; color:#111;
93
+ background:var(--orange2); padding:2px 7px; border-radius:999px; }
94
+ .node-body { padding:10px 12px 12px; display:flex; flex-direction:column; gap:8px; }
95
+ .row { display:flex; align-items:center; gap:8px; font-size:12px; color:#cfd2da; }
96
+ .row .port { width:12px; height:12px; border-radius:50%; background:var(--orange);
97
+ border:2px solid #0b0c0f; outline:2px solid var(--orange); flex-shrink:0; }
98
+ .row.in { justify-content:flex-start; } .row.out { justify-content:flex-end; }
99
+ .row .val { margin-left:auto; font-size:11px; color:var(--muted); background:#121319;
100
+ border:1px solid var(--border); padding:2px 7px; border-radius:6px; }
101
+ .row.out .val { margin-left:0; margin-right:auto; }
102
+ .bar { height:6px; background:#121319; border-radius:999px; overflow:hidden; border:1px solid var(--border); }
103
+ .bar i { display:block; height:100%; width:68%; background:linear-gradient(90deg, var(--orange), var(--orange2)); }
104
+ .node-foot { padding:8px 12px; border-top:1px solid var(--border); font-size:11px; color:var(--muted); display:flex; justify-content:space-between; }
105
+ .node-foot b { color:var(--orange2); }
106
+ /* Anidoodle live preview */
107
+ .bus-preview { border-radius:9px; overflow:hidden; border:1px solid var(--border); background:#0b0c0f; position:relative; }
108
+ .bus-preview img { width:100%; height:110px; object-fit:cover; display:block; transition:transform .25s ease; }
109
+ .bus-preview.playing img { animation: busFloat 2.2s ease-in-out infinite; }
110
+ @keyframes busFloat { 0%,100% { transform:translateY(0) rotate(0deg);} 50% { transform:translateY(-4px) rotate(-.4deg);} }
111
+ .bus-preview:hover img { transform:scale(1.04); }
112
+ .bus-preview.playing:hover img { animation-play-state:paused; transform:scale(1.04); }
113
+ .bus-meta { display:flex; align-items:center; gap:6px; font-size:10px; color:var(--muted); margin-top:6px; }
114
+ .bus-meta b { color:var(--orange2); }
115
+ .bus-controls { display:flex; gap:6px; margin-top:8px; }
116
+ .bus-controls button { flex:1; font-size:11px; font-weight:700; border:1px solid var(--orange);
117
+ background:var(--orange-dim); color:var(--orange2); padding:6px 0; border-radius:7px; cursor:pointer; }
118
+ .bus-controls button:hover { background:var(--orange); color:#111; }
119
+ .bus-controls input[type=range] { flex:1.4; accent-color:var(--orange); }
120
+ /* Local Asset Browser (folder tree) */
121
+ .tree-head { display:flex; align-items:center; gap:8px; margin:6px 2px; }
122
+ .tree-head code { font-size:10px; color:var(--orange2); background:#121319; border:1px solid var(--border);
123
+ padding:3px 7px; border-radius:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  .mini-btn { font-size:10px; font-weight:700; border:1px solid var(--border); background:#121319; color:var(--text);
125
+ padding:4px 8px; border-radius:7px; cursor:pointer; white-space:nowrap; }
126
  .mini-btn:hover { border-color:var(--orange); color:var(--orange2); }
127
  .mini-btn.acc { background:var(--orange); border-color:var(--orange); color:#111; }
128
+ #assetTree { display:flex; flex-direction:column; gap:6px; max-height:260px; overflow:auto; padding-right:2px; }
129
+ .tree-folder { font-size:11px; color:var(--text); font-weight:700; display:flex; align-items:center; gap:6px;
130
+ padding:6px 8px; border:1px solid var(--border); border-radius:8px; background:#121319; }
131
+ .tree-folder .count { margin-left:auto; font-size:10px; color:var(--orange2); background:var(--orange-dim);
132
+ border:1px solid rgba(255,107,26,.35); padding:1px 7px; border-radius:999px; }
133
+ .tree-file { display:flex; align-items:center; gap:8px; padding:6px; border:1px solid var(--border);
134
+ border-radius:8px; background:var(--panel2); cursor:grab; transition:.12s; }
135
+ .tree-file:hover { border-color:var(--orange); }
136
+ .tree-file img.th { width:34px; height:34px; object-fit:cover; border-radius:6px; border:1px solid var(--border); flex-shrink:0; }
137
+ .tree-file .nm { font-size:11px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
138
+ .tree-file .sz { font-size:10px; color:var(--muted); }
139
+ .tree-file .acts { margin-left:auto; display:flex; gap:4px; }
140
+ .tree-empty, .tree-err { font-size:11px; color:var(--muted); border:1px dashed var(--border); border-radius:8px;
141
+ padding:9px; text-align:center; line-height:1.5; }
142
+ /* Editorial Moodboard dock */
143
+ .mood { position:absolute; left:12px; right:12px; bottom:12px; background:rgba(23,24,29,.96);
144
+ border:1px solid var(--border); border-radius:12px; overflow:hidden; backdrop-filter:blur(6px); }
145
+ .mood-head { display:flex; align-items:center; gap:8px; padding:8px 12px; border-bottom:1px solid var(--border); }
146
+ .mood-head .t { font-size:11px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }
147
+ .mood-head .t span { color:var(--orange2); }
148
+ .mood-head .sub { font-size:10px; color:var(--muted); }
149
+ .mood-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(118px, 1fr)); gap:8px;
150
+ padding:10px 12px 12px; max-height:172px; overflow:auto; }
151
+ .mood-grid.dense { grid-template-columns:repeat(auto-fill, minmax(88px, 1fr)); }
152
+ .mood-grid.drover { outline:1px dashed var(--orange); outline-offset:-6px; }
153
+ .tile { position:relative; border:1px solid var(--border); border-radius:9px; overflow:hidden;
154
+ background:#0b0c0f; cursor:grab; aspect-ratio:4/3; }
155
+ .tile img { width:100%; height:100%; object-fit:cover; display:block; }
156
+ .tile.pinned { border-color:var(--orange); box-shadow:0 0 0 1px var(--orange); }
157
+ .tile .pin { position:absolute; top:5px; right:5px; font-size:11px; line-height:1; background:rgba(0,0,0,.65);
158
+ border:1px solid var(--border); border-radius:999px; padding:3px 6px; cursor:pointer; color:#fff; }
159
+ .tile.pinned .pin { border-color:var(--orange); color:var(--orange2); }
160
+ .tile .cap { position:absolute; left:0; right:0; bottom:0; font-size:9px; padding:3px 6px;
161
+ background:linear-gradient(transparent, rgba(0,0,0,.75)); color:#dfe1e7; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
162
+ .tile .x { position:absolute; top:5px; left:5px; font-size:10px; background:rgba(0,0,0,.65); color:#fff;
163
+ border:1px solid var(--border); border-radius:999px; width:18px; height:18px; cursor:pointer; display:grid; place-items:center; }
164
+ .tile .x:hover { border-color:#ff4d4d; color:#ff8080; }
165
+ .mood-empty { grid-column:1/-1; font-size:11px; color:var(--muted); border:1px dashed var(--border);
166
+ border-radius:8px; padding:12px; text-align:center; }
167
+
168
+ /* Inspector */
169
+ .inspector { width:250px; background:var(--panel); border-left:1px solid var(--border); padding:12px; flex-shrink:0; overflow:auto; }
170
+ .field { margin-bottom:11px; }
171
+ .field label { font-size:11px; color:var(--muted); display:block; margin-bottom:5px; }
172
+ .field input, .field select { width:100%; background:#121319; border:1px solid var(--border);
173
+ color:var(--text); font-size:12px; padding:8px 9px; border-radius:8px; outline:none; }
174
+ .field input:focus, .field select:focus { border-color:var(--orange); }
175
+ .check { display:flex; align-items:center; gap:8px; font-size:12px; color:#cfd2da;
176
+ background:var(--orange-dim); border:1px solid rgba(255,107,26,.35); padding:8px 10px; border-radius:8px; }
177
+
178
+ /* Status bar */
179
+ .status { height:30px; background:var(--panel); border-top:1px solid var(--border);
180
+ display:flex; align-items:center; gap:14px; padding:0 14px; font-size:11px; color:var(--muted); flex-shrink:0; }
181
  .status b { color:var(--text); }
182
  .live { width:8px; height:8px; border-radius:50%; background:#38e06c; box-shadow:0 0 7px #38e06c; display:inline-block; margin-right:6px; }
 
183
  </style>
184
  </head>
185
+ <body>
186
 
187
  <div class="topbar">
188
  <div class="logo">M</div>
189
+ <div class="title">Mala-Motion <span>Suite</span></div>
190
+ <div class="pill"><b>●</b> &nbsp;local :8080 &nbsp;Β·&nbsp; anidoodle / WebGL / Lottie</div>
191
  <div class="spacer"></div>
192
+ <button class="btn" onclick="alert('Add node: drag an asset from the left library onto the canvas.')">+ Add Node</button>
193
+ <button class="btn primary" onclick="document.getElementById('exp').innerText='Export queued β€” lottie JSON + webgl bundle ready.'; ">β–Ά Run Graph</button>
194
  </div>
195
 
196
  <div class="main">
197
+ <!-- Left -->
198
  <div class="sidebar">
199
+ <h3>Asset Library</h3>
200
+ <div class="asset"><div class="k"><span class="dot"></span>Anidoodle Rig</div><small>2D frame-by-frame character rig (.ani)</small><span class="tag">anidoodle</span></div>
201
+ <div class="asset"><div class="k"><span class="dot"></span>WebGL Scene</div><small>Realtime preview Β· three.js renderer</small><span class="tag">webgl Β· shader</span></div>
202
+ <div class="asset"><div class="k"><span class="dot"></span>Lottie Export</div><small>Bodymovin JSON for web / mobile</small><span class="tag">lottie Β· json</span></div>
203
+ <div class="asset"><div class="k"><span class="dot"></span>Motion Curve</div><small>Ease Β· overshoot Β· bounce presets</small><span class="tag">utility</span></div>
204
+ <h3 style="margin-top:6px">Graph</h3>
205
+ <div class="pill" id="exp" style="line-height:1.5">3 nodes Β· 2 links Β· clean</div>
206
+ <h3 style="margin-top:8px">Project Assets</h3>
207
+ <div class="tree-head"><code title="local project assets dir">public\assets\</code><button class="mini-btn" id="assetRefresh" title="re-read manifest">↻</button></div>
208
+ <div id="assetTree"><div class="tree-empty">reading manifest…</div></div>
209
+ <div style="display:flex;gap:6px;margin-top:8px">
210
+ <button class="mini-btn acc" id="assetLinkBtn" style="flex:1" title="pick the public/assets folder for a live handle">⛁ link folder</button>
211
+ <button class="mini-btn" id="assetAddBtn" style="flex:1" title="drop files straight onto the moodboard">οΌ‹ drop files</button>
212
+ </div>
213
+ <input type="file" id="assetFilePick" accept="image/*" multiple hidden />
214
+ <div class="pill" id="assetStatus" style="line-height:1.5;margin-top:8px">browser idle</div>
215
  </div>
216
 
217
+ <!-- Canvas -->
218
+ <div class="canvas-wrap" id="canvas">
219
  <canvas id="fogGL"></canvas>
220
+ <div class="canvas-hint">drag nodes to rearrange Β· figma-style canvas Β· orange = live link</div>
221
+ <svg class="wires" id="wires" preserveAspectRatio="none"></svg>
222
+
223
+ <div class="node selected" id="n1" style="left:60px; top:60px; width:260px;">
224
+ <div class="node-head"><span class="dot"></span>Anidoodle Bus Rig<span class="type">ANI β€’ LIVE</span></div>
225
+ <div class="node-body">
226
+ <div class="bus-preview playing" id="busPreview">
227
+ <img id="busImg" src="public/assets/watercolor_bus.png" alt="watercolor bus" draggable="false" />
228
+ </div>
229
+ <div class="bus-meta"><span class="dot"></span><span id="busStatus">linking <b>public/assets/watercolor_bus.png</b>…</span></div>
230
+ <div class="bus-controls">
231
+ <button id="busPlay" title="play/pause idle motion">⏸ pause</button>
232
+ <input id="busSpeed" type="range" min="0.5" max="3" step="0.1" value="1" title="motion speed" />
233
+ </div>
234
+ <div class="row out">frames <span class="val">48f</span><span class="port"></span></div>
235
+ <div class="row out">rig <span class="val">watercolor_bus.png</span><span class="port"></span></div>
236
+ <div class="bar"><i id="busBar" style="width:82%"></i></div>
237
+ </div>
238
+ <div class="node-foot"><span>anidoodle</span><b id="busFoot">● ready</b></div>
239
  </div>
 
240
 
241
+ <div class="node" id="n2" style="left:360px; top:160px;">
242
+ <div class="node-head"><span class="dot"></span>WebGL Fog Node<span class="type">GL β€’ LIVE</span></div>
243
+ <div class="node-body">
244
+ <div class="row in"><span class="port"></span>rig-in <span class="val" id="fogLink">connected</span></div>
245
+ <div class="fog-controls"><button id="fogToggle" title="toggle fog layer">β—‰ fog on</button></div>
246
+ <label class="fog-lab">density<input id="fogDensity" type="range" min="0" max="100" value="55" title="fog density" /></label>
247
+ <label class="fog-lab">flow<input id="fogFlow" type="range" min="10" max="200" value="100" title="flow speed" /></label>
248
+ <div class="row out">preview <span class="val">60 fps</span><span class="port"></span></div>
249
+ </div>
250
+ <div class="node-foot"><span id="fogStat">webgl Β· fbm fog</span><b id="fogFoot">● live</b></div>
251
  </div>
252
+
253
+ <div class="node" id="n3" style="left:660px; top:70px;">
254
+ <div class="node-head"><span class="dot"></span>Lottie Export<span class="type">JSON</span></div>
255
+ <div class="node-body">
256
+ <div class="row in"><span class="port"></span>frames-in <span class="val">linked</span></div>
257
+ <div class="row in"><span class="port"></span>preview-in <span class="val">linked</span></div>
258
+ <div class="bar"><i style="width:45%"></i></div>
259
+ </div>
260
+ <div class="node-foot"><span>bodymovin</span><b>● idle</b></div>
261
+ </div>
262
+
263
+ <!-- Editorial Interactive Moodboard -->
264
+ <section class="mood" id="mood" aria-label="Editorial moodboard">
265
+ <div class="mood-head">
266
+ <span class="dot"></span><span class="t">Moodboard <span>β€” editorial</span></span>
267
+ <span class="sub" id="moodCount">0 pinned Β· 0 tiles</span>
268
+ <span style="flex:1"></span>
269
+ <button class="mini-btn" id="moodDensity" title="toggle grid density">β–¦ dense</button>
270
+ <button class="mini-btn" id="moodSend" title="send first tile to anidoodle node">β†’ ani</button>
271
+ <button class="mini-btn" id="moodClear" title="remove unpinned tiles">clear</button>
272
+ </div>
273
+ <div class="mood-grid" id="moodGrid"></div>
274
+ </section>
275
+
276
+ </div>
277
+
278
+ <!-- Right -->
279
+ <div class="inspector">
280
+ <h3>Inspector</h3>
281
+ <div class="field"><label>Selected node</label><input id="inspNode" value="Anidoodle Bus Rig β€” watercolor_bus" readonly /></div>
282
+ <div class="field"><label>Asset source (dynamic link)</label><input id="inspSrc" value="public/assets/watercolor_bus.png" readonly /></div>
283
+ <div class="field"><label>Renderer</label><select><option>WebGL β€” three.js</option><option>Canvas 2D fallback</option><option>SVG sequence</option></select></div>
284
+ <div class="field"><label>Export target</label><select><option>Lottie JSON (.json)</option><option>WebGL bundle (.js)</option><option>Anidoodle (.ani)</option></select></div>
285
+ <div class="field"><label>Frame rate</label><input value="60" /></div>
286
+ <div class="check">βœ” Drive-free local session β€” serves from :8080</div>
287
+ <p style="font-size:11px;color:var(--muted);line-height:1.6;margin-top:10px">Tip: press <b>Run Graph</b> to chain Anidoodle β†’ WebGL β†’ Lottie. Orange wires are live links.</p>
288
+ </div>
289
  </div>
290
 
291
  <div class="status">
292
+ <span><span class="live"></span><b>localhost:8080</b> serving index.html</span>
293
+ <span>GPU: browser WebGL</span>
294
+ <span style="margin-left:auto">Mala-Motion Suite Β· minimal build Β· dark + orange</span>
295
  </div>
296
 
297
  <script>
298
+ // Draw orange bezier wires between nodes + make nodes draggable
299
+ const canvas = document.getElementById('canvas');
300
+ const wires = document.getElementById('wires');
301
+ const links = [ ['n1','n2'], ['n2','n3'] ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
 
303
+ function center(el, side) {
304
+ const c = canvas.getBoundingClientRect(), r = el.getBoundingClientRect();
305
+ return { x: side === 'l' ? r.left - c.left : r.right - c.left, y: r.top - c.top + r.height/2 };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
+ function draw() {
308
+ const c = canvas.getBoundingClientRect();
309
+ wires.setAttribute('viewBox', `0 0 ${c.width} ${c.height}`);
310
+ wires.innerHTML = '';
311
+ links.forEach(([a,b]) => {
312
+ const A = document.getElementById(a), B = document.getElementById(b);
313
+ const p1 = { x: A.offsetLeft + A.offsetWidth, y: A.offsetTop + 90 };
314
+ const p2 = { x: B.offsetLeft, y: B.offsetTop + 60 };
315
+ const dx = Math.max(40, Math.abs(p2.x-p1.x)/2);
316
+ const d = `M ${p1.x} ${p1.y} C ${p1.x+dx} ${p1.y}, ${p2.x-dx} ${p2.y}, ${p2.x} ${p2.y}`;
317
+ const path = document.createElementNS('http://www.w3.org/2000/svg','path');
318
+ path.setAttribute('d', d); wires.appendChild(path);
319
+ });
320
  }
321
+ // drag
322
+ document.querySelectorAll('.node').forEach(n => {
323
+ const head = n.querySelector('.node-head');
324
+ head.addEventListener('mousedown', e => {
325
+ document.querySelectorAll('.node').forEach(m=>m.classList.remove('selected'));
326
+ n.classList.add('selected');
327
+ const sx = e.clientX - n.offsetLeft, sy = e.clientY - n.offsetTop;
328
+ const mv = ev => { n.style.left = (ev.clientX - sx)+'px'; n.style.top = (ev.clientY - sy)+'px'; draw(); };
329
+ const up = () => { window.removeEventListener('mousemove', mv); window.removeEventListener('mouseup', up); };
330
+ window.addEventListener('mousemove', mv); window.addEventListener('mouseup', up);
331
+ });
332
+ });
333
+ window.addEventListener('resize', draw); draw();
334
+ setTimeout(draw, 50);
335
 
336
+ // Anidoodle live link β€” tries suite-root and public/ bases so
337
+ // both Mala-Motion Suite/index.html and public/index.html resolve. No C: paths.
338
+ const ASSET_CANDIDATES = ['public/assets/watercolor_bus.png', 'assets/watercolor_bus.png'];
339
+ const MANIFEST_CANDIDATES = ['public/assets/manifest.json', 'assets/manifest.json'];
340
+ function setAnidoodleSrc(src, label){
341
+ const img = document.getElementById('busImg');
342
+ const status = document.getElementById('busStatus');
343
+ if (label) status.innerHTML = `linking <b>${label}</b>…`;
344
+ img.dataset.try = '0'; img.src = src;
345
+ }
346
+ (function(){
347
+ const img = document.getElementById('busImg');
348
+ const preview = document.getElementById('busPreview');
349
+ const status = document.getElementById('busStatus');
350
+ const foot = document.getElementById('busFoot');
351
+ const bar = document.getElementById('busBar');
352
+ const playBtn = document.getElementById('busPlay');
353
+ const speed = document.getElementById('busSpeed');
354
+ function setPlaying(p){
355
+ preview.classList.toggle('playing', p);
356
+ playBtn.textContent = p ? '⏸ pause' : 'β–Ά play';
357
+ }
358
+ playBtn.onclick = e => { e.stopPropagation(); setPlaying(!preview.classList.contains('playing')); };
359
+ preview.onclick = e => { e.stopPropagation(); setPlaying(!preview.classList.contains('playing')); };
360
+ speed.oninput = () => { img.style.animationDuration = (2.2 / parseFloat(speed.value)) + 's';
361
+ img.style.filter = `saturate(${0.9 + parseFloat(speed.value)*0.15})`; };
362
+ img.addEventListener('load', () => {
363
+ status.innerHTML = `live β€” <b>${img.getAttribute('src')}</b> Β· ${img.naturalWidth}Γ—${img.naturalHeight}px`;
364
+ const insp = document.getElementById('inspSrc'); if (insp) insp.value = img.getAttribute('src');
365
+ foot.textContent = '● live link'; bar.style.width = '100%';
366
+ });
367
+ img.addEventListener('error', () => {
368
+ const i = parseInt(img.dataset.try || '0', 10);
369
+ if (i + 1 < ASSET_CANDIDATES.length) { img.dataset.try = String(i + 1); img.src = ASSET_CANDIDATES[i + 1]; return; }
370
+ status.innerHTML = `missing β€” expected at <b>${ASSET_CANDIDATES.join('</b> or <b>')}</b>.`;
371
+ foot.textContent = '● missing asset'; bar.style.width = '12%';
372
+ });
373
+ if (!(img.complete && img.naturalWidth)) { img.dataset.try = '0'; img.src = ASSET_CANDIDATES[0]; }
374
+ window.MalaBus = { setSrc: setAnidoodleSrc, candidates: ASSET_CANDIDATES };
375
+ })();
376
 
377
+ // Local Asset Browser β€” reads public/assets via manifest.json (generated
378
+ // from the real folder), plus optional live folder handle. No C: paths.
379
+ (function(){
380
+ const tree = document.getElementById('assetTree');
381
+ const st = document.getElementById('assetStatus');
382
+ const refresh = document.getElementById('assetRefresh');
383
+ const linkBtn = document.getElementById('assetLinkBtn');
384
+ const addBtn = document.getElementById('assetAddBtn');
385
+ const pick = document.getElementById('assetFilePick');
386
+ let files = [];
387
+ const fmt = n => n > 1048576 ? (n/1048576).toFixed(1)+' MB' : Math.max(1, Math.round(n/1024))+' KB';
388
+ async function loadManifest(){
389
+ tree.innerHTML = '<div class="tree-empty">reading manifest…</div>';
390
+ for (const url of MANIFEST_CANDIDATES) {
391
+ try {
392
+ const r = await fetch(url, { cache: 'no-store' });
393
+ if (!r.ok) continue;
394
+ const j = await r.json();
395
+ if (Array.isArray(j.files) && j.files.length) {
396
+ files = j.files.map(f => ({ name: f.name, size: f.size || 0,
397
+ src: (url.startsWith('assets/') ? 'assets/' : 'public/assets/') + f.name }));
398
+ render(`live Β· ${url} Β· ${files.length} file(s)`);
399
+ return;
400
+ }
401
+ } catch(e) { /* try next candidate */ }
402
+ }
403
+ // static fallback: known asset, keeps browser usable offline / file://
404
+ files = [{ name: 'watercolor_bus.png', size: 2442461, src: ASSET_CANDIDATES[0] }];
405
+ render('fallback Β· manifest not served β€” showing known asset. Serve via Start_Suite.bat for full listing.');
406
+ }
407
+ function render(msg){
408
+ st.textContent = msg;
409
+ tree.innerHTML = `<div class="tree-folder">β–Ύ assets/ <span class="count">${files.length}</span></div>`;
410
+ files.forEach((f, i) => {
411
+ const el = document.createElement('div');
412
+ el.className = 'tree-file'; el.draggable = true;
413
+ el.innerHTML = `<img class="th" loading="lazy" src="${f.src}" alt="" />
414
+ <div><div class="nm">${f.name}</div><div class="sz">${fmt(f.size)}</div></div>
415
+ <div class="acts"><button class="mini-btn" data-a="use">use</button><button class="mini-btn" data-a="pin">οΌ‹</button></div>`;
416
+ el.title = 'drag onto moodboard or canvas';
417
+ el.addEventListener('dragstart', ev => { ev.dataTransfer.setData('text/mala-asset', JSON.stringify(f)); });
418
+ el.querySelector('[data-a=use]').onclick = () => window.MalaBus.setSrc(f.src, f.src);
419
+ el.querySelector('[data-a=pin]').onclick = () => window.MalaBoard.add(f.src, f.name);
420
+ el.ondblclick = () => window.MalaBus.setSrc(f.src, f.src);
421
+ tree.appendChild(el);
422
+ });
423
+ }
424
+ refresh.onclick = loadManifest;
425
+ addBtn.onclick = () => pick.click();
426
+ pick.onchange = () => {
427
+ [...pick.files].forEach(file => {
428
+ const rd = new FileReader();
429
+ rd.onload = () => window.MalaBoard.add(rd.result, file.name);
430
+ rd.readAsDataURL(file);
431
+ });
432
+ pick.value = '';
433
  };
434
+ linkBtn.onclick = async () => {
435
+ try {
436
+ if (!window.showDirectoryPicker) { st.textContent = 'browser has no folder picker β€” use οΌ‹ drop files instead.'; pick.click(); return; }
437
+ const h = await window.showDirectoryPicker({ mode: 'read' });
438
+ let n = 0;
439
+ for await (const e of h.values()) {
440
+ if (e.kind !== 'file') continue;
441
+ const f = await e.getFile();
442
+ if (!f.type.startsWith('image/')) continue;
443
+ window.MalaBoard.add(URL.createObjectURL(f), f.name); n++;
444
+ }
445
+ st.textContent = n ? `linked folder handle Β· added ${n} image(s) to moodboard` : 'folder linked Β· no images found inside';
446
+ } catch(e) { st.textContent = 'folder link cancelled'; }
447
+ };
448
+ window.MalaAssets = { reload: loadManifest };
449
+ loadManifest();
450
+ })();
 
 
 
 
 
451
 
452
+ // Editorial Interactive Moodboard β€” drop / pin / drag, responsive grid.
453
+ (function(){
454
+ const grid = document.getElementById('moodGrid');
455
+ const count = document.getElementById('moodCount');
456
+ let tiles = [];
457
+ try { tiles = JSON.parse(localStorage.getItem('mala-mood') || '[]').slice(0, 24); } catch(e) { tiles = []; }
458
+ function save(){ try { localStorage.setItem('mala-mood', JSON.stringify(tiles.filter(t => !t.src.startsWith('blob:')).slice(0, 24))); } catch(e){} }
459
+ function paint(){
460
+ const pinned = tiles.filter(t => t.pinned).length;
461
+ count.textContent = `${pinned} pinned Β· ${tiles.length} tiles`;
462
+ grid.innerHTML = tiles.length ? '' : '<div class="mood-empty">drop images here β€” from the asset browser, your desktop, or the οΌ‹ button. Click πŸ“Œ to pin, drag to reorder.</div>';
463
+ tiles.forEach((t, i) => {
464
+ const d = document.createElement('div');
465
+ d.className = 'tile' + (t.pinned ? ' pinned' : ''); d.draggable = true;
466
+ d.innerHTML = `<img src="${t.src}" alt="" draggable="false" /><button class="x" title="remove">Γ—</button>
467
+ <button class="pin" title="pin / unpin">${t.pinned ? 'πŸ“Œ' : 'πŸ“'}</button><div class="cap">${t.name}</div>`;
468
+ d.querySelector('.pin').onclick = e => { e.stopPropagation(); t.pinned = !t.pinned; save(); paint(); };
469
+ d.querySelector('.x').onclick = e => { e.stopPropagation(); tiles.splice(i, 1); save(); paint(); };
470
+ d.ondblclick = () => window.MalaBus.setSrc(t.src, t.name);
471
+ d.addEventListener('dragstart', ev => ev.dataTransfer.setData('text/mala-tile', String(i)));
472
+ d.addEventListener('dragover', ev => ev.preventDefault());
473
+ d.addEventListener('drop', ev => {
474
+ ev.preventDefault(); ev.stopPropagation();
475
+ const from = ev.dataTransfer.getData('text/mala-tile');
476
+ if (from !== '') { const m = tiles.splice(parseInt(from, 10), 1)[0]; tiles.splice(i, 0, m); save(); paint(); }
477
+ });
478
+ grid.appendChild(d);
479
+ });
480
+ }
481
+ function add(src, name){ tiles.unshift({ src, name: name || 'pasted', pinned: false }); tiles = tiles.slice(0, 24); save(); paint(); }
482
+ grid.addEventListener('dragover', ev => { ev.preventDefault(); grid.classList.add('drover'); });
483
+ grid.addEventListener('dragleave', () => grid.classList.remove('drover'));
484
+ grid.addEventListener('drop', ev => {
485
+ ev.preventDefault(); grid.classList.remove('drover');
486
+ const js = ev.dataTransfer.getData('text/mala-asset');
487
+ if (js) { try { const f = JSON.parse(js); add(f.src, f.name); return; } catch(e){} }
488
+ [...(ev.dataTransfer.files || [])].forEach(file => {
489
+ if (!file.type.startsWith('image/')) return;
490
+ const rd = new FileReader(); rd.onload = () => add(rd.result, file.name); rd.readAsDataURL(file);
491
+ });
492
+ });
493
+ document.getElementById('moodDensity').onclick = e => {
494
+ grid.classList.toggle('dense'); e.target.textContent = grid.classList.contains('dense') ? 'β–¦ cozy' : 'β–¦ dense';
495
+ };
496
+ document.getElementById('moodClear').onclick = () => { tiles = tiles.filter(t => t.pinned); save(); paint(); };
497
+ document.getElementById('moodSend').onclick = () => { if (tiles[0]) window.MalaBus.setSrc(tiles[0].src, tiles[0].name); };
498
+ window.MalaBoard = { add };
499
+ if (!tiles.length) add(ASSET_CANDIDATES[0], 'watercolor_bus.png');
500
+ else paint();
 
 
 
 
 
 
 
 
 
 
 
501
  })();
 
 
502
 
503
+ // WebGL Fog Node β€” fluid mouse-responsive orange fog over the grid workspace.
504
+ (function(){
505
+ const cv = document.getElementById('fogGL');
506
+ const wrap = document.getElementById('canvas');
507
+ const btn = document.getElementById('fogToggle');
508
+ const dens = document.getElementById('fogDensity');
509
+ const flow = document.getElementById('fogFlow');
510
+ const stat = document.getElementById('fogStat');
511
+ const foot = document.getElementById('fogFoot');
512
+ const gpuLbl = document.querySelector('.status span:nth-child(2)');
513
+ const state = { on: true, density: 0.55, speed: 1.0, mx: 0.5, my: 0.5, tmx: 0.5, tmy: 0.5 };
514
+ function fallback(msg){
515
+ cv.style.display = 'none';
516
+ stat.textContent = '2d fallback Β· ' + msg; foot.textContent = '● fallback';
517
+ if (gpuLbl) gpuLbl.textContent = 'GPU: unavailable β€” CSS grid';
518
+ }
519
+ let gl = null;
520
+ try { gl = cv.getContext('webgl', { antialias: false, alpha: false }) || cv.getContext('experimental-webgl'); } catch(e) {}
521
+ if (!gl) { fallback('no webgl'); wireToggle(true); return; }
522
+ const VS = 'attribute vec2 p;void main(){gl_Position=vec4(p,0.,1.);}';
523
+ const FS = `precision mediump float;
524
+ uniform vec2 u_res; uniform float u_time; uniform vec2 u_mouse;
525
+ uniform float u_density; uniform float u_speed;
526
+ float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7)))*43758.5453); }
527
+ float noise(vec2 p){ vec2 i=floor(p), f=fract(p); f=f*f*(3.-2.*f);
528
+ return mix(mix(hash(i),hash(i+vec2(1,0)),f.x), mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x), f.y); }
529
+ float fbm(vec2 p){ float v=0., a=.5; for(int i=0;i<4;i++){ v+=a*noise(p); p*=2.03; a*=.5; } return v; }
530
+ void main(){
531
+ vec2 uv = gl_FragCoord.xy/u_res;
532
+ vec2 asp = vec2(u_res.x/u_res.y, 1.0);
533
+ vec2 p = (uv-.5)*asp;
534
+ vec2 m = (u_mouse-.5)*asp;
535
+ float md = length(p-m);
536
+ float t = u_time*u_speed;
537
+ vec2 pull = (m-p)*exp(-md*3.0)*0.9;
538
+ vec2 q = p*1.4 + pull + vec2(t*.05, t*.03);
539
+ float n = fbm(q + fbm(q + t*.04));
540
+ float fog = smoothstep(.32,.92,n)*u_density;
541
+ float glow = exp(-md*4.0)*.55;
542
+ vec3 base = vec3(.043,.047,.059);
543
+ vec3 orange = vec3(1.,.42,.10);
544
+ vec3 orange2 = vec3(1.,.63,.37);
545
+ vec3 col = mix(base, mix(orange,orange2,n), fog*.85);
546
+ col += orange2*glow*(.25+fog);
547
+ col *= 1.-.35*length(uv-.5);
548
+ gl_FragColor = vec4(col,1.);
549
+ }`;
550
+ function sh(type, src){
551
+ const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s);
552
+ if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) { fallback('shader error'); return null; }
553
+ return s;
554
+ }
555
+ const vs = sh(gl.VERTEX_SHADER, VS); if (!vs) { wireToggle(true); return; }
556
+ const fs = sh(gl.FRAGMENT_SHADER, FS); if (!fs) { wireToggle(true); return; }
557
+ const pr = gl.createProgram();
558
+ gl.attachShader(pr, vs); gl.attachShader(pr, fs); gl.linkProgram(pr);
559
+ if (!gl.getProgramParameter(pr, gl.LINK_STATUS)) { fallback('link error'); wireToggle(true); return; }
560
+ gl.useProgram(pr);
561
+ const buf = gl.createBuffer();
562
+ gl.bindBuffer(gl.ARRAY_BUFFER, buf);
563
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1,-1, 3,-1, -1,3]), gl.STATIC_DRAW);
564
+ const loc = gl.getAttribLocation(pr, 'p');
565
+ gl.enableVertexAttribArray(loc); gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);
566
+ const U = n => gl.getUniformLocation(pr, n);
567
+ const uRes = U('u_res'), uTime = U('u_time'), uMouse = U('u_mouse'), uDen = U('u_density'), uSpd = U('u_speed');
568
+ function size(){
569
+ const dpr = Math.min(window.devicePixelRatio || 1, 1.25);
570
+ const w = Math.max(1, Math.floor(wrap.clientWidth * dpr));
571
+ const h = Math.max(1, Math.floor(wrap.clientHeight * dpr));
572
+ if (cv.width !== w || cv.height !== h) { cv.width = w; cv.height = h; gl.viewport(0, 0, w, h); }
573
+ }
574
+ size(); window.addEventListener('resize', size);
575
+ wrap.addEventListener('mousemove', e => {
576
+ const r = wrap.getBoundingClientRect();
577
+ state.tmx = (e.clientX - r.left) / Math.max(1, r.width);
578
+ state.tmy = 1 - (e.clientY - r.top) / Math.max(1, r.height);
579
+ });
580
+ wrap.addEventListener('mouseleave', () => { state.tmx = 0.5; state.tmy = 0.5; });
581
+ const t0 = performance.now();
582
+ (function frame(){
583
+ requestAnimationFrame(frame);
584
+ if (!state.on || document.hidden) return;
585
+ size();
586
+ state.mx += (state.tmx - state.mx) * 0.06;
587
+ state.my += (state.tmy - state.my) * 0.06;
588
+ gl.uniform2f(uRes, cv.width, cv.height);
589
+ gl.uniform1f(uTime, (performance.now() - t0) / 1000);
590
+ gl.uniform2f(uMouse, state.mx, state.my);
591
+ gl.uniform1f(uDen, state.density);
592
+ gl.uniform1f(uSpd, state.speed);
593
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
594
+ })();
595
+ function paintBtn(){ btn.textContent = state.on ? 'β—‰ fog on' : 'β—‹ fog off'; btn.classList.toggle('off', !state.on); }
596
+ function wireToggle(dead){
597
+ btn.onclick = e => {
598
+ e.stopPropagation();
599
+ if (dead) return;
600
+ state.on = !state.on;
601
+ cv.style.display = state.on ? 'block' : 'none';
602
+ foot.textContent = state.on ? '● live' : 'β—‹ paused';
603
+ paintBtn();
604
+ };
605
+ }
606
+ wireToggle(false);
607
+ dens.oninput = () => { state.density = dens.value / 100; };
608
+ flow.oninput = () => { state.speed = flow.value / 100; };
609
+ paintBtn();
610
+ if (gpuLbl) gpuLbl.textContent = 'GPU: WebGL fog live';
611
+ window.MalaFog = state;
612
+ })();
613
  </script>
614
  </body>
615
  </html>