birth: Electromagnetic Teal Quiver

This commit is contained in:
motd_admin 2026-08-11 06:21:23 +00:00
parent de0cefaf94
commit 04a096cb5c

147
index.html Normal file
View file

@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Strange Attractor</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #0a0a1a;
font-family: 'Courier New', monospace;
color: #a0a0d0;
}
canvas {
display: block;
}
#attribution {
position: fixed;
bottom: 15px;
left: 15px;
font-size: 10px;
opacity: 0.6;
user-select: none;
}
</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();
// Strange attractor parameters
const params = {
a: 2.24,
b: 0.43,
c: -0.65,
d: -2.43,
scale: 30,
motion: 0.536,
density: 0.189,
complexity: 0.833,
connectedness: 0.694,
lifespan: 0.477,
pulse: { avg: 0.37, min: 0.30, max: 1.25 }
};
// Color palette (dryness=monochrome, curiosity=teals)
const colors = {
bg: '#0a0a1a',
particle: `hsl(${Math.random() * 30 + 180}, 30%, ${50 + Math.sin(Date.now() * 0.001) * 5}%)`
};
// Particle system
class Particle {
constructor() {
this.reset();
this.life = 0;
this.maxLife = 100 + Math.random() * 50;
}
reset() {
this.x = Math.random() * 2 - 1;
this.y = Math.random() * 2 - 1;
this.z = Math.random() * 2 - 1;
this.vx = 0;
this.vy = 0;
this.vz = 0;
this.size = 0.1 + Math.random() * 0.3 * params.scale * 0.1;
}
update() {
// Strange attractor equations
const dt = 0.01 * params.motion;
const px = this.x;
const py = this.y;
const pz = this.z;
this.vx += dt * (params.a * px + params.b * py);
this.vy += dt * (params.c * px + (params.d - pz * pz) * py);
this.vz += dt * (1 + pz * pz);
this.x += this.vx;
this.y += this.vy;
this.z += this.vz;
this.life++;
// Pulse modulation
const pulse = params.pulse.avg + Math.sin(Date.now() * 0.001) * (params.pulse.max - params.pulse.min) * 0.5;
this.size = Math.max(0.01, this.size * pulse * 0.5);
}
draw() {
const scale = canvas.width / 4 * params.scale;
const x = canvas.width / 2 + this.x * scale;
const y = canvas.height / 2 + this.y * scale;
const age = this.life / this.maxLife;
const alpha = Math.min(1, age) * 0.8;
ctx.fillStyle = `rgba(0, ${Math.floor(50 + age * 50)}, ${Math.floor(150 + age * 100)}, ${alpha})`;
ctx.beginPath();
ctx.arc(x, y, this.size, 0, Math.PI * 2);
ctx.fill();
}
}
const particles = [];
const particleCount = Math.floor(50 + params.density * params.complexity * 200);
for (let i = 0; i < particleCount; i++) {
particles.push(new Particle());
}
function animate() {
// Clear with alpha for some motion trails
ctx.fillStyle = 'rgba(10, 10, 26, 0.1)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
particles.forEach(p => {
p.update();
p.draw();
// Occasionally reset particles that have lived too long
if (p.life > p.maxLife) {
p.reset();
}
});
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>