birth: Fractal Connectivity in Pulsing Dark

This commit is contained in:
motd_admin 2026-06-25 05:47:23 +00:00
parent 4a8cea592e
commit 68f3386c50

205
index.html Normal file
View file

@ -0,0 +1,205 @@
<!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, html {
margin: 0;
padding: 0;
overflow: hidden;
background: #0a0a0a;
height: 100%;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 10px;
right: 10px;
color: #444;
font-family: monospace;
font-size: 10px;
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');
// Set canvas to full window size
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// Parameters derived from input
const params = {
motion: 0.5,
density: 0.5,
complexity: 0.5,
connectedness: 0.5,
lifespan: 0.5,
pulse: { avg: 1.07, min: 0.9, max: 1.2 },
tone: { anger: 0, sadness: 0, curiosity: 0.7, dryness: 0.9, playfulness: 0.1, tension: 0 },
families: ['particle-system', 'wave-interference', 'cellular-automata', 'l-system', 'flow-field', 'physics-sim', 'tessellation', 'network-graph', 'fractal']
};
// Network graph configuration
const nodeCount = Math.floor(50 + params.density * 100);
const nodes = [];
const edges = [];
const maxConnections = Math.floor(2 + params.connectedness * 8);
// Initialize nodes
for (let i = 0; i < nodeCount; i++) {
nodes.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
vx: (Math.random() - 0.5) * params.motion * 2,
vy: (Math.random() - 0.5) * params.motion * 2,
size: 2 + Math.random() * 3,
color: `rgba(100, 200, 255, ${0.5 + 0.5 * params.tone.curiosity})`,
lifespan: params.lifespan * 200 + Math.random() * 100
});
}
// Create connections based on distance and connectedness
function createEdges() {
edges.length = 0; // Clear existing edges
for (let i = 0; i < nodes.length; i++) {
const current = nodes[i];
const closest = [];
// Find closest nodes
for (let j = 0; j < nodes.length; j++) {
if (i !== j) {
const dist = Math.sqrt(
Math.pow(nodes[j].x - current.x, 2) +
Math.pow(nodes[j].y - current.y, 2)
);
if (dist < 150) {
closest.push({ node: nodes[j], dist });
}
}
}
// Sort by distance
closest.sort((a, b) => a.dist - b.dist);
// Connect to nearest nodes based on connectedness
const connections = Math.min(
maxConnections,
Math.floor(params.connectedness * 5 + 1)
);
for (let k = 0; k < Math.min(connections, closest.length); k++) {
edges.push({
from: current,
to: closest[k].node,
strength: 1 - (closest[k].dist / 150) * 0.8
});
}
}
}
createEdges();
// Animation loop
let time = 0;
let pulsePhase = 0;
function animate() {
ctx.fillStyle = 'rgba(5, 5, 10, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Update pulse phase
pulsePhase += 0.01;
const pulseScale = params.pulse.avg +
Math.sin(pulsePhase) * (params.pulse.max - params.pulse.avg) * 0.3;
// Update nodes
nodes.forEach(node => {
// Apply motion
node.x += node.vx * pulseScale;
node.y += node.vy * pulseScale;
// Boundary conditions
if (node.x < 0 || node.x > canvas.width) node.vx *= -1;
if (node.y < 0 || node.y > canvas.height) node.vy *= -1;
// Add slight randomness to motion based on complexity
node.vx += (Math.random() - 0.5) * params.complexity * 0.1;
node.vy += (Math.random() - 0.5) * params.complexity * 0.1;
// Update lifespan
node.lifespan -= params.lifespan * 0.5;
});
// Remove dead nodes
nodes.forEach((node, i) => {
if (node.lifespan <= 0) {
nodes.splice(i, 1);
}
});
// Create new nodes periodically based on density
if (Math.random() < params.density * 0.05) {
nodes.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
vx: (Math.random() - 0.5) * params.motion * 2,
vy: (Math.random() - 0.5) * params.motion * 2,
size: 2 + Math.random() * 3,
color: `rgba(100, 200, 255, ${0.5 + 0.5 * params.tone.curiosity})`,
lifespan: params.lifespan * 200 + Math.random() * 100
});
}
// Rebuild edges occasionally
if (Math.random() < params.connectedness * 0.02) {
createEdges();
}
// Draw edges
ctx.lineWidth = 0.5 + params.connectedness * 1.5;
edges.forEach(edge => {
const gradient = ctx.createLinearGradient(
edge.from.x, edge.from.y,
edge.to.x, edge.to.y
);
gradient.addColorStop(0, edge.from.color);
gradient.addColorStop(1, edge.to.color);
ctx.strokeStyle = gradient;
ctx.beginPath();
ctx.moveTo(edge.from.x, edge.from.y);
ctx.lineTo(edge.to.x, edge.to.y);
ctx.stroke();
});
// Draw nodes
nodes.forEach(node => {
ctx.beginPath();
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
ctx.fillStyle = node.color;
ctx.fill();
});
time++;
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>