birth: Fractured Neural Echoes
This commit is contained in:
parent
761db00f9e
commit
45734ea25d
1 changed files with 141 additions and 0 deletions
141
index.html
Normal file
141
index.html
Normal file
|
|
@ -0,0 +1,141 @@
|
||||||
|
<!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; color: #aaa; font-family: monospace; }
|
||||||
|
canvas { display: block; }
|
||||||
|
#attribution { position: fixed; bottom: 10px; right: 10px; font-size: 10px; opacity: 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');
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
canvas.width = innerWidth;
|
||||||
|
canvas.height = innerHeight;
|
||||||
|
}
|
||||||
|
window.addEventListener('resize', resize);
|
||||||
|
resize();
|
||||||
|
|
||||||
|
// Parameters mapped from abstract model
|
||||||
|
const params = {
|
||||||
|
motion: 0.5,
|
||||||
|
density: 0.5,
|
||||||
|
complexity: 0.5,
|
||||||
|
connectedness: 0.5,
|
||||||
|
lifespan: 0.5,
|
||||||
|
pulse: 1.08
|
||||||
|
};
|
||||||
|
|
||||||
|
// Network graph implementation
|
||||||
|
class Node {
|
||||||
|
constructor() {
|
||||||
|
this.x = Math.random() * canvas.width;
|
||||||
|
this.y = Math.random() * canvas.height;
|
||||||
|
this.vx = (Math.random() - 0.5) * 2 * params.motion;
|
||||||
|
this.vy = (Math.random() - 0.5) * 2 * params.motion;
|
||||||
|
this.connections = [];
|
||||||
|
this.size = 2 + Math.random() * 3 * params.complexity;
|
||||||
|
this.color = `hsl(${Math.random() * 60 + 180}, 80%, 70%)`;
|
||||||
|
this.lifespan = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.x += this.vx * params.pulse;
|
||||||
|
this.y += this.vy * params.pulse;
|
||||||
|
|
||||||
|
if (this.x < 0) this.x = canvas.width;
|
||||||
|
if (this.x > canvas.width) this.x = 0;
|
||||||
|
if (this.y < 0) this.y = canvas.height;
|
||||||
|
if (this.y > canvas.height) this.y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(other) {
|
||||||
|
if (!this.connections.includes(other)) {
|
||||||
|
this.connections.push(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Network {
|
||||||
|
constructor() {
|
||||||
|
this.nodes = [];
|
||||||
|
this.initNodes();
|
||||||
|
this.initConnections();
|
||||||
|
}
|
||||||
|
|
||||||
|
initNodes() {
|
||||||
|
const count = 50 + Math.floor(params.density * 150);
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
this.nodes.push(new Node());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initConnections() {
|
||||||
|
const threshold = 0.3 + params.connectedness * 0.4;
|
||||||
|
for (let i = 0; i < this.nodes.length; i++) {
|
||||||
|
for (let j = i + 1; j < this.nodes.length; j++) {
|
||||||
|
const dist = Math.hypot(
|
||||||
|
this.nodes[i].x - this.nodes[j].x,
|
||||||
|
this.nodes[i].y - this.nodes[j].y
|
||||||
|
);
|
||||||
|
if (dist < 200 && Math.random() < threshold) {
|
||||||
|
this.nodes[i].connect(this.nodes[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.nodes.forEach(node => node.update());
|
||||||
|
}
|
||||||
|
|
||||||
|
draw() {
|
||||||
|
ctx.strokeStyle = 'rgba(255, 255, 255, 0.1)';
|
||||||
|
ctx.lineWidth = 0.5;
|
||||||
|
|
||||||
|
// Draw connections
|
||||||
|
this.nodes.forEach(node => {
|
||||||
|
node.connections.forEach(conn => {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(node.x, node.y);
|
||||||
|
ctx.lineTo(conn.x, conn.y);
|
||||||
|
ctx.stroke();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Draw nodes
|
||||||
|
this.nodes.forEach(node => {
|
||||||
|
ctx.fillStyle = node.color;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
|
||||||
|
ctx.fill();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const network = new Network();
|
||||||
|
let time = 0;
|
||||||
|
|
||||||
|
function animate() {
|
||||||
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
network.update();
|
||||||
|
network.draw();
|
||||||
|
|
||||||
|
time += 0.01;
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
animate();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue