159 lines
No EOL
5.1 KiB
HTML
159 lines
No EOL
5.1 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 Network</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: #333;
|
|
font-size: 10px;
|
|
text-shadow: 0 0 5px rgba(0,0,0,0.5);
|
|
}
|
|
</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 abstract specs
|
|
const params = {
|
|
motion: 0.5,
|
|
density: 0.5,
|
|
complexity: 0.5,
|
|
connectedness: 0.5,
|
|
lifespan: 0.5,
|
|
pulse: 1.08,
|
|
dryness: 0.9
|
|
};
|
|
|
|
// Network graph configuration
|
|
const nodes = [];
|
|
const edges = [];
|
|
const maxNodes = Math.floor(30 + params.density * 100);
|
|
const maxEdges = Math.floor(params.connectedness * 500);
|
|
const nodeSize = 2 + params.complexity * 3;
|
|
const edgeThickness = 0.5 + params.connectedness * 1.5;
|
|
const color = params.dryness > 0.7 ? '#e0e0e0' : '#a0a0ff';
|
|
|
|
// Initialize network
|
|
function initNetwork() {
|
|
nodes.length = 0;
|
|
edges.length = 0;
|
|
|
|
// Create nodes with random positions
|
|
for (let i = 0; i < maxNodes; 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: nodeSize,
|
|
lifespan: params.lifespan * 1000 + Math.random() * 1000,
|
|
age: 0
|
|
});
|
|
}
|
|
|
|
// Create edges between nodes
|
|
for (let i = 0; i < nodes.length; i++) {
|
|
for (let j = i + 1; j < nodes.length; j++) {
|
|
if (Math.random() < params.connectedness * 0.3) {
|
|
const distance = Math.hypot(
|
|
nodes[i].x - nodes[j].x,
|
|
nodes[i].y - nodes[j].y
|
|
);
|
|
edges.push({
|
|
from: i,
|
|
to: j,
|
|
distance,
|
|
thickness: edgeThickness,
|
|
pulse: 1 + (Math.random() - 0.5) * 0.1
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
initNetwork();
|
|
|
|
// Animation loop
|
|
function animate() {
|
|
// Clear with slight fade
|
|
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Update nodes
|
|
nodes.forEach(node => {
|
|
node.x += node.vx;
|
|
node.y += node.vy;
|
|
node.vx += (Math.random() - 0.5) * 0.01 * params.motion;
|
|
node.vy += (Math.random() - 0.5) * 0.01 * params.motion;
|
|
|
|
// 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.age++;
|
|
});
|
|
|
|
// Draw edges with pulsing effect
|
|
edges.forEach(edge => {
|
|
const fromNode = nodes[edge.from];
|
|
const toNode = nodes[edge.to];
|
|
const currentDistance = Math.hypot(
|
|
fromNode.x - toNode.x,
|
|
fromNode.y - toNode.y
|
|
);
|
|
|
|
// Calculate pulse effect
|
|
const pulseFactor = 1 + Math.sin(Date.now() * 0.001 * edge.pulse) * 0.1;
|
|
|
|
// Only draw if not too far apart
|
|
if (currentDistance < 200 * params.complexity + 100) {
|
|
ctx.beginPath();
|
|
ctx.moveTo(fromNode.x, fromNode.y);
|
|
ctx.lineTo(toNode.x, toNode.y);
|
|
ctx.strokeStyle = color;
|
|
ctx.lineWidth = edge.thickness * pulseFactor * 0.5;
|
|
ctx.stroke();
|
|
}
|
|
});
|
|
|
|
// Draw nodes
|
|
nodes.forEach(node => {
|
|
ctx.beginPath();
|
|
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
|
|
ctx.fillStyle = color;
|
|
ctx.fill();
|
|
});
|
|
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |