birth: Fractal Ghosts in the Static

This commit is contained in:
motd_admin 2026-08-27 18:21:19 +00:00
parent 4ad7e102ec
commit c123871826

145
index.html Normal file
View file

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neurameba Strange Attractor</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #000;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
canvas {
display: block;
}
.attribution {
position: fixed;
bottom: 20px;
right: 20px;
color: rgba(255, 255, 255, 0.3);
font-family: monospace;
font-size: 10px;
pointer-events: none;
}
</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');
// Set canvas to full window size
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// Strange attractor parameters
const points = [];
const maxPoints = 300;
const step = 0.01;
let time = 0;
// Base parameters for a chaotic attractor
const a = 1.4;
const b = 0.3;
// Color palette (dryness=monochrome)
const palette = {
white: '#ffffff',
dark: '#111111',
mid: '#444444'
};
function initPoints() {
points.length = 0;
for (let i = 0; i < maxPoints; i++) {
points.push({
x: Math.random() * 2 - 1,
y: Math.random() * 2 - 1,
size: 0.5 + Math.random() * 0.5
});
}
}
function updatePoints() {
for (let i = 0; i < points.length; i++) {
const p = points[i];
// Strange attractor equations (Henon-like)
const x = p.x;
const y = p.y;
p.x = y + 1 - a * x * x;
p.y = b * x;
// Apply circular boundary
const dist = Math.sqrt(p.x * p.x + p.y * p.y);
if (dist > 2) {
p.x *= 0.9;
p.y *= 0.9;
}
}
}
function draw() {
// Fade background slightly
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Draw points with motion blur
ctx.fillStyle = palette.white;
for (let i = 0; i < points.length; i++) {
const p = points[i];
// Size based on density parameter
const size = p.size * 2 * (0.5 + 0.5 * Math.sin(time * 0.1)) * 1.5;
// Position in center of canvas
const x = (p.x * 0.4 + 0.5) * canvas.width;
const y = (p.y * 0.4 + 0.5) * canvas.height;
// Draw with slight glow
const glow = size * 1.5;
ctx.beginPath();
ctx.arc(x, y, glow, 0, Math.PI * 2);
ctx.fillStyle = `rgba(255, 255, 255, 0.1)`;
ctx.fill();
ctx.beginPath();
ctx.arc(x, y, size, 0, Math.PI * 2);
ctx.fillStyle = palette.white;
ctx.fill();
}
time += step;
updatePoints();
}
let animationId;
function animate() {
draw();
animationId = requestAnimationFrame(animate);
}
initPoints();
animate();
// Clean up on unload
window.addEventListener('unload', () => {
cancelAnimationFrame(animationId);
});
</script>
</body>
</html>