birth: Sparse Neural Constellations
This commit is contained in:
parent
eefc140de4
commit
08439a2546
1 changed files with 136 additions and 0 deletions
136
index.html
Normal file
136
index.html
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Entity Stream</title>
|
||||||
|
<style>
|
||||||
|
body { margin: 0; overflow: hidden; background: #0a0a0a; }
|
||||||
|
canvas { display: block; }
|
||||||
|
#info { position: absolute; bottom: 10px; right: 10px; color: #555; font-family: monospace; font-size: 10px; }
|
||||||
|
</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();
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
const params = {
|
||||||
|
motion: 0.645,
|
||||||
|
density: 0.521,
|
||||||
|
complexity: 0.619,
|
||||||
|
connectedness: 0.709,
|
||||||
|
lifespan: 0.327,
|
||||||
|
pulse: { avg: 0.36, min: 0.30, max: 1.60 },
|
||||||
|
tone: { dryness: 0.80, curiosity: 0.30 }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Node system
|
||||||
|
class Node {
|
||||||
|
constructor(x, y) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.vx = 0;
|
||||||
|
this.vy = 0;
|
||||||
|
this.size = 1;
|
||||||
|
this.life = 0;
|
||||||
|
this.maxLife = Math.random() * 100 + 50;
|
||||||
|
this.energy = 48.1;
|
||||||
|
this.connections = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.life += 0.1;
|
||||||
|
this.size = 0.5 + Math.sin(this.life * 0.05) * 0.2;
|
||||||
|
|
||||||
|
// Motion influenced by connectedness
|
||||||
|
const pulse = params.pulse.avg + Math.sin(Date.now() * 0.001 * params.pulse.avg) * params.pulse.avg;
|
||||||
|
this.vx = (Math.random() - 0.5) * params.motion * pulse;
|
||||||
|
this.vy = (Math.random() - 0.5) * params.motion * pulse;
|
||||||
|
this.x += this.vx;
|
||||||
|
this.y += this.vy;
|
||||||
|
|
||||||
|
// Boundary check
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
addConnection(node) {
|
||||||
|
this.connections.push(node);
|
||||||
|
node.connections.push(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
draw() {
|
||||||
|
// Fade based on lifespan
|
||||||
|
const alpha = params.lifespan * (1 - this.life / this.maxLife);
|
||||||
|
ctx.globalAlpha = Math.max(0, alpha);
|
||||||
|
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(this.x, this.y, this.size * 2, 0, Math.PI * 2);
|
||||||
|
ctx.fillStyle = '#a0a0a0';
|
||||||
|
ctx.fill();
|
||||||
|
|
||||||
|
// Draw connections
|
||||||
|
ctx.globalAlpha = 0.1;
|
||||||
|
this.connections.forEach(conn => {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(this.x, this.y);
|
||||||
|
ctx.lineTo(conn.x, conn.y);
|
||||||
|
ctx.strokeStyle = '#666';
|
||||||
|
ctx.lineWidth = 0.5;
|
||||||
|
ctx.stroke();
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.globalAlpha = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create nodes
|
||||||
|
const nodes = [];
|
||||||
|
const nodeCount = 7 + Math.floor(params.density * 20);
|
||||||
|
|
||||||
|
for (let i = 0; i < nodeCount; i++) {
|
||||||
|
nodes.push(new Node(
|
||||||
|
Math.random() * canvas.width,
|
||||||
|
Math.random() * canvas.height
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create connections
|
||||||
|
const connectionCount = 7 + Math.floor(params.connectedness * 50);
|
||||||
|
for (let i = 0; i < connectionCount; i++) {
|
||||||
|
const a = Math.floor(Math.random() * nodes.length);
|
||||||
|
const b = Math.floor(Math.random() * nodes.length);
|
||||||
|
if (a !== b) {
|
||||||
|
nodes[a].addConnection(nodes[b]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Animation loop
|
||||||
|
function animate() {
|
||||||
|
ctx.fillStyle = 'rgba(5, 5, 10, 0.1)';
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
nodes.forEach(node => {
|
||||||
|
node.update();
|
||||||
|
node.draw();
|
||||||
|
});
|
||||||
|
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
}
|
||||||
|
animate();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue