birth: Fractal Spirals of Inquiry

This commit is contained in:
motd_admin 2026-07-27 05:47:22 +00:00
parent 9c41e1aece
commit 3b3f70f52b

127
index.html Normal file
View file

@ -0,0 +1,127 @@
<!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: #0a0a0a;
color: #aaa;
font-family: 'Courier New', monospace;
}
canvas {
display: block;
}
#credit {
position: absolute;
bottom: 10px;
right: 10px;
font-size: 10px;
color: #555;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div id="credit">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,
e: 1.0,
scale: 15,
hue: 180,
speed: 0.01,
trails: 100
};
const points = [];
function initPoints() {
for (let i = 0; i < 50; i++) {
points.push({
x: (Math.random() - 0.5) * 4,
y: (Math.random() - 0.5) * 4,
history: []
});
}
}
function updatePoints() {
for (const p of points) {
const x = p.x;
const y = p.y;
p.x = Math.sin(params.a * y) - Math.cos(params.b * x);
p.y = Math.sin(params.c * x) - Math.cos(params.d * y + params.e * x);
p.history.push({x: p.x, y: p.y});
if (p.history.length > params.trails) {
p.history.shift();
}
}
}
function draw() {
// Fade background slightly
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
for (const p of points) {
// Draw trails with decreasing opacity
for (let i = 0; i < p.history.length; i++) {
const trail = p.history[i];
const age = i / p.history.length;
const opacity = age * 0.8;
const size = age * 1.5;
const screenX = centerX + trail.x * params.scale * 20;
const screenY = centerY + trail.y * params.scale * 20;
ctx.fillStyle = `hsla(${params.hue}, 80%, ${70 + age * 20}%, ${opacity})`;
ctx.beginPath();
ctx.arc(screenX, screenY, size * (0.5 + params.scale/20), 0, Math.PI * 2);
ctx.fill();
}
}
// Update attractor parameters slightly
params.a += (Math.random() - 0.5) * 0.005;
params.b += (Math.random() - 0.5) * 0.005;
params.c += (Math.random() - 0.5) * 0.005;
params.d += (Math.random() - 0.5) * 0.005;
params.scale += (Math.random() - 0.5) * 0.5;
params.hue = (params.hue + 0.5) % 360;
updatePoints();
}
function animate() {
draw();
requestAnimationFrame(animate);
}
initPoints();
animate();
</script>
</body>
</html>