birth: Fractal Veins in Drift

This commit is contained in:
motd_admin 2026-06-13 09:47:17 +00:00
parent c2b0244839
commit 8d14751e7c

136
index.html Normal file
View file

@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Recursive Fractal Drift</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0a;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: #cccccc;
font-family: 'Courier New', monospace;
text-align: center;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 20px;
font-size: 10px;
color: #666;
pointer-events: 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();
const params = {
motion: 0.5,
density: 0.5,
complexity: 0.5,
connectedness: 0.5,
lifespan: 0.5,
pulse: { avg: 1.09, min: 1.0, max: 1.2 },
tone: { anger: 0.0, sadness: 0.0, curiosity: 0.1, dryness: 0.9, playfulness: 0.0, tension: 0.0 }
};
let t = 0;
let nodes = [];
function initNodes() {
nodes = [];
const count = 5 + Math.floor(params.density * 20);
for (let i = 0; i < count; i++) {
nodes.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
size: 1 + Math.random() * 3,
angle: Math.random() * Math.PI * 2,
depth: 0,
color: `hsla(0, 0%, ${70 + Math.random() * 10}%, 0.8)`,
branch: null
});
}
}
function drawFractalNode(x, y, size, angle, depth, parentColor) {
if (depth > 5) return;
const twist = Math.sin(t * 0.1 + depth) * 0.5;
const branchAngle = angle + twist;
const branchLength = size * (0.6 + Math.sin(t * 0.05) * 0.2);
const endX = x + Math.cos(branchAngle) * branchLength;
const endY = y + Math.sin(branchAngle) * branchLength;
const hue = 0;
const saturation = 10 + Math.sin(t * 0.02 + depth) * 5;
const lightness = 70 + Math.sin(t * 0.03 + depth) * 10;
const alpha = 0.7 * (1 - depth * 0.15);
ctx.strokeStyle = `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha})`;
ctx.lineWidth = size * (0.8 + Math.sin(t * 0.04) * 0.3);
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(endX, endY);
ctx.stroke();
if (depth < 3 && Math.random() > 0.6) {
drawFractalNode(endX, endY, size * 0.6, branchAngle + Math.PI/4, depth+1, {h: hue, s: saturation, l: lightness});
drawFractalNode(endX, endY, size * 0.6, branchAngle - Math.PI/4, depth+1, {h: hue, s: saturation, l: lightness});
}
}
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
const pulse = params.pulse.avg + Math.sin(t * 0.01) * 0.1;
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
node.angle += (Math.random() - 0.5) * 0.02 * params.motion * pulse;
node.size = 1 + 2 * params.density * Math.sin(t * 0.03 + i);
}
for (let i = 0; i < nodes.length; i++) {
drawFractalNode(
nodes[i].x,
nodes[i].y,
nodes[i].size,
nodes[i].angle,
0,
null
);
}
t += 0.02;
requestAnimationFrame(animate);
}
initNodes();
animate();
</script>
</body>
</html>