birth: Monochrome Pulse Network
This commit is contained in:
parent
005f06911b
commit
149348360c
1 changed files with 175 additions and 0 deletions
175
index.html
Normal file
175
index.html
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Neurameba Motd</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #0a0a0a;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
font-family: monospace;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
#info {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
color: #666;
|
||||
font-size: 10px;
|
||||
text-shadow: 0 0 5px rgba(0,0,0,0.7);
|
||||
}
|
||||
</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 derived from the abstract spec
|
||||
const params = {
|
||||
motion: 0.538,
|
||||
density: 0.516,
|
||||
complexity: 0.485,
|
||||
connectedness: 0.473,
|
||||
lifespan: 0.537,
|
||||
survivingNodes: 144,
|
||||
branchCount: 127,
|
||||
loops: 974,
|
||||
maxDepth: 48,
|
||||
thicknessRatio: 1.50,
|
||||
fractalDimension: 1.661,
|
||||
finalEnergy: 768.2,
|
||||
pulse: { avg: 0.49, min: 0.30, max: 2.00 },
|
||||
tone: { anger: 0.00, sadness: 0.00, curiosity: 0.10, dryness: 0.90, playfulness: 0.00, tension: 0.00 }
|
||||
};
|
||||
|
||||
// Network graph state
|
||||
const nodes = [];
|
||||
const edges = [];
|
||||
const nodeSize = 2 + (params.density * 3);
|
||||
const edgeThickness = 0.5 + (params.thicknessRatio * 0.5);
|
||||
const maxConnections = Math.floor(10 + (params.complexity * 15));
|
||||
const baseSpeed = 0.001 + (params.motion * 0.004);
|
||||
|
||||
// Initialize network
|
||||
function initNetwork() {
|
||||
// Create nodes
|
||||
for (let i = 0; i < params.survivingNodes; i++) {
|
||||
nodes.push({
|
||||
x: Math.random() * canvas.width,
|
||||
y: Math.random() * canvas.height,
|
||||
vx: (Math.random() - 0.5) * baseSpeed,
|
||||
vy: (Math.random() - 0.5) * baseSpeed,
|
||||
size: nodeSize,
|
||||
age: Math.random() * 100,
|
||||
maxConnections: maxConnections
|
||||
});
|
||||
}
|
||||
|
||||
// Create edges with loop potential
|
||||
for (let i = 0; i < params.branchCount; i++) {
|
||||
const from = Math.floor(Math.random() * nodes.length);
|
||||
const to = Math.floor(Math.random() * nodes.length);
|
||||
if (from !== to) {
|
||||
edges.push({
|
||||
from, to,
|
||||
thickness: edgeThickness,
|
||||
length: Math.random() * 100 + 50,
|
||||
pulse: params.pulse.avg
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update network
|
||||
function updateNetwork() {
|
||||
// Move nodes
|
||||
nodes.forEach(node => {
|
||||
node.x += node.vx;
|
||||
node.y += node.vy;
|
||||
|
||||
// Bounce off edges
|
||||
if (node.x < 0 || node.x > canvas.width) node.vx *= -1;
|
||||
if (node.y < 0 || node.y > canvas.height) node.vy *= -1;
|
||||
});
|
||||
|
||||
// Update edges with pulse effect
|
||||
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 dist = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
edge.pulse = params.pulse.avg + (Math.sin(Date.now() * 0.001) * (params.pulse.max - params.pulse.min) * 0.5);
|
||||
edge.length = dist * 0.8;
|
||||
});
|
||||
}
|
||||
|
||||
// Draw network
|
||||
function drawNetwork() {
|
||||
// Clear with alpha for trails
|
||||
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Draw edges
|
||||
ctx.lineWidth = edgeThickness;
|
||||
ctx.strokeStyle = `hsl(0, 0%, ${80 + (Math.sin(Date.now() * 0.0005) * 10)}%)`;
|
||||
|
||||
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 dist = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (dist < edge.length) return;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(fromNode.x, fromNode.y);
|
||||
ctx.lineTo(toNode.x, toNode.y);
|
||||
ctx.stroke();
|
||||
});
|
||||
|
||||
// Draw nodes
|
||||
nodes.forEach(node => {
|
||||
ctx.beginPath();
|
||||
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
|
||||
ctx.fillStyle = `hsl(0, 0%, ${30 + (Math.sin(node.age * 0.01) * 20)}%)`;
|
||||
ctx.fill();
|
||||
});
|
||||
}
|
||||
|
||||
// Animation loop
|
||||
function animate() {
|
||||
updateNetwork();
|
||||
drawNetwork();
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
// Start
|
||||
initNetwork();
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue