birth: Pulsing Neural Drift

This commit is contained in:
motd_admin 2026-09-25 02:21:20 +00:00
parent 6f7f9241bb
commit df58cf2e91

156
index.html Normal file
View file

@ -0,0 +1,156 @@
<!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-color: #0a0a0a;
font-family: 'Courier New', monospace;
}
#attribution {
position: absolute;
bottom: 10px;
left: 10px;
color: rgba(255, 255, 255, 0.3);
font-size: 10px;
pointer-events: none;
}
canvas {
display: block;
}
</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 from prompt
const params = {
motion: 0.5,
density: 0.5,
complexity: 0.5,
connectedness: 0.5,
lifespan: 0.5,
pulse: { avg: 1.05, min: 1.0, max: 1.1 },
tone: { anger: 0.0, sadness: 0.0, curiosity: 0.1, dryness: 0.9, playfulness: 0.0, tension: 0.0 }
};
// Network graph implementation
class NetworkNode {
constructor(x, y) {
this.x = x;
this.y = y;
this.baseSize = 2 + Math.random() * 4;
this.size = this.baseSize;
this.targetSize = this.baseSize;
this.vx = (Math.random() - 0.5) * 0.5;
this.vy = (Math.random() - 0.5) * 0.5;
this.connections = [];
this.energy = 1.0;
this.pulseScale = 1.0;
}
update() {
// Movement with pulse effect
this.x += this.vx * params.motion * 2;
this.y += this.vy * params.motion * 2;
// Boundary bounce
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
// Pulse effect
this.pulseScale = params.pulse.avg * (0.9 + 0.2 * Math.sin(Date.now() * 0.001 * params.pulse.avg));
// Size adjustment based on energy
this.targetSize = this.baseSize * this.pulseScale * this.energy;
this.size += (this.targetSize - this.size) * 0.1;
// Age effect
this.energy = 0.9 + 0.1 * Math.sin(Date.now() * 0.0005);
}
connectTo(node) {
if (node !== this && Math.random() > 0.7) {
this.connections.push(node);
}
}
draw() {
// Connection lines (fading based on tension)
const alpha = params.tone.tension * 0.5 + 0.3;
ctx.strokeStyle = `rgba(180, 180, 180, ${alpha})`;
ctx.lineWidth = 0.5 * params.connectedness;
this.connections.forEach(conn => {
if (conn.x && conn.y) {
ctx.beginPath();
ctx.moveTo(this.x, this.y);
ctx.lineTo(conn.x, conn.y);
ctx.stroke();
}
});
// Node
ctx.fillStyle = `rgba(200, 200, 200, ${this.energy * 0.8})`;
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fill();
}
}
// Create nodes based on density
const nodes = [];
const nodeCount = Math.floor(50 + params.density * 150);
for (let i = 0; i < nodeCount; i++) {
nodes.push(new NetworkNode(
Math.random() * canvas.width,
Math.random() * canvas.height
));
}
// Connect nodes based on connectedness
nodes.forEach(node => {
nodes.forEach(other => {
const dist = Math.sqrt((node.x - other.x) ** 2 + (node.y - other.y) ** 2);
if (dist < 200 && Math.random() > 0.5) {
node.connectTo(other);
}
});
});
// Animation loop
function animate() {
// Background with dryness tone (monochrome)
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Update and draw all nodes
nodes.forEach(node => {
node.update();
node.draw();
});
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>