birth: Frayed Connections in Static
This commit is contained in:
parent
d9e981bb4d
commit
980d0ab1a1
1 changed files with 151 additions and 0 deletions
151
index.html
Normal file
151
index.html
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Neurameba Art</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #0a0a0a;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
#attribution {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
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 the abstract specification
|
||||
const params = {
|
||||
motion: 0.5,
|
||||
density: 0.5,
|
||||
complexity: 0.5,
|
||||
connectedness: 0.5,
|
||||
lifespan: 0.5,
|
||||
pulse: { avg: 1.06, min: 1.0, max: 1.1 },
|
||||
tone: { dryness: 0.9, curiosity: 0.1 }
|
||||
};
|
||||
|
||||
// Network graph simulation
|
||||
const nodes = [];
|
||||
const edges = [];
|
||||
const nodeCount = Math.floor(100 + params.density * 200);
|
||||
const edgeProbability = 0.15 + params.connectedness * 0.3;
|
||||
const maxConnections = Math.floor(2 + params.complexity * 8);
|
||||
|
||||
// Initialize nodes
|
||||
for (let i = 0; i < nodeCount; i++) {
|
||||
nodes.push({
|
||||
x: Math.random() * canvas.width,
|
||||
y: Math.random() * canvas.height,
|
||||
vx: (Math.random() - 0.5) * params.motion * 2,
|
||||
vy: (Math.random() - 0.5) * params.motion * 2,
|
||||
size: 1 + Math.random() * 3 * params.density,
|
||||
color: `rgba(150, 150, 150, ${0.5 + 0.5 * params.dryness})`,
|
||||
life: 0,
|
||||
maxLife: 100 + params.lifespan * 200
|
||||
});
|
||||
}
|
||||
|
||||
// Create edges based on proximity and connectedness
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
for (let j = i + 1; j < nodes.length; j++) {
|
||||
const dx = nodes[j].x - nodes[i].x;
|
||||
const dy = nodes[j].y - nodes[i].y;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (distance < 200 * (0.5 + params.density) &&
|
||||
Math.random() < edgeProbability &&
|
||||
edges.filter(e => (e.from === i && e.to === j) || (e.from === j && e.to === i)).length < maxConnections) {
|
||||
|
||||
edges.push({
|
||||
from: i,
|
||||
to: j,
|
||||
distance: distance,
|
||||
strength: 0.1 + Math.random() * 0.3 * params.connectedness
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Animation
|
||||
let time = 0;
|
||||
function animate() {
|
||||
ctx.fillStyle = 'rgba(10, 10, 10, 0.1)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Update nodes
|
||||
nodes.forEach(node => {
|
||||
node.x += node.vx;
|
||||
node.y += node.vy;
|
||||
|
||||
// Boundary check
|
||||
if (node.x < 0 || node.x > canvas.width) node.vx *= -1;
|
||||
if (node.y < 0 || node.y > canvas.height) node.vy *= -1;
|
||||
|
||||
node.life = (node.life + 1) % node.maxLife;
|
||||
const pulse = params.pulse.avg + Math.sin(time * 0.01) * 0.05;
|
||||
node.size = 1 + Math.sin(node.life * 0.01 * pulse) * 1.5 * params.density;
|
||||
});
|
||||
|
||||
// Draw edges
|
||||
edges.forEach(edge => {
|
||||
const fromNode = nodes[edge.from];
|
||||
const toNode = nodes[edge.to];
|
||||
const dx = toNode.x - fromNode.x;
|
||||
const dy = toNode.y - fromNode.y;
|
||||
const length = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
const alpha = 0.1 + 0.2 * params.connectedness * (1 - length / 200);
|
||||
ctx.strokeStyle = `rgba(180, 200, 220, ${alpha})`;
|
||||
ctx.lineWidth = 0.5 + edge.strength * params.density;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(fromNode.x, fromNode.y);
|
||||
ctx.lineTo(toNode.x, toNode.y);
|
||||
ctx.stroke();
|
||||
});
|
||||
|
||||
// Draw nodes
|
||||
nodes.forEach(node => {
|
||||
const pulse = params.pulse.avg + Math.sin(time * 0.02) * 0.05;
|
||||
const size = node.size * pulse;
|
||||
const glow = 0.3 + 0.7 * Math.sin(time * 0.05 + node.x * 0.01);
|
||||
|
||||
ctx.fillStyle = `rgba(${200 + Math.sin(time * 0.1) * 50}, ${210 + Math.cos(time * 0.07) * 40}, ${230 + Math.sin(time * 0.03) * 60}, ${0.5 + 0.5 * glow})`;
|
||||
ctx.beginPath();
|
||||
ctx.arc(node.x, node.y, size, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
});
|
||||
|
||||
time++;
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue