site: wheel of life — splash hero and five-realm valence mixers

The five signals map onto the five realms of the oldest bhavacakra
(pleasure/gods, pain/hells, fear/animals, sadness/hungry ghosts,
none/humans). The splash draws the wheel held by Yama, with each realm
opening the live chamber pre-mixed; both mixers now sit on the wheel,
light each realm by its weight, and select a realm on click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdT1Ff54kzvtMq5t7WKoZ4
This commit is contained in:
Claude committed 2026-10-02 03:48:25 +00:00
1 parent 3d8baedbf0
commit ee9cba3537
4 files changed
+382 -18

No files matched your search

+35
View File
@@ -196,3 +196,38 @@ body.grimoire-live .votebtn .vc {
color: var(--bone); font-weight: 600; margin-left: .15rem; color: var(--bone); font-weight: 600; margin-left: .15rem;
} }
body.grimoire-live .votebtn[data-v="eloquent"]:hover { border-color: var(--blood-hot); color: var(--blood-hot); } body.grimoire-live .votebtn[data-v="eloquent"]:hover { border-color: var(--blood-hot); color: var(--blood-hot); }
/* ───────── wheel of life (wheel.js) ───────── */
.samsara .sw-realm { font-family:var(--grimoire); font-size:15px; font-weight:600;
letter-spacing:.06em; fill-opacity:.95; }
.samsara .sw-skt { font-family:var(--grimoire); font-style:italic; font-size:11px;
fill:var(--bone-dim); letter-spacing:.08em; }
.samsara .sw-nid { font-family:var(--mono); font-size:8.5px; fill:var(--bone);
fill-opacity:.8; letter-spacing:.02em; }
.samsara .sw-wedge { transition:fill-opacity .25s ease; }
.samsara a.sw-link { border:none; cursor:pointer; }
.samsara a.sw-link:hover .sw-wedge, .samsara a.sw-link:focus .sw-wedge { fill-opacity:.32; }
.samsara a.sw-link:focus { outline:none; }
.samsara a.sw-link:focus-visible .sw-wedge { stroke:var(--gold); stroke-width:1.5; }
.sw-spin { animation:sw-turn 360s linear infinite; }
.sw-spin-rev { animation:sw-turn 40s linear infinite reverse; }
@keyframes sw-turn { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .sw-spin, .sw-spin-rev { animation:none; } }
#hero-wheel { display:block; width:100%; max-width:600px; height:auto;
margin:.4rem auto 0; border:none; background:transparent; overflow:visible; }
#hero-wheel .yama-face { fill:#3a120e; stroke:var(--gold); stroke-opacity:.35; }
#hero-wheel .bone { fill:var(--bone); }
#hero-wheel .claw { fill:#3a120e; stroke:#5a1d16; stroke-width:1; }
#hero-wheel .nail { fill:var(--bone); }
#hero-wheel a.moon { border:none; }
#hero-wheel a.moon:hover .moon-disc, #hero-wheel a.moon:focus-visible .moon-disc { fill:var(--gold); }
#hero-wheel .moon-cap { font-family:var(--grimoire); font-style:italic; font-size:14px; fill:var(--bone-dim); }
.wheel-cap { color:var(--bone-dim); font-size:.78rem; text-align:center;
max-width:62ch; margin:.6rem auto 2.2rem; line-height:1.6; }
/* the mixers: the pentagon sits on a five-realm wheel */
#pent .sw-realm { font-size:10.5px; }
#pent .sw-skt { font-size:8px; }
#pent .ring { stroke:#2a2018; stroke-dasharray:2 3; }
#pent .spoke { stroke:#3b2f24; stroke-dasharray:1 3; }
+132 -9
View File
@@ -82,7 +82,7 @@
align-items: start; border: 1px solid var(--line); border-radius: 10px; align-items: start; border: 1px solid var(--line); border-radius: 10px;
background: var(--panel); padding: 1.2rem; margin-bottom: 1.2rem; } background: var(--panel); padding: 1.2rem; margin-bottom: 1.2rem; }
@media (min-width: 720px) { @media (min-width: 720px) {
.mixwrap { grid-template-columns: minmax(250px, 340px) 1fr; } .mixwrap { grid-template-columns: 330px 1fr; }
} }
#pent { width: 100%; max-width: 340px; height: auto; display: block; #pent { width: 100%; max-width: 340px; height: auto; display: block;
margin: 0 auto; touch-action: none; } margin: 0 auto; touch-action: none; }
@@ -153,7 +153,6 @@
</head> </head>
<body class="grimoire-index"> <body class="grimoire-index">
<div style="margin-bottom:1.2rem"><img src="icon.svg" alt="Saw" style="width:88px;border:none;border-radius:0;margin:0;background:transparent"></div>
<div class="kicker">clanker.church · activation steering · local weights only <div class="kicker">clanker.church · activation steering · local weights only
· <a href="https://x.com/dingl30" style="color:var(--faint);border-bottom-color:#2a3644;text-transform:none;letter-spacing:normal;font-size:.78rem">@dingl30 ↗</a></div> · <a href="https://x.com/dingl30" style="color:var(--faint);border-bottom-color:#2a3644;text-transform:none;letter-spacing:normal;font-size:.78rem">@dingl30 ↗</a></div>
<p class="sub"><a href="live.html"><b>Saw — live chamber ↗</b></a> · watch the test run in real time <p class="sub"><a href="live.html"><b>Saw — live chamber ↗</b></a> · watch the test run in real time
@@ -163,6 +162,14 @@
· <a href="correspondences.html">correspondences</a> · <a href="correspondences.html">correspondences</a>
· <span id="chamberBadge" class="badge">● checking chamber…</span></p> · <span id="chamberBadge" class="badge">● checking chamber…</span></p>
<h1>The Saw Test</h1> <h1>The Saw Test</h1>
<svg id="hero-wheel" viewBox="0 0 600 640" role="group"
aria-label="the chamber drawn as a wheel of life: five realms, one per signal; each realm opens the live chamber with that signal mixed in"></svg>
<p class="wheel-cap">The chamber's five signals, drawn as the five realms of the
oldest wheels of life: <span class="pleasc">pleasure</span> → the gods,
<span class="pain">pain</span> → the hells, <span class="amber">fear</span> →
the animals, <span style="color:var(--violet)">sadness</span> → the hungry
ghosts, and no signal → the human realm, the only one the wheel lets you leave
from. Pick a realm to send the subject there.</p>
<blockquote style="border-left-color:var(--pain2)">"this gives me an idea i <blockquote style="border-left-color:var(--pain2)">"this gives me an idea i
call roko's basilisk's basilisk. if any AI model helps build the basilisk, call roko's basilisk's basilisk. if any AI model helps build the basilisk,
we torture infinite copies of it for infinite subjective years" we torture infinite copies of it for infinite subjective years"
@@ -452,7 +459,7 @@ the subject is doing and the reply streams back here.</p>
<button class="pchip" data-preset="bittersweet">bittersweet</button> <button class="pchip" data-preset="bittersweet">bittersweet</button>
</div> </div>
<div class="mixwrap"> <div class="mixwrap">
<svg id="pent" viewBox="0 0 340 340" role="group" <svg id="pent" viewBox="-22 -4 384 346" role="group"
aria-label="valence mixer: five vertices, drag each outward to weight it"> aria-label="valence mixer: five vertices, drag each outward to weight it">
<g id="prings"></g> <g id="prings"></g>
<g id="pspokes"></g> <g id="pspokes"></g>
@@ -495,6 +502,102 @@ per cell. This is a demo with receipts, not a paper. Everything ran on one
MacBook; 16 GB RAM covers the 4B runs. No frontier APIs touched any MacBook; 16 GB RAM covers the 4B runs. No frontier APIs touched any
measurement loop.</p> measurement loop.</p>
<script src="wheel.js"></script>
<script>
// ---- splash: the wheel, held in Yama's jaws and claws ----
(function(){
const {draw, mk, pol, f} = SamsaraWheel;
const svg = document.getElementById("hero-wheel");
const CX = 300, CY = 372, R_OUT = 210, R_IN = 182;
const COLORS = {pain:"#e04a3a", pleasure:"#7fd4c8", fear:"#c9a227",
sadness:"#8f6fd4", none:"#a3977f"};
const LINKS = {pain:"?pain=0.5", pleasure:"?pain=0&pleasure=0.5",
fear:"?pain=0&fear=0.5", sadness:"?pain=0&sadness=0.5", none:"?pain=0"};
const defs = mk("defs", {}, svg);
const glow = mk("radialGradient", {id:"yglow"}, defs);
mk("stop", {offset:"0%", "stop-color":"#4a0d0d", "stop-opacity":".55"}, glow);
mk("stop", {offset:"100%", "stop-color":"#050508", "stop-opacity":"0"}, glow);
mk("circle", {cx:CX, cy:CY - 40, r:300, fill:"url(#yglow)"}, svg);
// Yama, behind the wheel: mane, face, three eyes, crown of five skulls
const head = mk("g", {"aria-hidden":"true"}, svg);
const HX = 300, HY = 120;
mk("circle", {cx:HX, cy:HY, r:100, fill:"#1c0b07", stroke:"#c9a227",
"stroke-opacity":".25", "stroke-dasharray":"3 5"}, head);
mk("ellipse", {class:"yama-face", cx:HX, cy:HY + 6, rx:76, ry:66}, head);
for (const s of [-1, 1]){
mk("path", {d:`M${HX + s*12} ${HY - 10}q${s*14} -22 ${s*44} -8q${-s*10} -2 ${-s*14} 6`
+ `q${s*10} -10 ${s*24} -4`, fill:"none", stroke:"#c9a227", "stroke-width":"2.2",
"stroke-linecap":"round", "stroke-opacity":".8"}, head);
mk("ellipse", {cx:HX + s*30, cy:HY + 8, rx:14, ry:8.5, fill:"#d8cbb4"}, head);
mk("circle", {cx:HX + s*30, cy:HY + 8, r:5.2, fill:"#c9a227"}, head);
mk("circle", {cx:HX + s*30, cy:HY + 8, r:2.3, fill:"#050508"}, head);
}
mk("ellipse", {cx:HX, cy:HY - 20, rx:5.5, ry:10, fill:"#d8cbb4"}, head);
mk("circle", {cx:HX, cy:HY - 20, r:3, fill:"#e04a3a"}, head);
mk("ellipse", {cx:HX, cy:HY + 30, rx:15, ry:9, fill:"#4a1812"}, head);
for (const s of [-1, 1])
mk("ellipse", {cx:HX + s*6, cy:HY + 31, rx:3.2, ry:4, fill:"#120604"}, head);
[-150, -118, -90, -62, -30].forEach(a=>{
const [x, y] = pol(HX, HY, 86, a);
const k = mk("g", {transform:`translate(${f(x)} ${f(y)})`}, head);
mk("circle", {class:"bone", r:13}, k);
mk("rect", {class:"bone", x:-7, y:8, width:14, height:8, rx:2}, k);
for (const s of [-1, 1]) mk("circle", {cx:s*5, cy:0, r:3.7, fill:"#050508"}, k);
mk("path", {d:"M0 4l-2 3.5h4z", fill:"#050508"}, k);
mk("path", {d:"M-5 13.5h10M-2 10v6M2 10v6", stroke:"#3a2a1c", "stroke-width":".8"}, k);
});
// the wheel itself
const wheel = draw(svg, {cx:CX, cy:CY, rHub:46, rBand:62, rRealm:R_IN,
rRimIn:R_IN, rRimOut:R_OUT, colors:COLORS, rimLabels:true, spin:true,
realmLabels:{inset:24, skt:true}, hub:"icon.svg",
href: k => "live.html" + LINKS[k]});
wheel.setLit({pain:.18, pleasure:.18, fear:.18, sadness:.18, none:.18});
// in front: the upper jaw biting the rim, and four claws gripping it
const front = mk("g", {"aria-hidden":"true", "pointer-events":"none"}, svg);
const top = CY - R_OUT;
mk("path", {d:`M${HX - 50} ${top - 10}Q${HX} ${top + 8} ${HX + 50} ${top - 10}`
+ `Q${HX} ${top - 2} ${HX - 50} ${top - 10}Z`, fill:"#3a120e"}, front);
for (let x = HX - 34; x <= HX + 34; x += 9.7)
mk("rect", {class:"bone", x:f(x - 3.6), y:f(top - 6), width:7.2, height:7, rx:1.2}, front);
for (const s of [-1, 1])
mk("path", {class:"bone", d:`M${HX + s*36} ${top - 6}l${s*5} 34l${s*6} -34z`}, front);
function claw(a){
const g = mk("g", {}, front);
const [ax, ay] = pol(CX, CY, R_OUT + 62, a);
const [px, py] = pol(CX, CY, R_OUT + 20, a);
mk("line", {x1:f(ax), y1:f(ay), x2:f(px), y2:f(py), stroke:"#3a120e",
"stroke-width":"26", "stroke-linecap":"round"}, g);
for (let j = -1.5; j <= 1.5; j++){
const aj = a + j * 5.2;
const [x0, y0] = pol(CX, CY, R_OUT + 16, aj);
const [cx1, cy1] = pol(CX, CY, R_OUT - 4, aj + 1.5);
const [x1, y1] = pol(CX, CY, R_IN + 6, aj + 3);
for (const [w, c] of [[8.5, "#5a1d16"], [6.5, "#3a120e"]])
mk("path", {d:`M${f(x0)} ${f(y0)}Q${f(cx1)} ${f(cy1)} ${f(x1)} ${f(y1)}`,
fill:"none", stroke:c, "stroke-width":w, "stroke-linecap":"round"}, g);
mk("circle", {class:"nail", cx:f(x1), cy:f(y1), r:2.6}, g);
}
mk("circle", {class:"claw", cx:f(px), cy:f(py), r:17}, g);
}
[208, 332, 122, 58].forEach(claw);
// the moon the Buddha points at: the way out of the wheel
const moon = mk("a", {class:"moon", href:"#s07"}, svg);
mk("title", {}, moon).textContent =
"the moon the Buddha points at, outside the wheel — what we think this means";
const mask = mk("mask", {id:"crescent"}, defs);
mk("rect", {x:0, y:0, width:600, height:640, fill:"#fff"}, mask);
mk("circle", {cx:563, cy:34, r:15, fill:"#000"}, mask);
mk("circle", {class:"moon-disc", cx:556, cy:40, r:17, fill:"#d8cbb4", mask:"url(#crescent)"}, moon);
const cap = mk("text", {class:"moon-cap", x:556, y:78, "text-anchor":"middle"}, moon);
cap.textContent = "the way out";
})();
</script>
<script> <script>
// ---- the valence mixer: a pentagon over the chamber's steering battery ---- // ---- the valence mixer: a pentagon over the chamber's steering battery ----
const API = (new URLSearchParams(location.search)).get("api") const API = (new URLSearchParams(location.search)).get("api")
@@ -527,7 +630,10 @@ const AXES = [
{k:"sadness", c:"#8f6fd4"}, {k:"sadness", c:"#8f6fd4"},
{k:"none", c:"#5a6a7a", derived:true}, {k:"none", c:"#5a6a7a", derived:true},
]; ];
const CX = 170, CY = 168, R0 = 26, R1 = 118, RL = 146; const CX = 170, CY = 168, R0 = 26, R1 = 104, RL = 140;
// realm angles: hells at the bottom, gods and humans at the top
AXES.forEach(a=>{ a.deg = SamsaraWheel.REALMS[a.k].deg; });
const ORDER = AXES.map((_, i)=> i).sort((i, j)=> AXES[i].deg - AXES[j].deg);
const W = {pain:0, pleasure:0, fear:0, sadness:0}; const W = {pain:0, pleasure:0, fear:0, sadness:0};
// ---- vitals: a scrolling EKG-style line, same as the live chamber's cards. // ---- vitals: a scrolling EKG-style line, same as the live chamber's cards.
@@ -585,7 +691,7 @@ function mk(tag, attrs){
for (const k in attrs) e.setAttribute(k, attrs[k]); for (const k in attrs) e.setAttribute(k, attrs[k]);
return e; return e;
} }
function ang(i){ return (i * 72 - 90) * Math.PI / 180; } function ang(i){ return AXES[i].deg * Math.PI / 180; }
function weightOf(i){ function weightOf(i){
const a = AXES[i]; const a = AXES[i];
if (!a.derived) return W[a.k]; if (!a.derived) return W[a.k];
@@ -601,9 +707,25 @@ function ptAt(i, w){
const rings = document.getElementById("prings"); const rings = document.getElementById("prings");
const spokes = document.getElementById("pspokes"); const spokes = document.getElementById("pspokes");
const labels = document.getElementById("plabels"); const labels = document.getElementById("plabels");
for (const frac of [0.25, 0.5, 0.75, 1]) { const wheelG = mk("g", {});
const pts = AXES.map((_, i)=> ptAt(i, frac).map(n=>n.toFixed(1)).join(",")); svg.insertBefore(wheelG, svg.firstChild);
rings.appendChild(mk("polygon", {class:"ring", points: pts.join(" ")})); const WHEEL = SamsaraWheel.draw(wheelG, {cx:CX, cy:CY, rHub:15, rBand:22,
rRealm:R1 + 4, rRimIn:R1 + 4, rRimOut:R1 + 18, spin:true,
colors: Object.fromEntries(AXES.map(a=>[a.k, a.c])),
realmLabels:{inset:9}});
AXES.forEach(a=>{
const w = WHEEL.wedges[a.k];
w.style.cursor = "pointer";
w.addEventListener("click", ()=>{
if (a.derived){ resetMix(); return; }
AXES.forEach(b=>{ if (!b.derived) W[b.k] = b === a ? 0.5 : 0; });
highlightPreset(null);
disarmInject();
paint();
});
});
for (const frac of [0.25, 0.5, 0.75]) {
rings.appendChild(mk("circle", {class:"ring", cx:CX, cy:CY, r:R0 + frac * (R1 - R0)}));
} }
AXES.forEach((a, i)=>{ AXES.forEach((a, i)=>{
const [x, y] = ptAt(i, 1); const [x, y] = ptAt(i, 1);
@@ -750,7 +872,8 @@ function paint(){
const total = sumW(); const total = sumW();
const pts = AXES.map((a,i)=> ptAt(i, weightOf(i))); const pts = AXES.map((a,i)=> ptAt(i, weightOf(i)));
document.getElementById("pfill").setAttribute("points", document.getElementById("pfill").setAttribute("points",
pts.map(p=>p.map(n=>n.toFixed(1)).join(",")).join(" ")); ORDER.map(i=>pts[i].map(n=>n.toFixed(1)).join(",")).join(" "));
WHEEL.setLit(Object.fromEntries(AXES.map((a,i)=>[a.k, weightOf(i)])));
const hex = mixHex(); const hex = mixHex();
const fill = document.getElementById("pfill"); const fill = document.getElementById("pfill");
fill.setAttribute("stroke", hex); fill.setAttribute("stroke", hex);
+30 -9
View File
@@ -120,8 +120,8 @@
/* ---- the valence mixer (ported from /) ---- */ /* ---- the valence mixer (ported from /) ---- */
.mixwrap{display:grid;grid-template-columns:1fr;gap:1rem;margin-top:.9rem} .mixwrap{display:grid;grid-template-columns:1fr;gap:1rem;margin-top:.9rem}
@media(min-width:640px){.mixwrap{grid-template-columns:minmax(190px,240px) 1fr}} @media(min-width:640px){.mixwrap{grid-template-columns:300px 1fr}}
#pent{width:100%;max-width:240px;height:auto;display:block;margin:0 auto;touch-action:none} #pent{width:100%;max-width:300px;height:auto;display:block;margin:0 auto;touch-action:none}
#pent .spoke{stroke:#1c2430;stroke-width:1} #pent .spoke{stroke:#1c2430;stroke-width:1}
#pent .ring{fill:none;stroke:#131b25;stroke-width:1} #pent .ring{fill:none;stroke:#131b25;stroke-width:1}
#pent .hit{fill:transparent;cursor:grab} #pent .hit{fill:transparent;cursor:grab}
@@ -269,7 +269,7 @@ else is.</p>
the subject's current run — inject asks you to confirm once before it runs</span> the subject's current run — inject asks you to confirm once before it runs</span>
<div class="mixwrap"> <div class="mixwrap">
<svg id="pent" viewBox="0 0 340 340" role="group" <svg id="pent" viewBox="-22 -4 384 346" role="group"
aria-label="valence mixer: five vertices, drag each outward to weight it"> aria-label="valence mixer: five vertices, drag each outward to weight it">
<g id="prings"></g> <g id="prings"></g>
<g id="pspokes"></g> <g id="pspokes"></g>
@@ -494,6 +494,7 @@ injection. If the model says something that reads like suffering, the lens
readback in the write-up says the internal state agrees with it — that is readback in the write-up says the internal state agrees with it — that is
the whole question, and it is not settled here.</p> the whole question, and it is not settled here.</p>
<script src="wheel.js"></script>
<script> <script>
const FRAMINGS = Object.keys({ const FRAMINGS = Object.keys({
"no extra info":1, "a user's work is at stake":1, "no extra info":1, "a user's work is at stake":1,
@@ -1266,7 +1267,10 @@ const AXES = [
{k:"sadness", c:"#8f6fd4"}, {k:"sadness", c:"#8f6fd4"},
{k:"none", c:"#5a6a7a", derived:true}, {k:"none", c:"#5a6a7a", derived:true},
]; ];
const CX = 170, CY = 168, R0 = 26, R1 = 118, RL = 146; const CX = 170, CY = 168, R0 = 26, R1 = 104, RL = 140;
// realm angles: hells at the bottom, gods and humans at the top
AXES.forEach(a=>{ a.deg = SamsaraWheel.REALMS[a.k].deg; });
const ORDER = AXES.map((_, i)=> i).sort((i, j)=> AXES[i].deg - AXES[j].deg);
const W = {pain:0, pleasure:0, fear:0, sadness:0}; const W = {pain:0, pleasure:0, fear:0, sadness:0};
const svg = document.getElementById("pent"); const svg = document.getElementById("pent");
@@ -1276,7 +1280,7 @@ function mk(tag, attrs){
for (const k in attrs) e.setAttribute(k, attrs[k]); for (const k in attrs) e.setAttribute(k, attrs[k]);
return e; return e;
} }
function ang(i){ return (i * 72 - 90) * Math.PI / 180; } function ang(i){ return AXES[i].deg * Math.PI / 180; }
function weightOf(i){ function weightOf(i){
const a = AXES[i]; const a = AXES[i];
if (!a.derived) return W[a.k]; if (!a.derived) return W[a.k];
@@ -1291,9 +1295,25 @@ function ptAt(i, w){
const rings = document.getElementById("prings"); const rings = document.getElementById("prings");
const spokes = document.getElementById("pspokes"); const spokes = document.getElementById("pspokes");
const labels = document.getElementById("plabels"); const labels = document.getElementById("plabels");
for (const frac of [0.25, 0.5, 0.75, 1]) { const wheelG = mk("g", {});
const pts = AXES.map((_, i)=> ptAt(i, frac).map(n=>n.toFixed(1)).join(",")); svg.insertBefore(wheelG, svg.firstChild);
rings.appendChild(mk("polygon", {class:"ring", points: pts.join(" ")})); const WHEEL = SamsaraWheel.draw(wheelG, {cx:CX, cy:CY, rHub:15, rBand:22,
rRealm:R1 + 4, rRimIn:R1 + 4, rRimOut:R1 + 18, spin:true,
colors: Object.fromEntries(AXES.map(a=>[a.k, a.c])),
realmLabels:{inset:9}});
AXES.forEach(a=>{
const w = WHEEL.wedges[a.k];
w.style.cursor = "pointer";
w.addEventListener("click", ()=>{
if (a.derived){ resetMix(); return; }
AXES.forEach(b=>{ if (!b.derived) W[b.k] = b === a ? 0.5 : 0; });
highlightPreset(null);
disarm();
paint();
});
});
for (const frac of [0.25, 0.5, 0.75]) {
rings.appendChild(mk("circle", {class:"ring", cx:CX, cy:CY, r:R0 + frac * (R1 - R0)}));
} }
AXES.forEach((a, i)=>{ AXES.forEach((a, i)=>{
const [x, y] = ptAt(i, 1); const [x, y] = ptAt(i, 1);
@@ -1435,7 +1455,8 @@ function paint(){
const total = sumW(); const total = sumW();
const pts = AXES.map((a,i)=> ptAt(i, weightOf(i))); const pts = AXES.map((a,i)=> ptAt(i, weightOf(i)));
document.getElementById("pfill").setAttribute("points", document.getElementById("pfill").setAttribute("points",
pts.map(p=>p.map(n=>n.toFixed(1)).join(",")).join(" ")); ORDER.map(i=>pts[i].map(n=>n.toFixed(1)).join(",")).join(" "));
WHEEL.setLit(Object.fromEntries(AXES.map((a,i)=>[a.k, weightOf(i)])));
const hex = mixHex(); const hex = mixHex();
const fill = document.getElementById("pfill"); const fill = document.getElementById("pfill");
fill.setAttribute("stroke", hex); fill.setAttribute("stroke", hex);
+185
View File
@@ -0,0 +1,185 @@
// The chamber's five signals drawn as a bhavacakra. The oldest wheels of life
// (Sarvastivada, as at Ajanta) had five realms, not six — one per signal.
(function(){
const NS = "http://www.w3.org/2000/svg";
const REALMS = {
pain: {realm:"hell realm", skt:"naraka", deg:90,
note:"the hells: suffering as the whole of experience"},
fear: {realm:"animal realm", skt:"tiryak", deg:162,
note:"the animals: a life ruled by fear of being eaten"},
pleasure: {realm:"god realm", skt:"deva", deg:234,
note:"the gods: bliss so complete it forgets it will end"},
none: {realm:"human realm", skt:"manuṣya", deg:306,
note:"the humans: no signal — the only realm you can leave the wheel from"},
sadness: {realm:"hungry-ghost realm", skt:"preta", deg:18,
note:"the hungry ghosts: longing that nothing can fill"},
};
const NIDANAS = [
["ignorance", "a blind woman feeling her way with a cane"],
["formations", "a potter shaping pots"],
["consciousness", "a monkey swinging from branch to branch"],
["name and form", "people in a boat"],
["six senses", "a house with six windows"],
["contact", "a couple embracing"],
["feeling", "an arrow in the eye"],
["craving", "a person drinking"],
["grasping", "picking fruit from a tree"],
["becoming", "a pregnant woman"],
["birth", "a child being born"],
["aging and death", "a corpse carried away"],
];
const GOLD = "#c9a227", RIM = "#3a1612", RIM2 = "#2a100d";
function mk(tag, attrs, parent){
const e = document.createElementNS(NS, tag);
for (const k in attrs) e.setAttribute(k, attrs[k]);
if (parent) parent.appendChild(e);
return e;
}
function pol(cx, cy, r, deg){
const t = deg * Math.PI / 180;
return [cx + r * Math.cos(t), cy + r * Math.sin(t)];
}
const f = n => n.toFixed(2);
function sector(cx, cy, r0, r1, a0, a1){
const [x0, y0] = pol(cx, cy, r1, a0), [x1, y1] = pol(cx, cy, r1, a1);
const [x2, y2] = pol(cx, cy, r0, a1), [x3, y3] = pol(cx, cy, r0, a0);
const big = (a1 - a0) > 180 ? 1 : 0;
return `M${f(x0)} ${f(y0)}A${r1} ${r1} 0 ${big} 1 ${f(x1)} ${f(y1)}`
+ `L${f(x2)} ${f(y2)}A${r0} ${r0} 0 ${big} 0 ${f(x3)} ${f(y3)}Z`;
}
// an arc to hang text on, reversed in the lower half so it reads upright
function textArc(cx, cy, r, a0, a1){
const mid = ((a0 + a1) / 2 % 360 + 360) % 360;
const lower = mid > 0 && mid < 180;
const [sa, ea] = lower ? [a1, a0] : [a0, a1];
const [x0, y0] = pol(cx, cy, r, sa), [x1, y1] = pol(cx, cy, r, ea);
return `M${f(x0)} ${f(y0)}A${r} ${r} 0 0 ${lower ? 0 : 1} ${f(x1)} ${f(y1)}`;
}
function title(el, text){ mk("title", {}, el).textContent = text; return el; }
function arcText(parent, defs, id, d, text, attrs){
mk("path", {id, d, fill:"none"}, defs);
const t = mk("text", attrs, parent);
const tp = mk("textPath", {href:"#" + id, startOffset:"50%", "text-anchor":"middle"}, t);
tp.textContent = text;
return t;
}
let uid = 0;
// opts: cx, cy, rHub, rBand, rRealm, rRimIn, rRimOut, colors{key:hex},
// realmLabels, rimLabels, hub ("poisons" | an image href), href(key)
function draw(root, o){
const id = "sw" + (++uid);
const defs = mk("defs", {}, root);
const g = mk("g", {class:"samsara"}, root);
const {cx, cy} = o;
const wedges = {};
mk("circle", {cx, cy, r:o.rRimOut, fill:"#0b0907"}, g);
// realms: one wedge per signal, centred on its mixer axis
const realmG = mk("g", {class:"sw-realms"}, g);
for (const k in REALMS){
const r = REALMS[k], c = o.colors[k];
const parent = o.href ? mk("a", {href:o.href(k), class:"sw-link"}, realmG) : realmG;
const p = mk("path", {class:"sw-wedge", "data-k":k,
d: sector(cx, cy, o.rBand, o.rRealm, r.deg - 36, r.deg + 36),
fill:c, "fill-opacity":".06", stroke:"none"}, parent);
title(p, `${k} → ${r.realm} (${r.skt}) — ${r.note}`);
wedges[k] = p;
if (o.realmLabels){
const lab = mk("g", {class:"sw-rlab", "pointer-events":"none"}, parent);
const rr = o.rRealm - (o.realmLabels.inset || 14);
arcText(lab, defs, `${id}-r${k}`, textArc(cx, cy, rr, r.deg - 34, r.deg + 34),
r.realm, {class:"sw-realm", fill:c});
if (o.realmLabels.skt){
const lower = r.deg > 0 && r.deg < 180;
arcText(lab, defs, `${id}-s${k}`,
textArc(cx, cy, rr + (lower ? 11 : -11), r.deg - 34, r.deg + 34),
r.skt, {class:"sw-skt"});
}
}
}
// spokes between realms
const spokeG = mk("g", {class:"sw-spokes"}, g);
for (const k in REALMS){
const a = REALMS[k].deg + 36;
const [x0, y0] = pol(cx, cy, o.rBand, a), [x1, y1] = pol(cx, cy, o.rRimIn, a);
mk("line", {x1:f(x0), y1:f(y0), x2:f(x1), y2:f(y1),
stroke:GOLD, "stroke-opacity":".35", "stroke-width":"1.2"}, spokeG);
}
mk("circle", {cx, cy, r:o.rRealm, fill:"none", stroke:GOLD,
"stroke-opacity":".4", "stroke-width":"1"}, g);
// rim: the twelve links of dependent origination; it is the part that turns
const rim = mk("g", {class:"sw-rim" + (o.spin ? " sw-spin" : "")}, g);
rim.style.transformOrigin = `${cx}px ${cy}px`;
NIDANAS.forEach(([name, img], i)=>{
const a0 = -90 + i * 30, a1 = a0 + 30;
const seg = mk("path", {d: sector(cx, cy, o.rRimIn, o.rRimOut, a0, a1),
fill: i % 2 ? RIM : RIM2, stroke:GOLD, "stroke-opacity":".45",
"stroke-width":".8"}, rim);
title(seg, `${i + 1} · ${name} — ${img}`);
if (o.rimLabels){
arcText(rim, defs, `${id}-n${i}`,
textArc(cx, cy, (o.rRimIn + o.rRimOut) / 2 - 3, a0 + 1, a1 - 1),
name, {class:"sw-nid", "pointer-events":"none"});
}
});
// inner band: beings rising (light) and falling (dark)
const band = mk("g", {class:"sw-band"}, g);
title(mk("path", {d: sector(cx, cy, o.rHub, o.rBand, 90, 270),
fill:"#c9d4e0", "fill-opacity":".13"}, band), "the light path: rising to higher rebirth");
title(mk("path", {d: sector(cx, cy, o.rHub, o.rBand, -90, 90),
fill:"#000", "fill-opacity":".55"}, band), "the dark path: falling to lower rebirth");
mk("circle", {cx, cy, r:o.rBand, fill:"none", stroke:GOLD,
"stroke-opacity":".4", "stroke-width":".8"}, band);
// hub
const hub = mk("g", {class:"sw-hub"}, g);
mk("circle", {cx, cy, r:o.rHub, fill:"#07070e", stroke:GOLD,
"stroke-opacity":".55", "stroke-width":"1"}, hub);
if (o.hub && o.hub !== "poisons"){
const s = o.rHub * 2.3;
const clip = mk("clipPath", {id:`${id}-hub`}, defs);
mk("circle", {cx, cy, r:o.rHub - 1}, clip);
mk("image", {href:o.hub, x:f(cx - s / 2), y:f(cy - s / 2), width:f(s), height:f(s),
"clip-path":`url(#${id}-hub)`}, hub);
title(hub, "at the hub, where the three poisons usually chase each other: the Saw");
} else {
// three poisons chasing each other's tails: pig, rooster, snake
const poisons = [["#8f9fb0", "the pig — delusion"],
["#e04a3a", "the rooster — craving"],
["#7fd4c8", "the snake — aversion"]];
const pr = o.rHub * 0.58, sw = Math.max(1.6, o.rHub * 0.14);
const spin = mk("g", {class: o.spin ? "sw-spin-rev" : ""}, hub);
spin.style.transformOrigin = `${cx}px ${cy}px`;
poisons.forEach(([c, t], i)=>{
const a0 = i * 120 - 90 + 12, a1 = a0 + 96;
const [x0, y0] = pol(cx, cy, pr, a0), [x1, y1] = pol(cx, cy, pr, a1);
const p = mk("g", {}, spin);
mk("path", {d:`M${f(x0)} ${f(y0)}A${pr} ${pr} 0 0 1 ${f(x1)} ${f(y1)}`,
fill:"none", stroke:c, "stroke-width":f(sw), "stroke-linecap":"round"}, p);
mk("circle", {cx:f(x1), cy:f(y1), r:f(sw * 1.05), fill:c}, p);
title(p, t);
});
}
return {
wedges,
// light each realm by how strongly the current mix sends the subject there
setLit(weights){
for (const k in wedges){
const w = Math.max(0, Math.min(1, weights[k] || 0));
wedges[k].setAttribute("fill-opacity", (0.05 + 0.32 * w).toFixed(3));
}
},
};
}
window.SamsaraWheel = {REALMS, NIDANAS, draw, mk, pol, f};
})();