136 lines
No EOL
4.6 KiB
HTML
136 lines
No EOL
4.6 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>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background: #0a0a1a;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#info {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
left: 0;
|
|
right: 0;
|
|
text-align: center;
|
|
color: #666;
|
|
font-size: 10px;
|
|
pointer-events: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas"></canvas>
|
|
<div id="info">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();
|
|
|
|
// Parameters adjusted from input
|
|
const params = {
|
|
motion: 0.5,
|
|
density: 0.5,
|
|
complexity: 0.5,
|
|
connectedness: 0.5,
|
|
lifespan: 0.5,
|
|
tone: { dryness: 0.9, curiosity: 0.1 }
|
|
};
|
|
|
|
// Reaction-diffusion system (Gray-Scott model)
|
|
const gridSize = Math.min(100, Math.max(50, 20 + params.density * 100));
|
|
const cellSize = Math.max(2, Math.floor(Math.min(canvas.width, canvas.height) / gridSize));
|
|
|
|
const cols = Math.floor(canvas.width / cellSize);
|
|
const rows = Math.floor(canvas.height / cellSize);
|
|
|
|
let currentGrid = new Array(rows).fill().map(() => new Array(cols).fill(0));
|
|
let nextGrid = new Array(rows).fill().map(() => new Array(cols).fill(0));
|
|
|
|
// Initialize with sparse random pattern
|
|
for (let i = 0; i < rows; i++) {
|
|
for (let j = 0; j < cols; j++) {
|
|
currentGrid[i][j] = Math.random() < params.density ? 1 : 0;
|
|
}
|
|
}
|
|
|
|
// Gray-Scott parameters adjusted for organic patterns
|
|
const f = 0.055 + params.motion * 0.02;
|
|
const k = 0.062 + params.connectedness * 0.015;
|
|
const dt = 1 + params.motion * 0.5;
|
|
|
|
// Color scheme based on tone
|
|
const hueBase = 180 + Math.sin(Date.now() * 0.001) * 30; // Base hue oscillating
|
|
const saturation = params.tone.dryness > 0.5 ? 0 : 20 + params.tone.curiosity * 30;
|
|
const brightness = 40 + params.motion * 20;
|
|
|
|
function updateGrid() {
|
|
for (let i = 1; i < rows - 1; i++) {
|
|
for (let j = 1; j < cols - 1; j++) {
|
|
const u = currentGrid[i][j];
|
|
const v = nextGrid[i][j];
|
|
|
|
// Compute Laplacian (diffusion)
|
|
const laplacianU = (currentGrid[i-1][j] + currentGrid[i+1][j] +
|
|
currentGrid[i][j-1] + currentGrid[i][j+1] -
|
|
4 * u) * 0.2;
|
|
|
|
// Gray-Scott reaction terms
|
|
const reaction = u * u * v;
|
|
const newU = u + dt * (params.motion * 0.1 * laplacianU - reaction + f * (1 - u));
|
|
const newV = v + dt * (params.motion * 0.1 * laplacianU + reaction - (f + k) * v);
|
|
|
|
nextGrid[i][j] = Math.max(0, Math.min(1, newV));
|
|
currentGrid[i][j] = Math.max(0, Math.min(1, newU));
|
|
}
|
|
}
|
|
|
|
// Swap grids
|
|
[currentGrid, nextGrid] = [nextGrid, currentGrid];
|
|
}
|
|
|
|
function drawGrid() {
|
|
ctx.fillStyle = `hsl(${hueBase}, ${saturation}%, ${brightness}%)`;
|
|
|
|
for (let i = 0; i < rows; i++) {
|
|
for (let j = 0; j < cols; j++) {
|
|
const v = currentGrid[i][j];
|
|
if (v > 0.01) {
|
|
ctx.globalAlpha = Math.min(1, v * 2);
|
|
ctx.fillRect(j * cellSize, i * cellSize, cellSize, cellSize);
|
|
}
|
|
}
|
|
}
|
|
ctx.globalAlpha = 1;
|
|
}
|
|
|
|
function animate() {
|
|
updateGrid();
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Draw with some motion blur effect
|
|
ctx.fillStyle = 'rgba(10, 10, 26, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
drawGrid();
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |