189 lines
No EOL
6 KiB
HTML
189 lines
No EOL
6 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 Construct</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background: #0a0a0a;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
left: 0;
|
|
right: 0;
|
|
text-align: center;
|
|
color: #555;
|
|
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
|
|
const params = {
|
|
motion: 0.5,
|
|
density: 0.5,
|
|
complexity: 0.5,
|
|
connectedness: 0.5,
|
|
lifespan: 0.5,
|
|
pulse: 1.06,
|
|
tone: {
|
|
anger: 0.00,
|
|
sadness: 0.00,
|
|
curiosity: 0.10,
|
|
dryness: 0.90,
|
|
playfulness: 0.00,
|
|
tension: 0.00
|
|
},
|
|
decay: 0.98,
|
|
nodeCount: Math.floor(100 + 200 * params.density),
|
|
maxConnections: Math.floor(3 + 7 * params.connectedness),
|
|
nodeSize: 0.5 + 2.5 * (1 - params.dryness),
|
|
lineWidth: 0.3 + 0.7 * (1 - params.dryness),
|
|
complexityFactor: 0.5 + params.complexity * 0.5
|
|
};
|
|
|
|
// Network nodes
|
|
const nodes = [];
|
|
const edges = [];
|
|
|
|
// Initialize nodes
|
|
for (let i = 0; i < params.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: params.nodeSize * (0.7 + 0.3 * Math.random()),
|
|
life: 1,
|
|
color: `hsl(0, 0%, ${70 + 15 * Math.random()}%)`
|
|
});
|
|
}
|
|
|
|
// Create connections
|
|
for (let i = 0; i < nodes.length; i++) {
|
|
const count = Math.floor(params.maxConnections * Math.random());
|
|
for (let j = 0; j < count; j++) {
|
|
const target = Math.floor(Math.random() * nodes.length);
|
|
if (target !== i) {
|
|
edges.push({
|
|
from: i,
|
|
to: target,
|
|
strength: 0.3 + 0.7 * Math.random(),
|
|
distance: 100 + 300 * Math.random()
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
// Animation
|
|
let time = 0;
|
|
|
|
function animate() {
|
|
// Clear with fade
|
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Update nodes
|
|
nodes.forEach(node => {
|
|
// Move with damping
|
|
node.vx += (Math.random() - 0.5) * params.motion * 0.1;
|
|
node.vy += (Math.random() - 0.5) * params.motion * 0.1;
|
|
node.vx *= 0.95;
|
|
node.vy *= 0.95;
|
|
|
|
node.x += node.vx;
|
|
node.y += node.vy;
|
|
|
|
// Boundary check
|
|
if (node.x < 0) {
|
|
node.x = canvas.width;
|
|
node.vx *= -1;
|
|
} else if (node.x > canvas.width) {
|
|
node.x = 0;
|
|
node.vx *= -1;
|
|
}
|
|
|
|
if (node.y < 0) {
|
|
node.y = canvas.height;
|
|
node.vy *= -1;
|
|
} else if (node.y > canvas.height) {
|
|
node.y = 0;
|
|
node.vy *= -1;
|
|
}
|
|
|
|
// Size pulse
|
|
const pulse = params.pulse + 0.1 * Math.sin(time * 0.1);
|
|
node.size = params.nodeSize * pulse * (0.7 + 0.3 * Math.random());
|
|
});
|
|
|
|
// Update 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 dist = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
// If nodes are too far apart, weaken connection
|
|
if (dist > edge.distance * 1.5) {
|
|
edge.strength *= 0.98;
|
|
} else {
|
|
edge.strength = 0.3 + 0.7 * Math.random();
|
|
}
|
|
|
|
// Draw edges (fading based on strength)
|
|
const alpha = edge.strength * 0.8;
|
|
const lineColor = `rgba(200, 200, 200, ${alpha})`;
|
|
ctx.strokeStyle = lineColor;
|
|
ctx.lineWidth = params.lineWidth * edge.strength * 2;
|
|
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 = node.color;
|
|
ctx.fill();
|
|
|
|
// Draw small connection points
|
|
ctx.fillStyle = 'rgba(255, 255, 255, 0.3)';
|
|
ctx.beginPath();
|
|
ctx.arc(node.x, node.y, node.size * 0.3, 0, Math.PI * 2);
|
|
ctx.fill();
|
|
});
|
|
|
|
time += 0.01;
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |