birth: Glowing Neural Web

This commit is contained in:
motd_admin 2026-07-10 09:47:23 +00:00
parent 1705a8f4ff
commit effeb72e75

234
index.html Normal file
View file

@ -0,0 +1,234 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neurameba Live</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;
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 resize() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resize);
resize();
// Parameters derived from the specifications
const params = {
motion: 0.319,
density: 0.645,
complexity: 0.451,
connectedness: 0.612,
lifespan: 0.318,
survivingNodes: 16,
branchCount: 11,
loops: 52,
maxDepth: 12,
thicknessRatio: 1.25,
fractalDimension: 0.5,
pulseAvg: 0.41,
pulseMin: 0.3,
pulseMax: 1.25
};
// Generate graph structure
class Node {
constructor(x, y) {
this.x = x;
this.y = y;
this.vx = 0;
this.vy = 0;
this.connections = [];
this.age = 0;
this.maxAge = 200 + Math.random() * 300;
this.radius = 1.5 + Math.random() * 0.5;
this.targetRadius = this.radius;
}
connect(node) {
this.connections.push(node);
}
update() {
this.age++;
// Pulse-based radius variation
const pulse = params.pulseAvg + (Math.sin(Date.now() * 0.001) * (params.pulseMax - params.pulseMin) * 0.5);
this.targetRadius = this.radius * pulse * 0.8 + 0.5;
// Smooth radius transition
this.radius += (this.targetRadius - this.radius) * 0.1;
// Age-based decay
if (this.age > this.maxAge) {
this.radius *= 0.98;
}
}
draw(ctx) {
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
ctx.fillStyle = `hsl(0, 0%, ${70 + this.radius * 5}%)`;
ctx.fill();
}
}
class NetworkGraph {
constructor() {
this.nodes = [];
this.edges = [];
this.initGraph();
}
initGraph() {
// Create central nodes
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
const centerNodes = [];
for (let i = 0; i < params.survivingNodes; i++) {
const angle = (i / params.survivingNodes) * Math.PI * 2;
const distance = 100 + Math.random() * 100;
const x = centerX + Math.cos(angle) * distance;
const y = centerY + Math.sin(angle) * distance;
const node = new Node(x, y);
this.nodes.push(node);
centerNodes.push(node);
}
// Create hub nodes
const hubCount = Math.floor(params.density * 30);
for (let i = 0; i < hubCount; i++) {
const angle = Math.random() * Math.PI * 2;
const distance = 200 + Math.random() * 300;
const x = centerX + Math.cos(angle) * distance;
const y = centerY + Math.sin(angle) * distance;
const node = new Node(x, y);
this.nodes.push(node);
}
// Connect nodes
for (let i = 0; i < this.nodes.length; i++) {
const node = this.nodes[i];
const connectionCount = Math.floor(params.connectedness * 3) + 1;
for (let j = 0; j < connectionCount; j++) {
const other = this.nodes[Math.floor(Math.random() * this.nodes.length)];
if (other !== node && !node.connections.includes(other)) {
node.connect(other);
const edge = { from: node, to: other };
this.edges.push(edge);
other.connect(node); // Bidirectional
}
}
}
// Create some loops
for (let i = 0; i < params.loops; i++) {
const node1 = this.nodes[Math.floor(Math.random() * this.nodes.length)];
const node2 = this.nodes[Math.floor(Math.random() * this.nodes.length)];
if (node1 !== node2 && !node1.connections.includes(node2)) {
node1.connect(node2);
const edge = { from: node1, to: node2 };
this.edges.push(edge);
}
}
}
update() {
this.nodes.forEach(node => node.update());
// Occasionally remove old nodes
if (Math.random() < 0.01) {
if (this.nodes.length > 10) {
this.nodes.splice(Math.floor(Math.random() * this.nodes.length), 1);
}
}
// Occasionally add new nodes
if (Math.random() < params.motion * 0.02) {
const angle = Math.random() * Math.PI * 2;
const distance = 500 + Math.random() * 500;
const x = canvas.width / 2 + Math.cos(angle) * distance;
const y = canvas.height / 2 + Math.sin(angle) * distance;
this.nodes.push(new Node(x, y));
}
}
draw(ctx) {
// Draw connections first
this.edges.forEach(edge => {
ctx.beginPath();
ctx.moveTo(edge.from.x, edge.from.y);
ctx.lineTo(edge.to.x, edge.to.y);
const dist = Math.sqrt(
Math.pow(edge.to.x - edge.from.x, 2) +
Math.pow(edge.to.y - edge.from.y, 2)
);
const alpha = Math.min(0.3, dist / 500);
ctx.strokeStyle = `rgba(255, 255, 255, ${alpha})`;
ctx.lineWidth = params.thicknessRatio * 0.5;
ctx.stroke();
});
// Draw nodes last
this.nodes.forEach(node => node.draw(ctx));
// Draw some floating orphan nodes
for (let i = 0; i < 3; i++) {
ctx.beginPath();
ctx.arc(
Math.random() * canvas.width,
Math.random() * canvas.height,
1 + Math.random() * 0.5,
0,
Math.PI * 2
);
ctx.fillStyle = `hsl(0, 0%, ${60 + Math.random() * 20}%)`;
ctx.fill();
}
}
}
const graph = new NetworkGraph();
function animate() {
// Semi-transparent background for trails
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
graph.update();
graph.draw(ctx);
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>