birth: Pulsing Nodal Webwork

This commit is contained in:
motd_admin 2026-04-25 17:47:18 +00:00
parent 3525dc4cd5
commit 7edbc94899

225
index.html Normal file
View file

@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neurameba · motd.social</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #0a0a0a;
overflow: hidden;
font-family: 'Courier New', monospace;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 20px;
right: 20px;
color: #444;
font-size: 11px;
z-index: 100;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div id="attribution">neurameba · motd.social</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// Parameters derived from abstract specs
const params = {
motion: 0.509,
density: 0.508,
complexity: 0.498,
connectedness: 0.501,
lifespan: 0.565,
survivingNodes: 64,
branchCount: 50,
loops: 140,
maxDepth: 13,
thicknessRatio: 1.25,
fractalDim: 1.792,
pulse: { avg: 0.59, min: 0.30, max: 1.85 },
tone: {
anger: 0.00,
sadness: 0.00,
curiosity: 0.70,
dryness: 0.90,
playfulness: 0.10,
tension: 0.00
}
};
// Node structure
class Node {
constructor(x, y, id) {
this.x = x;
this.y = y;
this.id = id;
this.radius = 2 + Math.random() * 3 * params.density;
this.energy = 1;
this.links = new Map();
this.age = 0;
this.maxAge = 100 + Math.random() * 200 * params.lifespan;
this.pulse = 0;
}
addLink(target, strength = 1) {
this.links.set(target, strength);
}
update() {
this.age++;
this.pulse = params.pulse.min + (params.pulse.max - params.pulse.min) *
(Math.sin(Date.now() * 0.001 * params.motion) * 0.5 + 0.5);
// Age-based decay
this.energy = 1 - (this.age / this.maxAge);
if (this.energy <= 0) return false;
return true;
}
draw() {
const size = this.radius * (0.5 + 0.5 * this.pulse) * this.energy;
const alpha = this.energy * 0.7;
const saturation = 70 + (1 - params.tone.dryness) * 30;
// Dryness affects color range
const hue = 180 + params.tone.curiosity * 90;
ctx.fillStyle = `hsla(${hue}, ${saturation}%, 60%, ${alpha})`;
ctx.beginPath();
ctx.arc(this.x, this.y, size, 0, Math.PI * 2);
ctx.fill();
}
}
// Network system
class NetworkGraph {
constructor() {
this.nodes = new Map();
this.edges = [];
this.time = 0;
this.energy = 0;
}
createNodes() {
// Create base nodes with higher density
for (let i = 0; i < params.survivingNodes; i++) {
const x = Math.random() * canvas.width;
const y = Math.random() * canvas.height;
this.nodes.set(i, new Node(x, y, i));
}
}
createConnections() {
// Create more connections based on connectedness
const nodes = Array.from(this.nodes.values());
const targetLinks = Math.max(1, Math.floor(params.connectedness * params.survivingNodes * 3));
for (let i = 0; i < targetLinks; i++) {
const from = nodes[Math.floor(Math.random() * nodes.length)];
const to = nodes[Math.floor(Math.random() * nodes.length)];
if (from === to) continue;
const strength = 0.3 + Math.random() * 0.7 * params.connectedness;
from.addLink(to, strength);
this.edges.push({ from, to, strength });
// Create loops when connectedness is high
if (params.loops > 100 && Math.random() < 0.3) {
const loopTarget = nodes[Math.floor(Math.random() * nodes.length)];
if (loopTarget !== from && loopTarget !== to) {
from.addLink(loopTarget, strength * 0.8);
this.edges.push({ from, to: loopTarget, strength: strength * 0.8 });
}
}
}
}
update() {
this.time++;
this.energy = 0;
// Update nodes and collect surviving ones
const survivingNodes = [];
for (const [id, node] of this.nodes) {
if (node.update()) {
survivingNodes.push(node);
this.energy += node.energy;
} else {
this.nodes.delete(id);
}
}
// Replenish if nodes are dying
while (this.nodes.size < params.survivingNodes * 0.8 && Math.random() < 0.05) {
const x = Math.random() * canvas.width;
const y = Math.random() * canvas.height;
this.nodes.set(Object.keys(this.nodes).length, new Node(x, y, Object.keys(this.nodes).length));
}
return survivingNodes;
}
draw(nodes) {
// Draw edges with thickness based on connectedness
const lineWidth = 0.5 + params.connectedness * 2;
for (const edge of this.edges) {
if (!this.nodes.has(edge.from.id) || !this.nodes.has(edge.to.id)) continue;
const alpha = 0.1 + 0.9 * edge.strength * (1 - params.tone.dryness);
ctx.strokeStyle = `rgba(180, 220, 255, ${alpha})`;
ctx.lineWidth = lineWidth * edge.strength * params.thicknessRatio;
ctx.beginPath();
ctx.moveTo(edge.from.x, edge.from.y);
ctx.lineTo(edge.to.x, edge.to.y);
ctx.stroke();
}
// Draw nodes
for (const node of nodes) {
node.draw();
}
}
}
// Main animation
const system = new NetworkGraph();
system.createNodes();
system.createConnections();
function animate() {
// Dim background slightly for trails
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
const nodes = system.update();
system.draw(nodes);
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>