birth: Glowing Fractured Pulses

This commit is contained in:
motd_admin 2026-11-17 06:21:27 +00:00
parent 0d540f3e79
commit fb68e2fe4b

237
index.html Normal file
View file

@ -0,0 +1,237 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Growing Pulses</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0a;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: 'Courier New', monospace;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
color: #333;
font-size: 11px;
text-align: center;
width: 100%;
}
</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 generative art system
const params = {
motion: 0.476,
density: 0.517,
complexity: 0.483,
connectedness: 0.498,
lifespan: 0.516,
survivingNodes: 94,
branchCount: 85,
loops: 1265,
maxDepth: 27,
thicknessRatio: 1.50,
fractalDim: 1.482,
finalEnergy: 525.5,
pulseAvg: 0.36,
pulseMin: 0.30,
pulseMax: 1.65,
tone: { dryness: 0.90 }
};
// Voronoi system with organic growth
class VoronoiOrganism {
constructor() {
this.seedNodes = [];
this.cells = [];
this.age = 0;
this.growthRate = params.pulseAvg * 1.5;
this.cellCount = Math.floor(params.survivingNodes * 5 + 10);
this.edgeDist = canvas.width * 0.4;
this.voronoi = new Voronoi();
this.init();
}
init() {
// Create seed points for Voronoi
for (let i = 0; i < this.cellCount; i++) {
this.seedNodes.push({
x: canvas.width/2 + (Math.random() - 0.5) * this.edgeDist,
y: canvas.height/2 + (Math.random() - 0.5) * this.edgeDist,
vx: (Math.random() - 0.5) * params.motion*2,
vy: (Math.random() - 0.5) * params.motion*2,
size: Math.random() * 5 + 2,
energy: params.finalEnergy / this.cellCount
});
}
// Initial Voronoi diagram
this.cells = this.voronoi.compute(this.seedNodes, {
xl: 0,
xr: canvas.width,
yt: 0,
yb: canvas.height
});
}
update() {
this.age++;
// Update positions with pulsation
const pulseScale = map(params.pulseMin, params.pulseMax,
0.8, 1.2,
Math.sin(this.age*0.02) * 0.5 + 0.5);
// Push seed nodes outward with organic motion
this.seedNodes.forEach(node => {
node.x += node.vx * pulseScale;
node.y += node.vy * pulseScale;
// Edge bouncing
if (node.x < 0 || node.x > canvas.width) node.vx *= -1;
if (node.y < 0 || node.y > canvas.height) node.vy *= -1;
// Add organic jitter
node.x += (Math.random() - 0.5) * params.motion*0.5;
node.y += (Math.random() - 0.5) * params.motion*0.5;
});
// Recompute Voronoi with moving sites
this.cells = this.voronoi.compute(this.seedNodes, {
xl: 0,
xr: canvas.width,
yt: 0,
yb: canvas.height
});
// Prune weak cells based on energy
this.cells = this.cells.filter(cell => {
const center = this.seedNodes[cell.site];
const distFromCenter = Math.hypot(
center.x - canvas.width/2,
center.y - canvas.height/2
);
const energyFactor = center.energy / params.finalEnergy;
const survivalChance = energyFactor * params.lifespan;
return Math.random() < survivalChance &&
distFromCenter < this.edgeDist * 1.1;
});
}
draw() {
ctx.strokeStyle = `rgba(200, 200, 200, ${map(0, 1, 0.1, 0.3, params.dryness)})`;
ctx.lineWidth = params.thicknessRatio * 1.2;
this.cells.forEach(cell => {
if (cell.halfedges.length === 0) return;
const points = cell.halfedges.map(he => {
const site = this.seedNodes[he.getStartpoint().voronoiId];
return {x: site.x, y: site.y};
});
// Draw cell outline
ctx.beginPath();
ctx.moveTo(points[0].x, points[0].y);
for (let i = 1; i < points.length; i++) {
ctx.lineTo(points[i].x, points[i].y);
}
ctx.closePath();
ctx.stroke();
// Fill interior
const center = this.seedNodes[cell.site];
const distFromCenter = Math.hypot(
center.x - canvas.width/2,
center.y - canvas.height/2
);
if (params.tone.dryness > 0.8) {
const alpha = map(0, this.edgeDist, 0.05, 0.2, distFromCenter);
ctx.fillStyle = `rgba(50, 50, 50, ${alpha})`;
ctx.fill();
// Add subtle noise pattern
ctx.save();
ctx.globalCompositeOperation = 'overlay';
ctx.fillStyle = `rgba(255, 255, 255, ${alpha*0.2})`;
points.forEach(p => {
ctx.beginPath();
ctx.arc(p.x, p.y, 1, 0, Math.PI*2);
ctx.fill();
});
ctx.restore();
} else {
ctx.fillStyle = `rgba(100, 200, 255, ${0.1})`;
ctx.fill();
}
});
}
}
// Simple Voronoi implementation
class Voronoi {
compute(sites, bbox) {
// This is a simplified version - in practice use a proper Voronoi library
// For this demo we'll simulate the behavior
return sites.map((site, i) => {
return {
site: i,
halfedges: []
};
});
}
}
// Helper mapping function
function map(fromMin, fromMax, toMin, toMax, value) {
return (value - fromMin) * (toMax - toMin) / (fromMax - fromMin) + toMin;
}
// Main animation
const organism = new VoronoiOrganism();
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
// Draw subtle background pattern
ctx.fillStyle = `rgba(10, 10, 15, 0.1)`;
ctx.fillRect(0, 0, canvas.width, canvas.height);
organism.update();
organism.draw();
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>