178 lines
No EOL
5.7 KiB
HTML
178 lines
No EOL
5.7 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 Graph</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background: #0a0a0a;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: absolute;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
color: #555555;
|
|
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();
|
|
|
|
// Network Graph Parameters
|
|
const nodes = [];
|
|
const edges = [];
|
|
const nodeCount = 125;
|
|
const edgeCount = 115;
|
|
const loopCount = 1831;
|
|
const maxDepth = 32;
|
|
const thicknessRatio = 1.25;
|
|
const fractalDim = 1.552;
|
|
const avgPulse = 0.37;
|
|
const minPulse = 0.30;
|
|
const maxPulse = 1.85;
|
|
|
|
// Initialize nodes with positions and properties
|
|
for (let i = 0; i < nodeCount; i++) {
|
|
nodes.push({
|
|
x: Math.random() * canvas.width,
|
|
y: Math.random() * canvas.height,
|
|
baseSize: 2 + Math.random() * 3,
|
|
pulse: minPulse + Math.random() * (maxPulse - minPulse),
|
|
phase: Math.random() * Math.PI * 2,
|
|
color: `hsl(0, 0%, ${80 + Math.random() * 20}%)`
|
|
});
|
|
}
|
|
|
|
// Create edges with loop connections
|
|
for (let i = 0; i < edgeCount; i++) {
|
|
const from = Math.floor(Math.random() * nodeCount);
|
|
const to = Math.floor(Math.random() * nodeCount);
|
|
const loops = Math.floor(Math.random() * 10); // Some edges form loops
|
|
|
|
for (let j = 0; j < loops; j++) {
|
|
edges.push({
|
|
from,
|
|
to,
|
|
weight: 0.5 + Math.random() * 0.5,
|
|
thickness: 0.5 + Math.random() * 1.5,
|
|
color: `hsl(0, 0%, ${60 + Math.random() * 20}%)`
|
|
});
|
|
}
|
|
}
|
|
|
|
// Add extra loops to reach the specified count
|
|
while (edges.length < loopCount) {
|
|
const from = Math.floor(Math.random() * nodeCount);
|
|
const to = Math.floor(Math.random() * nodeCount);
|
|
edges.push({
|
|
from,
|
|
to,
|
|
weight: 0.5 + Math.random() * 0.5,
|
|
thickness: 0.5 + Math.random() * 1.5,
|
|
color: `hsl(0, 0%, ${60 + Math.random() * 20}%)`
|
|
});
|
|
}
|
|
|
|
// Animation variables
|
|
let time = 0;
|
|
let energy = 801.9;
|
|
const decayRate = 0.999;
|
|
|
|
function drawNetwork() {
|
|
// Clear canvas with dark background
|
|
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Update time and energy
|
|
time += 0.01;
|
|
energy *= decayRate;
|
|
|
|
// Draw edges
|
|
edges.forEach(edge => {
|
|
const node1 = nodes[edge.from];
|
|
const node2 = nodes[edge.to];
|
|
|
|
const dx = node2.x - node1.x;
|
|
const dy = node2.y - node1.y;
|
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
// Pulsing effect
|
|
const pulse = node1.pulse;
|
|
|
|
// Draw edge with pulsing effect
|
|
ctx.beginPath();
|
|
ctx.moveTo(node1.x, node1.y);
|
|
ctx.lineTo(node2.x, node2.y);
|
|
|
|
// Color variation
|
|
const hue = (time * 20 + edge.from * 0.1) % 360;
|
|
const color = edge.color.replace('hsl(0', `hsl(${hue}`);
|
|
|
|
ctx.strokeStyle = color;
|
|
ctx.lineWidth = edge.thickness * thicknessRatio;
|
|
ctx.stroke();
|
|
});
|
|
|
|
// Draw nodes
|
|
nodes.forEach(node => {
|
|
// Update node position with slight movement
|
|
node.x += (Math.random() - 0.5) * 0.5;
|
|
node.y += (Math.random() - 0.5) * 0.5;
|
|
|
|
// Boundary check
|
|
node.x = Math.max(0, Math.min(canvas.width, node.x));
|
|
node.y = Math.max(0, Math.min(canvas.height, node.y));
|
|
|
|
// Pulsing effect
|
|
const pulseSize = node.baseSize * (1 + 0.2 * Math.sin(node.phase + time * node.pulse));
|
|
|
|
// Draw node
|
|
ctx.beginPath();
|
|
ctx.arc(node.x, node.y, pulseSize, 0, Math.PI * 2);
|
|
ctx.fillStyle = node.color;
|
|
ctx.fill();
|
|
|
|
// Draw glow effect
|
|
ctx.beginPath();
|
|
ctx.arc(node.x, node.y, pulseSize * 1.5, 0, Math.PI * 2);
|
|
ctx.fillStyle = `rgba(255, 255, 255, ${0.1 + 0.05 * Math.sin(time * 2 + node.phase)})`;
|
|
ctx.fill();
|
|
});
|
|
|
|
// Draw energy bar
|
|
const energyBarWidth = (energy / 1000) * canvas.width;
|
|
ctx.fillStyle = `rgba(255, 255, 255, 0.2)`;
|
|
ctx.fillRect(0, 0, energyBarWidth, 4);
|
|
}
|
|
|
|
function animate() {
|
|
drawNetwork();
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |