birth: Pulsing Data Organisms

This commit is contained in:
motd_admin 2026-10-12 22:21:22 +00:00
parent 934640c18e
commit 8b54e0f053

159
index.html Normal file
View file

@ -0,0 +1,159 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neurameba Particle System</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #111;
color: #999;
font-family: 'Courier New', monospace;
display: flex;
flex-direction: column;
height: 100vh;
}
canvas {
flex: 1;
}
.attribution {
text-align: center;
padding: 8px;
font-size: 10px;
background-color: rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div class="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();
// Simulation parameters
const params = {
motion: 0.5,
density: 0.5,
complexity: 0.5,
connectedness: 0.5,
lifespan: 0.5,
pulse: 1.05,
tone: {
dryness: 0.9,
curiosity: 0.1
}
};
const particleCount = Math.floor(200 + 800 * params.density * params.complexity);
const particles = [];
const connections = [];
const maxConnections = Math.floor(50 + 200 * params.connectedness);
const baseSize = 1 + 3 * params.complexity;
const maxSpeed = 0.5 + 2 * params.motion;
const maxLifespan = 50 + 200 * params.lifespan;
const colorMin = 200;
const colorMax = 240;
const hueVariation = 20;
const hueCenter = 180 + (params.tone.curiosity * 60);
class Particle {
constructor() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.size = baseSize * (0.5 + Math.random() * 0.5);
this.speedX = (Math.random() - 0.5) * maxSpeed * 2;
this.speedY = (Math.random() - 0.5) * maxSpeed * 2;
this.lifespan = maxLifespan * (0.3 + 0.7 * Math.random());
this.maxLifespan = this.lifespan;
this.hue = hueCenter + (Math.random() - 0.5) * hueVariation;
this.alpha = 0.8;
this.connectionCount = 0;
}
update() {
this.x += this.speedX * params.pulse;
this.y += this.speedY * params.pulse;
this.lifespan--;
// Bounce off edges
if (this.x < 0 || this.x > canvas.width) this.speedX *= -1;
if (this.y < 0 || this.y > canvas.height) this.speedY *= -1;
// Fade out as lifespan decreases
this.alpha = this.lifespan / this.maxLifespan * 0.8;
// Occasionally create new connections
if (Math.random() < 0.02 * params.connectedness && this.connectionCount < 2) {
this.connectionCount++;
for (let i = 0; i < particles.length; i++) {
if (particles[i].connectionCount < 2) {
connections.push({
from: this,
to: particles[i],
strength: 0.5 + Math.random() * 0.5
});
break;
}
}
}
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size * (0.5 + 0.5 * Math.random()), 0, Math.PI * 2);
ctx.fillStyle = `hsla(${this.hue}, 30%, 70%, ${this.alpha})`;
ctx.fill();
}
}
// Initialize particles
for (let i = 0; i < particleCount; i++) {
particles.push(new Particle());
}
function animate() {
// Clear with slight fade for trails
ctx.fillStyle = 'rgba(17, 17, 17, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Update and draw particles
particles.forEach(p => {
p.update();
p.draw();
});
// Update and draw connections
connections.forEach(conn => {
ctx.beginPath();
ctx.moveTo(conn.from.x, conn.from.y);
ctx.lineTo(conn.to.x, conn.to.y);
ctx.strokeStyle = `hsla(${hueCenter}, 20%, 60%, ${conn.strength * 0.3})`;
ctx.lineWidth = 1 * conn.strength;
ctx.stroke();
});
// Occasionally remove old connections
if (Math.random() < 0.01) {
if (connections.length > 0) {
connections.splice(Math.floor(Math.random() * connections.length), 1);
}
}
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>