BioCell simulator (private preview)
Browse files- static/index.html +113 -59
static/index.html
CHANGED
|
@@ -128,14 +128,24 @@ body.mixing .card .cname{padding-right:30px}
|
|
| 128 |
.org:focus{outline:none}
|
| 129 |
.org:focus-visible .shp{stroke-width:3.5}
|
| 130 |
.shp{transition:fill .4s ease-out,stroke .4s ease-out}
|
| 131 |
-
.clbl{font:600
|
| 132 |
-
.cst{font:500
|
| 133 |
.cst .arr{font-weight:700}
|
|
|
|
|
|
|
|
|
|
| 134 |
#breath{transform-box:fill-box;transform-origin:center;animation:breathe 7s ease-in-out infinite alternate}
|
| 135 |
@keyframes breathe{from{transform:scale(1)}to{transform:scale(1.015)}}
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
body.calm .shp{transition:none}
|
| 138 |
-
@media (prefers-reduced-motion: reduce){#breath{animation:none}.shp{transition:none}.card{transition:none}}
|
| 139 |
|
| 140 |
/* System card */
|
| 141 |
.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)}
|
|
@@ -249,7 +259,7 @@ dialog .close{position:absolute;top:18px;right:18px}
|
|
| 249 |
.controls{border-radius:28px;padding:12px}
|
| 250 |
.group.lines{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;max-width:100%}
|
| 251 |
.clbl,.cst .stt{display:none}
|
| 252 |
-
.cst{font-size:
|
| 253 |
.story{min-height:420px;padding:18px}
|
| 254 |
.genes{grid-template-columns:1fr}
|
| 255 |
.twocol{grid-template-columns:1fr}
|
|
@@ -452,14 +462,13 @@ const rmq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
| 452 |
const motionOff = () => rmq.matches || state.paused;
|
| 453 |
|
| 454 |
/* ---------- The cell drawing ---------- */
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
}
|
| 463 |
const f = v => v.toFixed(1);
|
| 464 |
let d = `M${f(pts[0][0])} ${f(pts[0][1])}`;
|
| 465 |
for (let i = 0; i < n; i++){
|
|
@@ -468,58 +477,103 @@ function blobPath(cx, cy, rx, ry, k){
|
|
| 468 |
}
|
| 469 |
return d + "Z";
|
| 470 |
}
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
|
|
|
|
|
|
| 474 |
for (let i = 0; i <= n; i++){
|
| 475 |
-
const t =
|
| 476 |
-
d += (i ? " L" : "M") + (cx +
|
| 477 |
}
|
| 478 |
-
return d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
}
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
function
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
const S = 'stroke="#1C1B18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
|
| 487 |
-
const T = 'stroke="#1C1B18" stroke-width="1.
|
| 488 |
-
const
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 518 |
}
|
| 519 |
-
const IDLE_FILL = {cell_skeleton:"#
|
| 520 |
function colorsFor(dir, strong, kind){
|
| 521 |
if (kind === "stroke") return dir === "up" ? "#3F6B4C" : "#8A4F2A";
|
| 522 |
-
if (kind === "body") return dir === "up" ? (strong ? "#C5DDC7" : "#DFEDDD") : (strong ? "#F8D6C1" : "#FBE4D6");
|
| 523 |
if (dir === "up") return strong ? "#9CC2A1" : "#C5DDC7";
|
| 524 |
return strong ? "#F5C3A5" : "#F8D6C1";
|
| 525 |
}
|
|
@@ -560,7 +614,7 @@ function paintCell(p, res, animate){
|
|
| 560 |
const finalScale = dir === "up" ? 1.03 : 0.97;
|
| 561 |
const apply = () => {
|
| 562 |
if (sh.dataset.kind === "stroke") sh.setAttribute("stroke", colorsFor(dir, strong, "stroke"));
|
| 563 |
-
else sh.setAttribute("fill", colorsFor(dir, strong,
|
| 564 |
g.style.transform = s.id === "cell_skeleton" || s.id === "stress_alarm" ? "" : `scale(${finalScale})`;
|
| 565 |
};
|
| 566 |
if (calm){ apply(); setStatus(p, s.id, dir, val); return; }
|
|
|
|
| 128 |
.org:focus{outline:none}
|
| 129 |
.org:focus-visible .shp{stroke-width:3.5}
|
| 130 |
.shp{transition:fill .4s ease-out,stroke .4s ease-out}
|
| 131 |
+
.clbl{font:600 13px var(--sans);fill:var(--ink)}
|
| 132 |
+
.cst{font:500 12.5px var(--sans);fill:var(--ink)}
|
| 133 |
.cst .arr{font-weight:700}
|
| 134 |
+
.lblg{cursor:pointer}
|
| 135 |
+
.lead{stroke:#1C1B18;stroke-opacity:.45;stroke-width:1}
|
| 136 |
+
.lead-dot{fill:#1C1B18}
|
| 137 |
#breath{transform-box:fill-box;transform-origin:center;animation:breathe 7s ease-in-out infinite alternate}
|
| 138 |
@keyframes breathe{from{transform:scale(1)}to{transform:scale(1.015)}}
|
| 139 |
+
.drift{animation:drift 11s ease-in-out infinite}
|
| 140 |
+
.drift.d1{animation-name:drift1;animation-duration:9s}
|
| 141 |
+
.drift.d2{animation-name:drift2;animation-duration:12s}
|
| 142 |
+
.drift.d3{animation-name:drift3;animation-duration:14s}
|
| 143 |
+
@keyframes drift1{0%,100%{transform:translate(0,0)}50%{transform:translate(3px,-2px)}}
|
| 144 |
+
@keyframes drift2{0%,100%{transform:translate(0,0)}50%{transform:translate(-2px,3px)}}
|
| 145 |
+
@keyframes drift3{0%,100%{transform:translate(0,0)}33%{transform:translate(2px,2px)}66%{transform:translate(-2px,1px)}}
|
| 146 |
+
body.calm #breath,body.calm .drift{animation:none}
|
| 147 |
body.calm .shp{transition:none}
|
| 148 |
+
@media (prefers-reduced-motion: reduce){#breath,.drift{animation:none}.shp{transition:none}.card{transition:none}}
|
| 149 |
|
| 150 |
/* System card */
|
| 151 |
.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)}
|
|
|
|
| 259 |
.controls{border-radius:28px;padding:12px}
|
| 260 |
.group.lines{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;max-width:100%}
|
| 261 |
.clbl,.cst .stt{display:none}
|
| 262 |
+
.cst{font-size:30px}
|
| 263 |
.story{min-height:420px;padding:18px}
|
| 264 |
.genes{grid-template-columns:1fr}
|
| 265 |
.twocol{grid-template-columns:1fr}
|
|
|
|
| 462 |
const motionOff = () => rmq.matches || state.paused;
|
| 463 |
|
| 464 |
/* ---------- The cell drawing ---------- */
|
| 465 |
+
/* ---- Cell drawing (round 3): organelles on an organic body; labels outside on leader lines ---- */
|
| 466 |
+
const CX = 300, CY = 190;
|
| 467 |
+
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)); }
|
| 468 |
+
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)]; }
|
| 469 |
+
function blobPath(rx, ry, k){
|
| 470 |
+
const n = 40, pts = [];
|
| 471 |
+
for (let i = 0; i < n; i++) pts.push(blobPt(i / n * Math.PI * 2, rx, ry, k));
|
|
|
|
| 472 |
const f = v => v.toFixed(1);
|
| 473 |
let d = `M${f(pts[0][0])} ${f(pts[0][1])}`;
|
| 474 |
for (let i = 0; i < n; i++){
|
|
|
|
| 477 |
}
|
| 478 |
return d + "Z";
|
| 479 |
}
|
| 480 |
+
const deg = a => a * Math.PI / 180;
|
| 481 |
+
const NUC = {x:262, y:192, r:66};
|
| 482 |
+
function arcPath(cx, cy, r, a0, a1, wave, n){
|
| 483 |
+
// an open wavy arc (used for the folded ribbons of the protein factories)
|
| 484 |
+
let d = "";
|
| 485 |
for (let i = 0; i <= n; i++){
|
| 486 |
+
const t = deg(a0 + (a1 - a0) * i / n), rr = r + wave * Math.sin(i / n * Math.PI * 7);
|
| 487 |
+
d += (i ? " L" : "M") + (cx + rr*Math.cos(t)).toFixed(1) + " " + (cy + rr*Math.sin(t)).toFixed(1);
|
| 488 |
}
|
| 489 |
+
return d;
|
| 490 |
+
}
|
| 491 |
+
function bandPath(cx, cy, r0, r1, a0, a1){
|
| 492 |
+
// a closed crescent band on the nucleus edge (message editing)
|
| 493 |
+
const p = (r, a) => `${(cx + r*Math.cos(deg(a))).toFixed(1)} ${(cy + r*Math.sin(deg(a))).toFixed(1)}`;
|
| 494 |
+
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`;
|
| 495 |
+
}
|
| 496 |
+
function bean(cx, cy, w, h, rot){
|
| 497 |
+
// one mitochondrion outline (a capsule with a slight waist), in page coordinates
|
| 498 |
+
const a = w/2, b = h/2, c = Math.cos(deg(rot)), sn = Math.sin(deg(rot));
|
| 499 |
+
const P = (x, y) => `${(cx + x*c - y*sn).toFixed(1)} ${(cy + x*sn + y*c).toFixed(1)}`;
|
| 500 |
+
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`;
|
| 501 |
+
return {d, t:`translate(${cx} ${cy}) rotate(${rot})`, w};
|
| 502 |
}
|
| 503 |
+
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`; }
|
| 504 |
+
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`; }
|
| 505 |
+
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"; }
|
| 506 |
+
|
| 507 |
+
const BODY = {rx:190, ry:135, k:1};
|
| 508 |
+
const MITO = [bean(388, 266, 60, 26, -20), bean(438, 228, 48, 22, 32), bean(340, 300, 46, 20, -6)];
|
| 509 |
+
const VESICLES = [[398,122,16],[424,110,10],[416,146,9],[376,102,8],[440,134,6]];
|
| 510 |
+
const DROPS = [[456,168,8],[470,190,6],[450,192,5.5]];
|
| 511 |
+
const RECEPTOR_ANGLES = [150, 168, 186, 204];
|
| 512 |
+
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]];
|
| 513 |
+
|
| 514 |
+
function cellSVG(p){
|
| 515 |
const S = 'stroke="#1C1B18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
|
| 516 |
+
const T = 'stroke="#1C1B18" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"';
|
| 517 |
+
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>`;
|
| 518 |
+
// Body: interior (rest colour) + membrane band (the reacting shape, two outline lines)
|
| 519 |
+
const outer = blobPath(BODY.rx, BODY.ry, 1), inner = blobPath(BODY.rx - 9, BODY.ry - 9, 1);
|
| 520 |
+
const halo = blobPath(BODY.rx + 22, BODY.ry + 20, 0.9);
|
| 521 |
+
// Protein factories: ribbons round the nucleus; the beads (ribosomes) are the reacting shape
|
| 522 |
+
const 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)];
|
| 523 |
+
// Signals: receptors on the membrane
|
| 524 |
+
const rec = RECEPTOR_ANGLES.map(a => {
|
| 525 |
+
const t = deg(a), [x, y] = blobPt(t, BODY.rx, BODY.ry, 1), ux = Math.cos(t), uy = Math.sin(t);
|
| 526 |
+
const sx = x + ux*12, sy = y + uy*12, px = -uy, py = ux;
|
| 527 |
+
return {stem:`M${(x-ux*2).toFixed(1)} ${(y-uy*2).toFixed(1)} L${sx.toFixed(1)} ${sy.toFixed(1)}`,
|
| 528 |
+
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`};
|
| 529 |
+
});
|
| 530 |
+
const ribo = RIBO_FREE.map(([x,y]) => `<circle cx="${x}" cy="${y}" r="1.9" fill="#1C1B18" fill-opacity=".5"/>`).join("");
|
| 531 |
+
const parts = [
|
| 532 |
+
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"/>`),
|
| 533 |
+
o("cell_skeleton", `<path d="${outer}" fill="#FFFFFF"/>
|
| 534 |
+
<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"/>
|
| 535 |
+
<g class="drift d3">${ribo}</g>
|
| 536 |
+
<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"/>`),
|
| 537 |
+
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("")}
|
| 538 |
+
<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"/>`),
|
| 539 |
+
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}/>
|
| 540 |
+
<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"/>
|
| 541 |
+
<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"/>
|
| 542 |
+
<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"/>`),
|
| 543 |
+
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}/>
|
| 544 |
+
<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"),
|
| 545 |
+
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"),
|
| 546 |
+
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}/>
|
| 547 |
+
<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"),
|
| 548 |
+
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"),
|
| 549 |
+
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"),
|
| 550 |
+
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}/>`),
|
| 551 |
+
];
|
| 552 |
+
// Labels outside the cell, joined by leader lines. Clicking a label opens its system too.
|
| 553 |
+
const L = [
|
| 554 |
+
["cell_skeleton", 18, 24, "start", blobPt(deg(222), BODY.rx, BODY.ry, 1), [96, 40]],
|
| 555 |
+
["protein_factory", 200, 24, "middle", [214, 118], [206, 48]],
|
| 556 |
+
["self_destruct", 360, 24, "middle", [346, 70], [346, 48]],
|
| 557 |
+
["trash_recycling", 512, 54, "start", [432, 104], [508, 58]],
|
| 558 |
+
["fuel_metabolism", 512, 150, "start", [476, 178], [508, 154]],
|
| 559 |
+
["power_plants", 512, 262, "start", [458, 234], [508, 266]],
|
| 560 |
+
["stress_alarm", 582, 350, "end", blobPt(deg(42), BODY.rx + 22, BODY.ry + 20, 0.9), [520, 340]],
|
| 561 |
+
["immune_signals", 18, 214, "start", blobPt(deg(186), BODY.rx + 14, BODY.ry + 14, 1), [80, 210]],
|
| 562 |
+
["cell_division", 18, 128, "start", [NUC.x - 50, NUC.y - 40], [86, 132]],
|
| 563 |
+
["message_editing", 18, 314, "start", [204, 252], [112, 312]],
|
| 564 |
+
];
|
| 565 |
+
const labels = L.map(([id, x, y, anc, tip, from]) => `<g class="lblg" data-sys="${id}">
|
| 566 |
+
<path class="lead" d="M${from[0].toFixed(1)} ${from[1].toFixed(1)} L${tip[0].toFixed(1)} ${tip[1].toFixed(1)}" fill="none"/>
|
| 567 |
+
<circle class="lead-dot" cx="${tip[0].toFixed(1)}" cy="${tip[1].toFixed(1)}" r="2.6"/>
|
| 568 |
+
<text class="clbl" x="${x}" y="${y}" text-anchor="${anc}">${SYS[id]}</text>
|
| 569 |
+
<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("");
|
| 570 |
+
return `<svg viewBox="0 0 600 370" role="group" aria-label="The cell" xmlns="http://www.w3.org/2000/svg">
|
| 571 |
+
<g id="${p}breath">${parts.join("")}</g>
|
| 572 |
+
<g class="labels" aria-hidden="true">${labels}</g></svg>`;
|
| 573 |
}
|
| 574 |
+
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"};
|
| 575 |
function colorsFor(dir, strong, kind){
|
| 576 |
if (kind === "stroke") return dir === "up" ? "#3F6B4C" : "#8A4F2A";
|
|
|
|
| 577 |
if (dir === "up") return strong ? "#9CC2A1" : "#C5DDC7";
|
| 578 |
return strong ? "#F5C3A5" : "#F8D6C1";
|
| 579 |
}
|
|
|
|
| 614 |
const finalScale = dir === "up" ? 1.03 : 0.97;
|
| 615 |
const apply = () => {
|
| 616 |
if (sh.dataset.kind === "stroke") sh.setAttribute("stroke", colorsFor(dir, strong, "stroke"));
|
| 617 |
+
else sh.setAttribute("fill", colorsFor(dir, strong, "fill"));
|
| 618 |
g.style.transform = s.id === "cell_skeleton" || s.id === "stress_alarm" ? "" : `scale(${finalScale})`;
|
| 619 |
};
|
| 620 |
if (calm){ apply(); setStatus(p, s.id, dir, val); return; }
|