BioCell simulator (private preview)
Browse files127 unmodified lines128129130131132133134135136137138139140141107 unmodified lines249250251252253254255196 unmodified lines4524534544554564574584594604614624634644652 unmodified lines46846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452534 unmodified lines560561562563564565566127 unmodified lines.org:focus{outline:none}.org:focus-visible .shp{stroke-width:3.5}.shp{transition:fill .4s ease-out,stroke .4s ease-out}.clbl{font:600 12px var(--sans);fill:var(--ink)}.cst{font:500 11.5px var(--sans);fill:var(--ink)}.cst .arr{font-weight:700}#breath{transform-box:fill-box;transform-origin:center;animation:breathe 7s ease-in-out infinite alternate}@keyframes breathe{from{transform:scale(1)}to{transform:scale(1.015)}}body.calm #breath{animation:none}body.calm .shp{transition:none}@media (prefers-reduced-motion: reduce){#breath{animation:none}.shp{transition:none}.card{transition:none}}/* System card */.syscard{position:absolute;left:18px;right:18px;bottom:18px;background:var(--white);border-radius:28px;box-shadow:var(--lift);padding:16px 18px;z-index:5;border:1px solid var(--line)}107 unmodified lines.controls{border-radius:28px;padding:12px}.group.lines{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;max-width:100%}.clbl,.cst .stt{display:none}.cst{font-size:22px}.story{min-height:420px;padding:18px}.genes{grid-template-columns:1fr}.twocol{grid-template-columns:1fr}196 unmodified linesconst motionOff = () => rmq.matches || state.paused;/* ---------- The cell drawing ---------- */function blobPath(cx, cy, rx, ry, k){// A soft, organic closed outline: an ellipse with a few gentle bumps, smoothed with Catmull-Rom curves.const n = 36, pts = [];for (let i = 0; i < n; i++){const t = i / n * Math.PI * 2;const r = 1 + k * (0.030 * Math.sin(3*t + 0.6) + 0.018 * Math.sin(5*t + 2.1) + 0.010 * Math.sin(7*t + 0.3));pts.push([cx + rx * r * Math.cos(t), cy + ry * r * Math.sin(t)]);}const f = v => v.toFixed(1);let d = `M${f(pts[0][0])} ${f(pts[0][1])}`;for (let i = 0; i < n; i++){2 unmodified lines}return d + "Z";}function erPath(cx, cy, rx, ry){// A wavy ring (the protein-factory network round the nucleus).const n = 120; let d = "";for (let i = 0; i <= n; i++){const t = i / n * Math.PI * 2, w = 1 + 0.045 * Math.sin(9*t);d += (i ? " L" : "M") + (cx + rx*w*Math.cos(t)).toFixed(1) + " " + (cy + ry*w*Math.sin(t)).toFixed(1);}return d + "Z";}const CELL_PATHS = {body: blobPath(270, 175, 226, 144, 1), halo: blobPath(270, 175, 250, 162, 0.8), er: erPath(205, 168, 92, 80)};const RIBOSOMES = [[120,120],[138,232],[300,120],[316,200],[290,236],[110,200],[160,80],[330,92],[262,262],[420,128],[440,206],[396,262],[96,150],[318,154]];function cellSVG(p, mini){const o = (id, inner) => `<g class="org" id="${p}org-${id}" data-sys="${id}" ${mini ? "" : `tabindex="0" role="button" aria-label="${SYS[id]}: steady"`}>${inner}</g>`;const st = (id, x, y, anchor) => `<text class="cst" id="${p}z-${id}" x="${x}" y="${y}" text-anchor="${anchor||"middle"}"><tspan class="arr"></tspan><tspan class="stt"></tspan></text>`;const lb = (t, x, y, anchor) => mini ? "" : `<text class="clbl" x="${x}" y="${y}" text-anchor="${anchor||"middle"}">${t}</text>`;const S = 'stroke="#1C1B18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';const T = 'stroke="#1C1B18" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"';const dots = RIBOSOMES.map(([x,y]) => `<circle cx="${x}" cy="${y}" r="2.2" fill="#1C1B18" fill-opacity=".55"/>`).join("");return `<svg viewBox="0 0 540 350" ${mini ? 'aria-hidden="true"' : 'role="group" aria-label="The cell"'} xmlns="http://www.w3.org/2000/svg"><g id="${p}breath">${o("stress_alarm", `<path class="shp" data-kind="stroke" id="${p}shape-stress_alarm" d="${CELL_PATHS.halo}" fill="none" ${S} stroke-dasharray="1 9" stroke-width="3"/>${lb("Stress alarm",516,334,"end")}${st("stress_alarm",516,348,"end")}`)}${o("cell_skeleton", `<path class="shp" data-kind="fill" id="${p}shape-cell_skeleton" d="${CELL_PATHS.body}" fill="#FFFCF6" ${S}/><path d="M96 120 Q180 146 262 104 M120 250 Q236 222 330 262 M352 66 Q400 120 450 150 M300 300 Q360 286 420 272" fill="none" stroke="#3F6B4C" stroke-opacity=".22" stroke-width="1.5" stroke-linecap="round"/><g fill="#F6EFE2" ${T}><path d="M436 222 q18 -8 36 0"/><path d="M432 232 q22 -9 44 0"/><path d="M436 242 q18 -8 36 0"/></g>${lb("Skeleton and shape",22,14,"start")}${st("cell_skeleton",22,28,"start")}`)}${o("protein_factory", `<path d="${CELL_PATHS.er}" fill="none" stroke="#E4EEE0" stroke-width="16" stroke-linejoin="round"/><path class="shp" data-kind="stroke" id="${p}shape-protein_factory" d="${CELL_PATHS.er}" fill="none" stroke="#1C1B18" stroke-width="5" stroke-linecap="round" stroke-dasharray="0 11"/>${dots}${lb("Protein factories",172,72,"middle")}${st("protein_factory",172,86,"middle")}`)}${o("cell_division", `<circle class="shp" data-kind="fill" id="${p}shape-cell_division" cx="205" cy="168" r="60" fill="#F3ECDF" ${S}/><path d="M174 146 C186 134, 214 136, 224 146 M176 196 C186 204, 206 206, 216 198" fill="none" stroke="#1C1B18" stroke-opacity=".3" stroke-width="1.6" stroke-linecap="round"/><circle cx="238" cy="198" r="10" fill="#E6D9C2" ${T}/>${lb("Cell division",205,166)}${st("cell_division",205,182)}`)}${o("message_editing", `<rect class="shp" data-kind="fill" id="${p}shape-message_editing" x="146" y="256" width="118" height="34" rx="17" fill="#FAF6EE" ${S}/><path d="M268 262 q6 -6 12 0 t12 0" fill="none" stroke="#1C1B18" stroke-opacity=".5" stroke-width="1.6" stroke-linecap="round"/>${lb("Message editing",205,270)}${st("message_editing",205,284)}`)}${o("power_plants", `<g transform="translate(362,214) rotate(-14)"><rect class="shp" data-kind="fill" id="${p}shape-power_plants" x="-50" y="-22" width="100" height="44" rx="22" fill="#FCEFE4" ${S}/><rect x="-42" y="-14" width="84" height="28" rx="14" fill="none" stroke="#1C1B18" stroke-opacity=".35" stroke-width="1.4"/><path d="M-30 -14 v14 M-18 14 v-16 M-6 -14 v16 M6 14 v-16 M18 -14 v16 M30 14 v-14" fill="none" stroke="#1C1B18" stroke-opacity=".45" stroke-width="1.6" stroke-linecap="round"/></g><g transform="translate(118,250) rotate(18)"><rect x="-17" y="-8" width="34" height="16" rx="8" fill="#FCEFE4" ${T}/><path d="M-8 -8 v9 M0 8 v-9 M8 -8 v9" fill="none" stroke="#1C1B18" stroke-opacity=".45" stroke-width="1.3" stroke-linecap="round"/></g>${lb("Power plants",362,258)}${st("power_plants",362,272)}`)}${o("trash_recycling", `<circle class="shp" data-kind="fill" id="${p}shape-trash_recycling" cx="378" cy="108" r="36" fill="#EAF2E7" ${S}/><circle cx="356" cy="90" r="3.5" fill="#FFFCF6" ${T}/><circle cx="398" cy="133" r="3" fill="#FFFCF6" ${T}/><circle cx="404" cy="72" r="6" fill="#EAF2E7" ${T}/><circle cx="420" cy="92" r="4.5" fill="#EAF2E7" ${T}/><circle cx="344" cy="78" r="5" fill="#EAF2E7" ${T}/>${lb("Recycling",378,106)}${st("trash_recycling",378,121)}`)}${o("fuel_metabolism", `<rect class="shp" data-kind="fill" id="${p}shape-fuel_metabolism" x="410" y="152" width="80" height="34" rx="17" fill="#F7F0E0" ${S}/>${lb("Fuel",450,166)}${st("fuel_metabolism",450,180)}`)}${o("self_destruct", `<rect class="shp" data-kind="fill" id="${p}shape-self_destruct" x="244" y="44" width="136" height="34" rx="17" fill="#FAF6EE" ${S}/>${lb("Self-destruct switch",312,58)}${st("self_destruct",312,72)}`)}${o("immune_signals", `<rect class="shp" data-kind="fill" id="${p}shape-immune_signals" x="34" y="152" width="80" height="34" rx="17" fill="#F2F6EE" ${S}/>${lb("Signals",74,166)}${st("immune_signals",74,180)}`)}</g></svg>`;}const IDLE_FILL = {cell_skeleton:"#FFFCF6", cell_division:"#F3ECDF", power_plants:"#FCEFE4", trash_recycling:"#EAF2E7", fuel_metabolism:"#F7F0E0", immune_signals:"#F2F6EE"};function colorsFor(dir, strong, kind){if (kind === "stroke") return dir === "up" ? "#3F6B4C" : "#8A4F2A";if (kind === "body") return dir === "up" ? (strong ? "#C5DDC7" : "#DFEDDD") : (strong ? "#F8D6C1" : "#FBE4D6");if (dir === "up") return strong ? "#9CC2A1" : "#C5DDC7";return strong ? "#F5C3A5" : "#F8D6C1";}34 unmodified linesconst finalScale = dir === "up" ? 1.03 : 0.97;const apply = () => {if (sh.dataset.kind === "stroke") sh.setAttribute("stroke", colorsFor(dir, strong, "stroke"));else sh.setAttribute("fill", colorsFor(dir, strong, s.id === "cell_skeleton" ? "body" : "fill"));g.style.transform = s.id === "cell_skeleton" || s.id === "stress_alarm" ? "" : `scale(${finalScale})`;};if (calm){ apply(); setStatus(p, s.id, dir, val); return; }127 unmodified lines128129130131132133134135136137138139140141142143144145146147148149150151107 unmodified lines259260261262263264265196 unmodified lines4624634644654664674684694704714724734742 unmodified lines47747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857934 unmodified lines614615616617618619620127 unmodified lines.org:focus{outline:none}.org:focus-visible .shp{stroke-width:3.5}.shp{transition:fill .4s ease-out,stroke .4s ease-out}.clbl{font:600 13px var(--sans);fill:var(--ink)}.cst{font:500 12.5px var(--sans);fill:var(--ink)}.cst .arr{font-weight:700}.lblg{cursor:pointer}.lead{stroke:#1C1B18;stroke-opacity:.45;stroke-width:1}.lead-dot{fill:#1C1B18}#breath{transform-box:fill-box;transform-origin:center;animation:breathe 7s ease-in-out infinite alternate}@keyframes breathe{from{transform:scale(1)}to{transform:scale(1.015)}}.drift{animation:drift 11s ease-in-out infinite}.drift.d1{animation-name:drift1;animation-duration:9s}.drift.d2{animation-name:drift2;animation-duration:12s}.drift.d3{animation-name:drift3;animation-duration:14s}@keyframes drift1{0%,100%{transform:translate(0,0)}50%{transform:translate(3px,-2px)}}@keyframes drift2{0%,100%{transform:translate(0,0)}50%{transform:translate(-2px,3px)}}@keyframes drift3{0%,100%{transform:translate(0,0)}33%{transform:translate(2px,2px)}66%{transform:translate(-2px,1px)}}body.calm #breath,body.calm .drift{animation:none}body.calm .shp{transition:none}@media (prefers-reduced-motion: reduce){#breath,.drift{animation:none}.shp{transition:none}.card{transition:none}}/* System card */.syscard{position:absolute;left:18px;right:18px;bottom:18px;background:var(--white);border-radius:28px;box-shadow:var(--lift);padding:16px 18px;z-index:5;border:1px solid var(--line)}107 unmodified lines.controls{border-radius:28px;padding:12px}.group.lines{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;max-width:100%}.clbl,.cst .stt{display:none}.cst{font-size:30px}.story{min-height:420px;padding:18px}.genes{grid-template-columns:1fr}.twocol{grid-template-columns:1fr}196 unmodified linesconst motionOff = () => rmq.matches || state.paused;/* ---------- The cell drawing ---------- *//* ---- Cell drawing (round 3): organelles on an organic body; labels outside on leader lines ---- */const CX = 300, CY = 190;function wob(t, k){ return 1 + k * (0.030 * Math.sin(3*t + 0.6) + 0.018 * Math.sin(5*t + 2.1) + 0.010 * Math.sin(7*t + 0.3)); }function blobPt(t, rx, ry, k, cx, cy){ const r = wob(t, k); return [(cx ?? CX) + rx * r * Math.cos(t), (cy ?? CY) + ry * r * Math.sin(t)]; }function blobPath(rx, ry, k){const n = 40, pts = [];for (let i = 0; i < n; i++) pts.push(blobPt(i / n * Math.PI * 2, rx, ry, k));const f = v => v.toFixed(1);let d = `M${f(pts[0][0])} ${f(pts[0][1])}`;for (let i = 0; i < n; i++){2 unmodified lines}return d + "Z";}const deg = a => a * Math.PI / 180;const NUC = {x:262, y:192, r:66};function arcPath(cx, cy, r, a0, a1, wave, n){// an open wavy arc (used for the folded ribbons of the protein factories)let d = "";for (let i = 0; i <= n; i++){const t = deg(a0 + (a1 - a0) * i / n), rr = r + wave * Math.sin(i / n * Math.PI * 7);d += (i ? " L" : "M") + (cx + rr*Math.cos(t)).toFixed(1) + " " + (cy + rr*Math.sin(t)).toFixed(1);}return d;}function bandPath(cx, cy, r0, r1, a0, a1){// a closed crescent band on the nucleus edge (message editing)const p = (r, a) => `${(cx + r*Math.cos(deg(a))).toFixed(1)} ${(cy + r*Math.sin(deg(a))).toFixed(1)}`;return `M${p(r1,a0)} A${r1} ${r1} 0 0 1 ${p(r1,a1)} A${(r1-r0)/2} ${(r1-r0)/2} 0 0 1 ${p(r0,a1)} A${r0} ${r0} 0 0 0 ${p(r0,a0)} A${(r1-r0)/2} ${(r1-r0)/2} 0 0 1 ${p(r1,a0)}Z`;}function bean(cx, cy, w, h, rot){// one mitochondrion outline (a capsule with a slight waist), in page coordinatesconst a = w/2, b = h/2, c = Math.cos(deg(rot)), sn = Math.sin(deg(rot));const P = (x, y) => `${(cx + x*c - y*sn).toFixed(1)} ${(cy + x*sn + y*c).toFixed(1)}`;const d = `M${P(-a,0)} C${P(-a,-b*1.15)} ${P(-a*0.2,-b*1.05)} ${P(0,-b*0.8)} C${P(a*0.2,-b*1.05)} ${P(a,-b*1.15)} ${P(a,0)} C${P(a,b*1.15)} ${P(a*0.2,b*1.05)} ${P(0,b*0.8)} C${P(-a*0.2,b*1.05)} ${P(-a,b*1.15)} ${P(-a,0)}Z`;return {d, t:`translate(${cx} ${cy}) rotate(${rot})`, w};}function drop(x, y, r){ return `M${x} ${y-r*1.35} C${x+r*0.9} ${y-r*0.4} ${x+r} ${y+r*0.2} ${x+r} ${y+r*0.35} A${r} ${r} 0 0 1 ${x-r} ${y+r*0.35} C${x-r} ${y+r*0.2} ${x-r*0.9} ${y-r*0.4} ${x} ${y-r*1.35}Z`; }function circ(x, y, r){ return `M${x-r} ${y} a${r} ${r} 0 1 0 ${2*r} 0 a${r} ${r} 0 1 0 ${-2*r} 0Z`; }function hexa(x, y, r){ let d = ""; for (let i = 0; i < 6; i++){ const a = deg(60*i - 90); d += (i ? " L" : "M") + (x + r*Math.cos(a)).toFixed(1) + " " + (y + r*Math.sin(a)).toFixed(1); } return d + "Z"; }const BODY = {rx:190, ry:135, k:1};const MITO = [bean(388, 266, 60, 26, -20), bean(438, 228, 48, 22, 32), bean(340, 300, 46, 20, -6)];const VESICLES = [[398,122,16],[424,110,10],[416,146,9],[376,102,8],[440,134,6]];const DROPS = [[456,168,8],[470,190,6],[450,192,5.5]];const RECEPTOR_ANGLES = [150, 168, 186, 204];const RIBO_FREE = [[160,140],[176,252],[340,150],[356,206],[330,240],[150,200],[200,96],[372,82],[300,282],[452,120],[408,192],[262,300],[138,170],[236,300],[392,236]];function cellSVG(p){const S = 'stroke="#1C1B18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';const T = 'stroke="#1C1B18" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"';const o = (id, inner, drift) => `<g class="org" id="${p}org-${id}" data-sys="${id}" tabindex="0" role="button" aria-label="${SYS[id]}: steady"><g class="${drift || ""}">${inner}</g></g>`;// Body: interior (rest colour) + membrane band (the reacting shape, two outline lines)const outer = blobPath(BODY.rx, BODY.ry, 1), inner = blobPath(BODY.rx - 9, BODY.ry - 9, 1);const halo = blobPath(BODY.rx + 22, BODY.ry + 20, 0.9);// Protein factories: ribbons round the nucleus; the beads (ribosomes) are the reacting shapeconst er = [arcPath(NUC.x, NUC.y, NUC.r + 20, 196, 338, 3.5, 70), arcPath(NUC.x, NUC.y, NUC.r + 34, 204, 330, 4, 70), arcPath(NUC.x, NUC.y, NUC.r + 48, 214, 318, 4, 60)];// Signals: receptors on the membraneconst rec = RECEPTOR_ANGLES.map(a => {const t = deg(a), [x, y] = blobPt(t, BODY.rx, BODY.ry, 1), ux = Math.cos(t), uy = Math.sin(t);const sx = x + ux*12, sy = y + uy*12, px = -uy, py = ux;return {stem:`M${(x-ux*2).toFixed(1)} ${(y-uy*2).toFixed(1)} L${sx.toFixed(1)} ${sy.toFixed(1)}`,head:`M${(sx+px*7).toFixed(1)} ${(sy+py*7).toFixed(1)} Q${(sx+ux*12).toFixed(1)} ${(sy+uy*12).toFixed(1)} ${(sx-px*7).toFixed(1)} ${(sy-py*7).toFixed(1)} Q${(sx+ux*4).toFixed(1)} ${(sy+uy*4).toFixed(1)} ${(sx+px*7).toFixed(1)} ${(sy+py*7).toFixed(1)}Z`};});const ribo = RIBO_FREE.map(([x,y]) => `<circle cx="${x}" cy="${y}" r="1.9" fill="#1C1B18" fill-opacity=".5"/>`).join("");const parts = [o("stress_alarm", `<path class="shp" data-kind="stroke" id="${p}shape-stress_alarm" d="${halo}" fill="none" ${S} stroke-dasharray="1 9" stroke-width="3"/>`),o("cell_skeleton", `<path d="${outer}" fill="#FFFFFF"/><path d="M150 150 Q220 120 300 140 M170 270 Q250 248 330 276 M360 76 Q410 110 470 150 M120 210 Q150 250 200 286" fill="none" stroke="#1C1B18" stroke-opacity=".12" stroke-width="1.3" stroke-linecap="round"/><g class="drift d3">${ribo}</g><path class="shp" data-kind="fill" id="${p}shape-cell_skeleton" d="${outer} ${inner}" fill-rule="evenodd" fill="#F3EFE6" stroke="#1C1B18" stroke-width="1.6" stroke-linejoin="round"/>`),o("protein_factory", `${er.map(d => `<path d="${d}" fill="none" stroke="#1C1B18" stroke-width="11" stroke-linecap="round" stroke-linejoin="round"/><path d="${d}" fill="none" stroke="#F3EFE6" stroke-width="7.4" stroke-linecap="round" stroke-linejoin="round"/>`).join("")}<path class="shp" data-kind="stroke" id="${p}shape-protein_factory" d="${er.join(" ")}" fill="none" stroke="#1C1B18" stroke-width="3.6" stroke-linecap="round" stroke-dasharray="0 9"/>`),o("cell_division", `<circle class="shp" data-kind="fill" id="${p}shape-cell_division" cx="${NUC.x}" cy="${NUC.y}" r="${NUC.r}" fill="#FAF6EE" ${S}/><circle cx="${NUC.x}" cy="${NUC.y}" r="${NUC.r - 6}" fill="none" stroke="#1C1B18" stroke-opacity=".25" stroke-width="1.2" stroke-dasharray="3 5"/><path d="M228 170 C238 154, 258 160, 252 176 S270 190, 284 180 M236 212 C248 224, 266 220, 272 230 M286 156 C296 162, 300 172, 296 182" fill="none" stroke="#1C1B18" stroke-opacity=".4" stroke-width="1.6" stroke-linecap="round"/><circle cx="${NUC.x + 22}" cy="${NUC.y + 14}" r="14" fill="#EFE6D4" ${T}/><circle cx="${NUC.x + 18}" cy="${NUC.y + 10}" r="4" fill="#E2D5BC"/>`),o("message_editing", `<path class="shp" data-kind="fill" id="${p}shape-message_editing" d="${bandPath(NUC.x, NUC.y, NUC.r + 1, NUC.r + 10, 112, 168)}" fill="#F3EFE6" ${S}/><path d="M188 262 q5 -6 10 0 t10 0 t10 0" fill="none" stroke="#1C1B18" stroke-opacity=".55" stroke-width="1.5" stroke-linecap="round"/>`, "drift d2"),o("power_plants", `<path class="shp" data-kind="fill" id="${p}shape-power_plants" d="${MITO.map(m => m.d).join(" ")}" fill="#F3EFE6" ${S}/>` + MITO.map(m => `<g transform="${m.t}"><path d="M${(-0.36*m.w).toFixed(1)} -4 l${(0.12*m.w).toFixed(1)} 8 l${(0.12*m.w).toFixed(1)} -8 l${(0.12*m.w).toFixed(1)} 8 l${(0.12*m.w).toFixed(1)} -8 l${(0.12*m.w).toFixed(1)} 8 l${(0.12*m.w).toFixed(1)} -8" fill="none" stroke="#1C1B18" stroke-opacity=".55" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/></g>`).join(""), "drift d1"),o("trash_recycling", `<path class="shp" data-kind="fill" id="${p}shape-trash_recycling" d="${VESICLES.map(([x,y,r]) => circ(x,y,r)).join(" ")}" fill="#FFFFFF" ${S}/><circle cx="394" cy="118" r="3" fill="#1C1B18" fill-opacity=".35"/><circle cx="404" cy="128" r="2" fill="#1C1B18" fill-opacity=".35"/>`, "drift d2"),o("fuel_metabolism", `<path class="shp" data-kind="fill" id="${p}shape-fuel_metabolism" d="${DROPS.map(([x,y,r]) => drop(x,y,r)).join(" ")}" fill="#FAF6EE" ${S}/>`, "drift d3"),o("self_destruct", `<path class="shp" data-kind="fill" id="${p}shape-self_destruct" d="${hexa(344, 82, 11)}" fill="#F3EFE6" ${S}/><circle cx="344" cy="82" r="3" fill="#1C1B18"/>`, "drift d1"),o("immune_signals", `${rec.map(r => `<path d="${r.stem}" fill="none" ${S}/>`).join("")}<path class="shp" data-kind="fill" id="${p}shape-immune_signals" d="${rec.map(r => r.head).join(" ")}" fill="#FFFFFF" ${S}/>`),];// Labels outside the cell, joined by leader lines. Clicking a label opens its system too.const L = [["cell_skeleton", 18, 24, "start", blobPt(deg(222), BODY.rx, BODY.ry, 1), [96, 40]],["protein_factory", 200, 24, "middle", [214, 118], [206, 48]],["self_destruct", 360, 24, "middle", [346, 70], [346, 48]],["trash_recycling", 512, 54, "start", [432, 104], [508, 58]],["fuel_metabolism", 512, 150, "start", [476, 178], [508, 154]],["power_plants", 512, 262, "start", [458, 234], [508, 266]],["stress_alarm", 582, 350, "end", blobPt(deg(42), BODY.rx + 22, BODY.ry + 20, 0.9), [520, 340]],["immune_signals", 18, 214, "start", blobPt(deg(186), BODY.rx + 14, BODY.ry + 14, 1), [80, 210]],["cell_division", 18, 128, "start", [NUC.x - 50, NUC.y - 40], [86, 132]],["message_editing", 18, 314, "start", [204, 252], [112, 312]],];const labels = L.map(([id, x, y, anc, tip, from]) => `<g class="lblg" data-sys="${id}"><path class="lead" d="M${from[0].toFixed(1)} ${from[1].toFixed(1)} L${tip[0].toFixed(1)} ${tip[1].toFixed(1)}" fill="none"/><circle class="lead-dot" cx="${tip[0].toFixed(1)}" cy="${tip[1].toFixed(1)}" r="2.6"/><text class="clbl" x="${x}" y="${y}" text-anchor="${anc}">${SYS[id]}</text><text class="cst" id="${p}z-${id}" x="${x}" y="${y + 15}" text-anchor="${anc}"><tspan class="arr"></tspan><tspan class="stt"></tspan></text></g>`).join("");return `<svg viewBox="0 0 600 370" role="group" aria-label="The cell" xmlns="http://www.w3.org/2000/svg"><g id="${p}breath">${parts.join("")}</g><g class="labels" aria-hidden="true">${labels}</g></svg>`;}const IDLE_FILL = {cell_skeleton:"#F3EFE6", cell_division:"#FAF6EE", power_plants:"#F3EFE6", trash_recycling:"#FFFFFF", fuel_metabolism:"#FAF6EE", self_destruct:"#F3EFE6", immune_signals:"#FFFFFF", message_editing:"#F3EFE6"};function colorsFor(dir, strong, kind){if (kind === "stroke") return dir === "up" ? "#3F6B4C" : "#8A4F2A";if (dir === "up") return strong ? "#9CC2A1" : "#C5DDC7";return strong ? "#F5C3A5" : "#F8D6C1";}34 unmodified linesconst finalScale = dir === "up" ? 1.03 : 0.97;const apply = () => {if (sh.dataset.kind === "stroke") sh.setAttribute("stroke", colorsFor(dir, strong, "stroke"));else sh.setAttribute("fill", colorsFor(dir, strong, "fill"));g.style.transform = s.id === "cell_skeleton" || s.id === "stress_alarm" ? "" : `scale(${finalScale})`;};if (calm){ apply(); setStatus(p, s.id, dir, val); return; }
static/index.html+113-59