160 lines
No EOL
5.8 KiB
HTML
160 lines
No EOL
5.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Neurameba · motd.social</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; overflow: hidden; }
|
|
canvas { display: block; width: 100vw; height: 100vh; }
|
|
#attribution { position: fixed; bottom: 10px; right: 10px; color: #aaa; font-family: monospace; font-size: 12px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="c"></canvas>
|
|
<div id="attribution">neurameba · motd.social</div>
|
|
<script>
|
|
const canvas = document.getElementById('c');
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
function resize() {
|
|
canvas.width = window.innerWidth;
|
|
canvas.height = window.innerHeight;
|
|
}
|
|
window.addEventListener('resize', resize);
|
|
resize();
|
|
|
|
// Parameters
|
|
const params = {
|
|
motion: 0.537,
|
|
density: 0.539,
|
|
complexity: 0.483,
|
|
connectedness: 0.524,
|
|
lifespan: 0.441,
|
|
survivingNodes: 91,
|
|
branchCount: 77,
|
|
loops: 1370,
|
|
maxDepth: 18,
|
|
thicknessRatio: 1.5,
|
|
fractalDimension: 1.689,
|
|
finalEnergy: 496.1,
|
|
pulse: { avg: 0.37, min: 0.3, max: 1.65 },
|
|
tone: { anger: 0.0, sadness: 0.0, curiosity: 0.1, dryness: 0.9, playfulness: 0.0, tension: 0.0 }
|
|
};
|
|
|
|
// Reaction-diffusion simulation
|
|
const size = Math.min(canvas.width, canvas.height) * 0.8;
|
|
const gridSize = Math.floor(size / 5);
|
|
const cellSize = size / gridSize;
|
|
const cols = Math.floor(canvas.width / cellSize);
|
|
const rows = Math.floor(canvas.height / cellSize);
|
|
|
|
let grid = new Array(cols * rows * 4).fill(0);
|
|
let nextGrid = new Array(cols * rows * 4).fill(0);
|
|
|
|
// Initialize with random sparse pattern
|
|
for (let i = 0; i < cols * rows; i++) {
|
|
const idx = i * 4;
|
|
if (Math.random() < params.density * 0.3) {
|
|
grid[idx] = 1;
|
|
grid[idx + 1] = 1;
|
|
}
|
|
}
|
|
|
|
// GrayWasser implementation
|
|
const Da = 1.0;
|
|
const Db = 0.5;
|
|
const f = 0.055;
|
|
const k = 0.062;
|
|
|
|
function updateGrid() {
|
|
const diffusionRateA = params.motion * 0.01;
|
|
const diffusionRateB = params.complexity * 0.01;
|
|
const feedRate = params.connectedness * 0.05;
|
|
const killRate = 1 - params.lifespan * 0.5;
|
|
|
|
for (let y = 1; y < rows - 1; y++) {
|
|
for (let x = 1; x < cols - 1; x++) {
|
|
const idx = (y * cols + x) * 4;
|
|
const idxT = ((y-1) * cols + x) * 4;
|
|
const idxB = ((y+1) * cols + x) * 4;
|
|
const idxL = (y * cols + (x-1)) * 4;
|
|
const idxR = (y * cols + (x+1)) * 4;
|
|
|
|
const a = grid[idx];
|
|
const b = grid[idx + 1];
|
|
|
|
nextGrid[idx] = a +
|
|
(diffusionRateA * (grid[idxT] + grid[idxB] + grid[idxL] + grid[idxR] - 4 * a) -
|
|
a * b * b +
|
|
feedRate * (1 - a)) * 0.5;
|
|
|
|
nextGrid[idx + 1] = b +
|
|
(diffusionRateB * (grid[idxT + 1] + grid[idxB + 1] + grid[idxL + 1] + grid[idxR + 1] - 4 * b) +
|
|
a * b * b -
|
|
(killRate + feedRate) * b) * 0.5;
|
|
|
|
// Apply pulse modulation
|
|
const pulse = params.pulse.avg * (1 + Math.sin(Date.now() * 0.001 * (params.pulse.max - params.pulse.min) + params.pulse.min));
|
|
nextGrid[idx] = Math.min(1, nextGrid[idx] * pulse);
|
|
nextGrid[idx + 1] = Math.min(1, nextGrid[idx + 1] * pulse);
|
|
}
|
|
}
|
|
|
|
[grid, nextGrid] = [nextGrid, grid];
|
|
}
|
|
|
|
function draw() {
|
|
ctx.fillStyle = '#0a0a0a';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Draw reaction-diffusion pattern
|
|
for (let y = 0; y < rows; y++) {
|
|
for (let x = 0; x < cols; x++) {
|
|
const idx = (y * cols + x) * 4;
|
|
const a = grid[idx];
|
|
|
|
if (a > 0.1) {
|
|
const b = grid[idx + 1];
|
|
const intensity = a * 255;
|
|
const hue = 0 + b * 120; // From red to green
|
|
|
|
ctx.fillStyle = `hsl(${hue}, 100%, ${intensity}%)`;
|
|
ctx.fillRect(
|
|
x * cellSize + (canvas.width - size) / 2,
|
|
y * cellSize + (canvas.height - size) / 2,
|
|
cellSize, cellSize
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Draw some network-like connections based on complexity
|
|
if (params.complexity > 0.5) {
|
|
ctx.strokeStyle = `rgba(100, 100, 100, ${params.connectedness})`;
|
|
ctx.lineWidth = params.thicknessRatio * 0.5;
|
|
|
|
for (let i = 0; i < params.loopCount * 0.1; i++) {
|
|
const x1 = Math.random() * size + (canvas.width - size) / 2;
|
|
const y1 = Math.random() * size + (canvas.height - size) / 2;
|
|
const x2 = Math.random() * size + (canvas.width - size) / 2;
|
|
const y2 = Math.random() * size + (canvas.height - size) / 2;
|
|
|
|
ctx.beginPath();
|
|
ctx.moveTo(x1, y1);
|
|
ctx.lineTo(x2, y2);
|
|
ctx.stroke();
|
|
}
|
|
}
|
|
}
|
|
|
|
function animate() {
|
|
updateGrid();
|
|
draw();
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |