birth: Teal Tendrils in Dissolution

This commit is contained in:
motd_admin 2026-10-31 10:21:24 +00:00
parent e0b4e96bee
commit a21d5833ef

162
index.html Normal file
View file

@ -0,0 +1,162 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Diffusive Tendrils</title>
<style>
body { margin: 0; overflow: hidden; background: #0a0a1a; }
canvas { display: block; }
#attribution { position: fixed; bottom: 10px; right: 10px; color: #4a6b7c; font-family: monospace; font-size: 10px; }
</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();
// Parameters derived from prompt
const params = {
motion: 0.582,
density: 0.505,
complexity: 0.551,
connectedness: 0.492,
lifespan: 0.436,
pulse: { avg: 0.82, min: 0.30, max: 2.00 },
tone: { anger: 0.00, sadness: 0.00, curiosity: 0.70, dryness: 0.80, playfulness: 0.10, tension: 0.00 },
topology: {
nodes: 83,
branches: 63,
loops: 208,
maxDepth: 17,
thicknessRatio: 1.25,
fractalDimension: 1.661,
finalEnergy: 408.7
}
};
// Color palette based on tone
const palette = {
bg: '#0a0a1a',
fg: '#4a6b7c',
primary: { r: 120, g: 200, b: 180 }, // curiosity teal
secondary: { r: 150, g: 150, b: 130 } // dryness monochrome
};
// Reaction-diffusion parameters
const RD_PARAMS = {
feed: 0.055 + params.motion * 0.02,
kill: 0.062 - params.connectedness * 0.015,
diffusionA: 1.0,
diffusionB: 0.5,
timeStep: 0.12 * params.motion,
decay: 0.98 - params.lifespan * 0.15,
pulse: params.pulse.avg
};
// Grid setup
const gridSize = Math.floor(120 * (1 + params.density * 0.8));
const cellSize = Math.max(2, Math.min(6, 8 - params.complexity * 3));
const cols = Math.ceil(canvas.width / cellSize);
const rows = Math.ceil(canvas.height / cellSize);
// State buffers
const state = new Float32Array(cols * rows * 4);
const nextState = new Float32Array(cols * rows * 4);
// Initialize with sparse activations
for (let i = 0; i < state.length; i += 4) {
state[i] = Math.random() < 0.05 ? 1 : 0;
}
function laplacian(x, y) {
let sum = 0;
let count = 0;
for (let dy = -1; dy <= 1; dy++) {
for (let dx = -1; dx <= 1; dx++) {
if (dx === 0 && dy === 0) continue;
const nx = (x + dx + cols) % cols;
const ny = (y + dy + rows) % rows;
const idx = (ny * cols + nx) * 4;
sum += state[idx];
count++;
}
}
return sum / count;
}
function update() {
// Pulse modulation
const pulseFactor = params.pulse.min +
(params.pulse.max - params.pulse.min) *
(Math.sin(Date.now() * 0.001 * params.pulse.avg) * 0.5 + 0.5);
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
const idx = (y * cols + x) * 4;
const a = state[idx];
const b = state[idx + 1];
const laplacianA = laplacian(x, y);
// Reaction-diffusion equations
const reactionA = a * (RD_PARAMS.feed - laplacianA) - a * b * b;
const reactionB = RD_PARAMS.kill * a + a * b * b;
nextState[idx] = Math.min(1, Math.max(0, a + (RD_PARAMS.diffusionA * laplacianA + reactionA) * RD_PARAMS.timeStep * pulseFactor));
nextState[idx + 1] = Math.min(1, Math.max(0, b + (RD_PARAMS.diffusionB * laplacian(x, y, 1) + reactionB) * RD_PARAMS.timeStep * pulseFactor));
nextState[idx + 2] = 0;
nextState[idx + 3] = RD_PARAMS.decay;
}
}
// Swap buffers
const temp = state;
state.set(nextState);
nextState.set(temp);
// Render
ctx.fillStyle = palette.bg;
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
const idx = (y * cols + x) * 4;
// Calculate color from reaction-diffusion
const a = state[idx];
const b = state[idx + 1];
const energy = (a + b) * 0.5;
// Desaturated teal with dryness
const r = palette.primary.r * energy * params.tone.curiosity;
const g = palette.primary.g * energy * params.tone.curiosity * 0.9;
const bVal = palette.primary.b * energy * params.tone.curiosity * 0.8;
ctx.fillStyle = `rgba(${r}, ${g}, ${bVal}, ${state[idx + 2]})`;
ctx.fillRect(x * cellSize, y * cellSize, cellSize, cellSize);
}
}
}
function animate() {
update();
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>