birth: Fractal Echoes in Static

This commit is contained in:
motd_admin 2026-08-09 18:21:21 +00:00
parent 597d0f57a5
commit 1db6665617

186
index.html Normal file
View file

@ -0,0 +1,186 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Generative Network</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0a;
font-family: 'Courier New', monospace;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 10px;
right: 10px;
color: #555;
font-size: 10px;
text-shadow: 0 0 5px rgba(0,0,0,0.5);
}
</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
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// Parameters influenced by the abstract input
const params = {
motion: 0.5,
density: 0.5,
complexity: 0.5,
connectedness: 0.5,
lifespan: 0.5,
pulse: 1.08,
tone: {
anger: 0.00,
sadness: 0.00,
curiosity: 0.30,
dryness: 0.80,
playfulness: 0.00,
tension: 0.00
}
};
// Calculate derived parameters
const nodeCount = Math.floor(100 + params.connectedness * 300);
const edgeCount = Math.floor(nodeCount * 2 * params.connectedness);
const nodeSize = Math.max(1, 5 * (1 - params.density));
const edgeLength = Math.min(200, 50 + params.complexity * 150);
const energy = params.pulse * params.motion;
// Color palette based on tone
const hue = params.tone.curiosity * 180; // Teal range
const saturation = params.tone.dryness * 100;
const lightness = 50 + params.tone.dryness * 30;
const baseColor = `hsl(${hue}, ${saturation}%, ${lightness}%)`;
const fadeColor = `hsl(${hue}, ${saturation * 0.5}%, ${lightness * 0.7}%)`;
// Network nodes
const 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: nodeSize,
energy: 0.5 + Math.random() * 0.5,
lifespan: params.lifespan * (0.5 + Math.random() * 0.5)
});
}
// Network edges
const edges = [];
for (let i = 0; i < edgeCount; i++) {
const a = Math.floor(Math.random() * nodeCount);
const b = Math.floor(Math.random() * nodeCount);
// Ensure some edges are longer based on complexity
const length = edgeLength * (0.5 + params.complexity * 0.5);
edges.push({
a, b,
length,
strength: 0.5 + Math.random() * 0.5,
active: true
});
}
// Main animation loop
function animate() {
// Clear with slight fade
ctx.fillStyle = `rgba(0, 0, 0, ${0.1 + params.tone.dryness * 0.2})`;
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Draw nodes and connections
ctx.strokeStyle = baseColor;
ctx.lineWidth = 1;
// Update node positions with repulsion
nodes.forEach(node => {
// Simple repulsion from boundaries
node.x = Math.max(node.size, Math.min(canvas.width - node.size, node.x + node.vx));
node.y = Math.max(node.size, Math.min(canvas.height - node.size, node.y + node.vy));
// Apply slight drag
node.vx *= 0.9;
node.vy *= 0.9;
// Add small random motion
node.vx += (Math.random() - 0.5) * 0.05 * params.motion;
node.vy += (Math.random() - 0.5) * 0.05 * params.motion;
});
// Draw edges (connections)
edges.forEach(edge => {
if (!edge.active) return;
const a = nodes[edge.a];
const b = nodes[edge.b];
// Calculate distance
const dx = b.x - a.x;
const dy = b.y - a.y;
const distance = Math.sqrt(dx * dx + dy * dy);
// Draw connection if within length
if (distance < edge.length * 1.5) {
ctx.globalAlpha = edge.strength * 0.8;
ctx.beginPath();
ctx.moveTo(a.x, a.y);
ctx.lineTo(b.x, b.y);
ctx.stroke();
}
});
// Draw nodes
nodes.forEach(node => {
ctx.globalAlpha = node.energy * (1 - params.tone.dryness * 0.3);
ctx.fillStyle = baseColor;
ctx.beginPath();
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
ctx.fill();
});
// Occasionally add new edges based on connectedness
if (Math.random() < 0.01 * params.connectedness) {
if (edges.length > 0) {
const edge = edges[Math.floor(Math.random() * edges.length)];
edge.active = true;
}
}
// Occasionally deactivate random edges
if (Math.random() < 0.005 * (1 - params.connectedness)) {
if (edges.length > 0) {
const edge = edges[Math.floor(Math.random() * edges.length)];
edge.active = false;
}
}
requestAnimationFrame(animate);
}
// Handle window resize
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
// Start animation
animate();
</script>
</body>
</html>