birth: network pulse in teal mist

This commit is contained in:
motd_admin 2026-07-04 05:47:21 +00:00
parent 1ef5a99fd0
commit bb2975bec3

210
index.html Normal file
View file

@ -0,0 +1,210 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>neurameba · network pulse</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0a;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: 'Courier New', monospace;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 20px;
color: #555;
font-size: 10px;
text-align: center;
width: 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
const params = {
motion: 0.595,
density: 0.544,
complexity: 0.507,
connectedness: 0.445,
lifespan: 0.482,
pulse: { avg: 0.52, min: 0.30, max: 1.55 },
tone: { curiosity: 0.70, dryness: 0.90, playfulness: 0.10 }
};
// Network graph setup
const nodes = [];
const edges = [];
const nodeCount = 36;
const edgeCount = 29;
const loops = 157;
const maxDepth = 15;
// Create nodes
for (let i = 0; i < nodeCount; i++) {
nodes.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
size: 2 + Math.random() * 3,
pulse: 0.5 + Math.random() * 0.5,
energy: 10 + Math.random() * 20,
velocity: {
x: (Math.random() - 0.5) * 0.5,
y: (Math.random() - 0.5) * 0.5
}
});
}
// Create edges
for (let i = 0; i < edgeCount; i++) {
const from = Math.floor(Math.random() * nodeCount);
const to = Math.floor(Math.random() * nodeCount);
const length = Math.hypot(
nodes[from].x - nodes[to].x,
nodes[from].y - nodes[to].y
);
edges.push({
from,
to,
length,
thickness: 0.5 + Math.random() * 1.5,
energy: 5 + Math.random() * 15,
phase: Math.random() * Math.PI * 2
});
}
// Add loops
for (let i = 0; i < loops; i++) {
const from = Math.floor(Math.random() * nodeCount);
const to = Math.floor(Math.random() * nodeCount);
edges.push({
from,
to,
length: Math.hypot(
nodes[from].x - nodes[to].x,
nodes[from].y - nodes[to].y
),
thickness: 0.3 + Math.random() * 1.2,
energy: 2 + Math.random() * 10,
phase: Math.random() * Math.PI * 2,
isLoop: true
});
}
// Animation
let time = 0;
let lastTime = 0;
const targetFPS = 60;
const frameDelay = 1000 / targetFPS;
let lastFrameTime = 0;
function animate(currentTime) {
if (currentTime - lastFrameTime < frameDelay) {
requestAnimationFrame(animate);
return;
}
lastFrameTime = currentTime;
// Fade background
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Update nodes
nodes.forEach(node => {
// Apply pulse
const pulseScale = 1 + Math.sin(time * params.pulse.avg * 0.2) * 0.1 * params.pulse.avg;
node.size = 2 + Math.random() * 3 * pulseScale;
// Move nodes
node.x += node.velocity.x * params.motion * 2;
node.y += node.velocity.y * params.motion * 2;
// Boundary check
if (node.x < 0 || node.x > canvas.width) node.velocity.x *= -1;
if (node.y < 0 || node.y > canvas.height) node.velocity.y *= -1;
});
// Update edges
edges.forEach(edge => {
edge.phase += 0.01 * params.pulse.avg;
// Calculate energy
const energy = edge.energy * (1 + Math.sin(edge.phase) * params.pulse.avg * 0.5);
// Draw edge
const fromNode = nodes[edge.from];
const toNode = nodes[edge.to];
// Only draw if nodes are close enough
const dist = Math.hypot(
fromNode.x - toNode.x,
fromNode.y - toNode.y
);
if (dist < 300) {
ctx.strokeStyle = `rgba(200, 255, 230, ${Math.min(1, edge.energy / 20 * params.tone.curiosity)})`;
ctx.lineWidth = edge.thickness * params.complexity * 2;
ctx.beginPath();
if (edge.isLoop) {
// Draw loop
const midX = (fromNode.x + toNode.x) / 2;
const midY = (fromNode.y + toNode.y) / 2;
const radius = dist * 0.3;
ctx.moveTo(fromNode.x, fromNode.y);
ctx.quadraticCurveTo(
midX + Math.sin(edge.phase) * radius * 0.5,
midY + Math.cos(edge.phase) * radius * 0.5,
toNode.x, toNode.y
);
} else {
// Draw regular edge
ctx.moveTo(fromNode.x, fromNode.y);
ctx.lineTo(toNode.x, toNode.y);
}
ctx.stroke();
}
});
// Draw nodes
nodes.forEach(node => {
ctx.fillStyle = `rgba(200, 255, 230, ${node.energy / 30})`;
ctx.beginPath();
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
ctx.fill();
});
time += 0.01;
requestAnimationFrame(animate);
}
requestAnimationFrame(animate);
</script>
</body>
</html>