birth: Pulsing Neural Lattice
This commit is contained in:
parent
8854e92989
commit
5a7b5fdf5d
1 changed files with 161 additions and 0 deletions
161
index.html
Normal file
161
index.html
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Neurameba Network</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #0a0a0a;
|
||||
font-family: 'Courier New', monospace;
|
||||
color: #ccc;
|
||||
}
|
||||
#info {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
font-size: 10px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas"></canvas>
|
||||
<div id="info">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();
|
||||
|
||||
const params = {
|
||||
motion: 0.479,
|
||||
density: 0.495,
|
||||
complexity: 0.519,
|
||||
connectedness: 0.452,
|
||||
lifespan: 0.446,
|
||||
survivingNodes: 93,
|
||||
branchCount: 71,
|
||||
loops: 191,
|
||||
maxDepth: 21,
|
||||
thicknessRatio: 1.50,
|
||||
fractalDimension: 1.646,
|
||||
finalEnergy: 438.0,
|
||||
pulse: { avg: 0.70, min: 0.30, max: 1.75 },
|
||||
tone: {
|
||||
anger: 0.00,
|
||||
sadness: 0.00,
|
||||
curiosity: 0.70,
|
||||
dryness: 0.90,
|
||||
playfulness: 0.10,
|
||||
tension: 0.00
|
||||
}
|
||||
};
|
||||
|
||||
// Network graph simulation
|
||||
const nodes = [];
|
||||
const edges = [];
|
||||
const maxNodes = Math.floor(params.survivingNodes + params.branchCount * 0.5);
|
||||
const maxEdges = params.loops * 2;
|
||||
|
||||
// Initialize nodes
|
||||
for (let i = 0; i < maxNodes; 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: 1 + Math.random() * params.complexity * 3,
|
||||
energy: params.finalEnergy / maxNodes,
|
||||
pulse: Math.random() * (params.pulse.max - params.pulse.min) + params.pulse.min
|
||||
});
|
||||
}
|
||||
|
||||
// Create edges with higher probability for connectedness
|
||||
for (let i = 0; i < maxNodes; i++) {
|
||||
for (let j = i + 1; j < maxNodes; j++) {
|
||||
if (Math.random() < params.connectedness * 0.1) {
|
||||
edges.push({
|
||||
from: i,
|
||||
to: j,
|
||||
strength: 0.5 + Math.random() * 0.5,
|
||||
distance: 50 + Math.random() * 150
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Main animation loop
|
||||
let time = 0;
|
||||
function animate() {
|
||||
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Update nodes
|
||||
nodes.forEach(node => {
|
||||
node.x += node.vx;
|
||||
node.y += node.vy;
|
||||
|
||||
// Boundary check
|
||||
if (node.x < 0 || node.x > canvas.width) node.vx *= -1;
|
||||
if (node.y < 0 || node.y > canvas.height) node.vy *= -1;
|
||||
|
||||
// Update energy/pulse
|
||||
node.energy -= 0.01;
|
||||
node.pulse = params.pulse.avg + Math.sin(time * 0.05) * params.pulse.avg * 0.3;
|
||||
});
|
||||
|
||||
// Draw edges
|
||||
edges.forEach(edge => {
|
||||
const fromNode = nodes[edge.from];
|
||||
const toNode = nodes[edge.to];
|
||||
|
||||
// Apply distance constraints
|
||||
const dx = toNode.x - fromNode.x;
|
||||
const dy = toNode.y - fromNode.y;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
const force = (distance - edge.distance) * 0.01;
|
||||
|
||||
toNode.vx += dx / distance * force;
|
||||
toNode.vy += dy / distance * force;
|
||||
fromNode.vx -= dx / distance * force;
|
||||
fromNode.vy -= dy / distance * force;
|
||||
|
||||
// Draw edge with pulse effect
|
||||
const alpha = Math.min(1, fromNode.energy * 0.001) * edge.strength * 0.7;
|
||||
ctx.strokeStyle = `rgba(200, 230, 255, ${alpha})`;
|
||||
ctx.lineWidth = 0.5 + edge.strength * params.thicknessRatio * 0.3;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(fromNode.x, fromNode.y);
|
||||
ctx.lineTo(toNode.x, toNode.y);
|
||||
ctx.stroke();
|
||||
});
|
||||
|
||||
// Draw nodes
|
||||
nodes.forEach(node => {
|
||||
if (node.energy <= 0) return;
|
||||
|
||||
const hue = 180 + Math.sin(time * node.pulse * 0.1) * 30;
|
||||
const saturation = 70 + Math.sin(time * node.pulse * 0.1) * 20;
|
||||
const brightness = 80 + Math.sin(time * node.pulse * 0.1) * 15;
|
||||
ctx.fillStyle = `hsl(${hue}, ${saturation}%, ${brightness}%)`;
|
||||
ctx.beginPath();
|
||||
ctx.arc(node.x, node.y, node.size * node.energy * 0.01, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
});
|
||||
|
||||
time += 1;
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue