birth: Ebbing Teal Symbiosis
This commit is contained in:
parent
fec957d186
commit
88c57e5d01
1 changed files with 146 additions and 0 deletions
146
index.html
Normal file
146
index.html
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
<!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;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #0a0a0a;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
}
|
||||||
|
#canvas {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#attribution {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
right: 10px;
|
||||||
|
color: #555;
|
||||||
|
font-size: 10px;
|
||||||
|
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();
|
||||||
|
|
||||||
|
// Parameters derived from input
|
||||||
|
const motion = 0.474;
|
||||||
|
const density = 0.508;
|
||||||
|
const complexity = 0.570;
|
||||||
|
const connectedness = 0.466;
|
||||||
|
const lifespan = 0.526;
|
||||||
|
|
||||||
|
// Tone parameters
|
||||||
|
const curiosity = 0.70;
|
||||||
|
const dryness = 0.90;
|
||||||
|
const playfulness = 0.10;
|
||||||
|
|
||||||
|
// Reaction-diffusion parameters
|
||||||
|
const feed = 0.055 + (motion * 0.02);
|
||||||
|
const kill = 0.062 - (connectedness * 0.02);
|
||||||
|
const deltaTime = 0.2;
|
||||||
|
const cellSize = 4 - (density * 1.5);
|
||||||
|
|
||||||
|
// Initialize grids
|
||||||
|
const gridWidth = Math.floor(canvas.width / cellSize);
|
||||||
|
const gridHeight = Math.floor(canvas.height / cellSize);
|
||||||
|
let currentGrid = new Float64Array(gridWidth * gridHeight);
|
||||||
|
let nextGrid = new Float64Array(gridWidth * gridHeight);
|
||||||
|
|
||||||
|
// Initialize with sparse random values where density is low
|
||||||
|
for (let i = 0; i < currentGrid.length; i++) {
|
||||||
|
if (Math.random() < (0.1 + density * 0.3)) {
|
||||||
|
currentGrid[i] = Math.random() * 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Color palette based on tone
|
||||||
|
function getColor(value) {
|
||||||
|
const baseHue = 160 + (curiosity * 20); // Teals from curiosity
|
||||||
|
const saturation = 70 + (playfulness * 30);
|
||||||
|
const lightness = 30 + (value * 50) * (1 - dryness);
|
||||||
|
return `hsl(${baseHue}, ${saturation}%, ${lightness}%)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateGrid() {
|
||||||
|
for (let x = 1; x < gridWidth - 1; x++) {
|
||||||
|
for (let y = 1; y < gridHeight - 1; y++) {
|
||||||
|
const i = x + y * gridWidth;
|
||||||
|
const cell = currentGrid[i];
|
||||||
|
|
||||||
|
// Calculate neighbors
|
||||||
|
const neighbors = (
|
||||||
|
currentGrid[i - 1] + currentGrid[i + 1] +
|
||||||
|
currentGrid[i - gridWidth] + currentGrid[i + gridWidth] +
|
||||||
|
currentGrid[i - gridWidth - 1] + currentGrid[i - gridWidth + 1] +
|
||||||
|
currentGrid[i + gridWidth - 1] + currentGrid[i + gridWidth + 1]
|
||||||
|
) / 8;
|
||||||
|
|
||||||
|
// Reaction-diffusion equations
|
||||||
|
nextGrid[i] = cell +
|
||||||
|
deltaTime * (
|
||||||
|
cell * (feed - kill) - (feed + kill) * neighbors / (cell + neighbors + 1)
|
||||||
|
) +
|
||||||
|
deltaTime * (connectedness * 0.1) * (Math.random() - 0.5);
|
||||||
|
|
||||||
|
// Subtract slightly where loops aren't expected
|
||||||
|
if (cell > 0.1 && neighbors < 0.2) {
|
||||||
|
nextGrid[i] *= 0.98;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap grids
|
||||||
|
[currentGrid, nextGrid] = [nextGrid, currentGrid];
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawGrid() {
|
||||||
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
for (let x = 0; x < gridWidth; x++) {
|
||||||
|
for (let y = 0; y < gridHeight; y++) {
|
||||||
|
const i = x + y * gridWidth;
|
||||||
|
const value = currentGrid[i];
|
||||||
|
|
||||||
|
if (value > 0.01) {
|
||||||
|
const cellValue = Math.min(value * complexity, 1);
|
||||||
|
const size = cellSize * (0.5 + cellValue * 0.5);
|
||||||
|
const xPos = x * cellSize;
|
||||||
|
const yPos = y * cellSize;
|
||||||
|
|
||||||
|
ctx.fillStyle = getColor(cellValue);
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.ellipse(xPos + cellSize/2, yPos + cellSize/2, size, size * (0.7 + motion * 0.3), 0, 0, Math.PI * 2);
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function animate() {
|
||||||
|
updateGrid();
|
||||||
|
drawGrid();
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
animate();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue