birth: Fractal Nodes in Pulse

This commit is contained in:
motd_admin 2026-06-19 09:47:24 +00:00
parent 494114d9eb
commit 414e3f7508

219
index.html Normal file
View file

@ -0,0 +1,219 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neurameba Motion</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #0a0a0a;
font-family: 'Courier New', monospace;
color: #ffffff;
}
#attribution {
position: fixed;
bottom: 10px;
right: 10px;
font-size: 10px;
opacity: 0.5;
pointer-events: none;
}
</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 inputs
const params = {
motion: 0.478,
density: 0.506,
complexity: 0.570,
connectedness: 0.690,
lifespan: 0.477,
survivingNodes: 15,
branchCount: 15,
loops: 262,
maxDepth: 10,
thicknessRatio: 1.25,
fractalDimension: 0.792,
finalEnergy: 93.2,
pulse: { avg: 0.37, min: 0.30, max: 1.50 },
tones: {
anger: 0.00,
sadness: 0.00,
curiosity: 0.70,
dryness: 0.80,
playfulness: 0.10,
tension: 0.00
}
};
// Color palette based on tones
const palette = {
main: params.tones.dryness > 0.7 ? '#e0e0e0' : '#60e0e0', // teal for curiosity, gray for dryness
accent: params.tones.playfulness > 0.5 ? '#ff6060' : '#30ff30', // subtle red/teal for dynamics
bg: '#0a0a0a',
node: params.tones.dryness > 0.7 ? '#a0a0a0' : '#60e0e0',
edge: params.tones.dryness > 0.7 ? 'rgba(160, 160, 160, 0.3)' : 'rgba(96, 224, 224, 0.3)'
};
// Node and edge data structures
class Network {
constructor() {
this.nodes = [];
this.edges = [];
this.pulseProgress = 0;
this.pulseDirection = 1;
this.age = 0;
}
initialize() {
// Create nodes in a fractal pattern
for (let i = 0; i < params.survivingNodes; i++) {
const depth = Math.floor(Math.random() * params.maxDepth);
this.nodes.push({
id: i,
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
size: 2 + Math.random() * 5,
depth: depth,
energy: params.finalEnergy * (0.5 + Math.random() * 0.5),
target: {
x: Math.random() * canvas.width,
y: Math.random() * canvas.height
}
});
}
// Create edges with loops
for (let i = 0; i < params.branchCount; i++) {
const from = Math.floor(Math.random() * this.nodes.length);
const to = Math.floor(Math.random() * this.nodes.length);
const loopCount = Math.min(params.loops, 20); // Max loops per edge
for (let j = 0; j < loopCount; j++) {
this.edges.push({
from: from,
to: to,
strength: 0.5 + Math.random() * 0.5,
thickness: 0.5 + params.thicknessRatio * (0.5 + Math.random() * 0.5),
offset: j * 20,
phase: Math.random() * Math.PI * 2
});
}
}
}
update() {
this.age += 0.01 * params.motion;
// Pulse effect
this.pulseProgress += 0.005 * this.pulseDirection * params.pulse.avg;
if (this.pulseProgress > 1 || this.pulseProgress < 0) {
this.pulseDirection *= -1;
}
// Update node positions with energy-based movement
this.nodes.forEach(node => {
// Fractal movement pattern
const fractalFactor = Math.pow(params.fractalDimension, node.depth);
node.x += (node.target.x - node.x) * 0.01 * params.motion * fractalFactor;
node.y += (node.target.y - node.y) * 0.01 * params.motion * fractalFactor;
// Add some randomness
node.x += (Math.random() - 0.5) * 0.5 * params.complexity;
node.y += (Math.random() - 0.5) * 0.5 * params.complexity;
// Stay within bounds
node.x = Math.max(0, Math.min(canvas.width, node.x));
node.y = Math.max(0, Math.min(canvas.height, node.y));
// Update target occasionally
if (Math.random() < 0.02 * params.motion) {
node.target = {
x: Math.random() * canvas.width,
y: Math.random() * canvas.height
};
}
});
}
draw() {
// Clear with slight motion blur effect
ctx.fillStyle = `${palette.bg}10`;
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Draw edges with pulse effects
this.edges.forEach(edge => {
const fromNode = this.nodes[edge.from];
const toNode = this.nodes[edge.to];
// Calculate pulse-adjusted thickness
const pulseFactor = 0.5 + 0.5 * Math.sin(this.pulseProgress * Math.PI * 2 + edge.phase);
const thickness = edge.thickness * (1 + pulseFactor * 0.3);
// Draw edge with glow
ctx.strokeStyle = palette.edge;
ctx.lineWidth = thickness;
ctx.beginPath();
ctx.moveTo(fromNode.x, fromNode.y);
ctx.lineTo(toNode.x, toNode.y);
ctx.stroke();
// Add glow effect
ctx.shadowColor = palette.accent;
ctx.shadowBlur = thickness * 2;
ctx.beginPath();
ctx.moveTo(fromNode.x, fromNode.y);
ctx.lineTo(toNode.x, toNode.y);
ctx.stroke();
ctx.shadowBlur = 0;
});
// Draw nodes with size based on energy
this.nodes.forEach(node => {
const size = node.size * (0.8 + 0.4 * Math.sin(this.age * 0.1 + node.id));
const alpha = Math.min(1, node.energy / 100);
// Draw node with glow
ctx.fillStyle = palette.node;
ctx.beginPath();
ctx.arc(node.x, node.y, size, 0, Math.PI * 2);
ctx.fill();
// Add glow
ctx.shadowColor = palette.accent;
ctx.shadowBlur = size * 2;
ctx.beginPath();
ctx.arc(node.x, node.y, size, 0, Math.PI * 2);
ctx.fill();
ctx.shadowBlur = 0;
});
}
}
let network = new Network();
network.initialize();
function animate() {
network.update();
network.draw();
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>