birth: Whispering Teal Connections
This commit is contained in:
parent
1cad29c104
commit
8ca2e56ec6
1 changed files with 168 additions and 0 deletions
168
index.html
Normal file
168
index.html
Normal file
|
|
@ -0,0 +1,168 @@
|
||||||
|
<!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: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
canvas {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#attribution {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 10px;
|
||||||
|
right: 10px;
|
||||||
|
color: #444;
|
||||||
|
font-size: 10px;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
</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 parameters
|
||||||
|
const params = {
|
||||||
|
motion: 0.5,
|
||||||
|
density: 0.5,
|
||||||
|
complexity: 0.5,
|
||||||
|
connectedness: 0.5,
|
||||||
|
lifespan: 0.5,
|
||||||
|
pulse: 1.07,
|
||||||
|
tone: {
|
||||||
|
curiosity: 0.8,
|
||||||
|
dryness: 0.9,
|
||||||
|
playfulness: 0.1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Generate network nodes
|
||||||
|
const nodes = [];
|
||||||
|
const numNodes = Math.floor(params.density * 100) + 20;
|
||||||
|
|
||||||
|
for (let i = 0; i < numNodes; 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: Math.random() * 3 + 1,
|
||||||
|
color: `hsl(180, 30%, ${70 + Math.random() * 10}%)`,
|
||||||
|
energy: 0.5 + Math.random() * 0.5,
|
||||||
|
connections: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate connections based on connectedness
|
||||||
|
const maxConnections = Math.floor(params.connectedness * 5) + 2;
|
||||||
|
nodes.forEach(node => {
|
||||||
|
const possibleConnections = nodes.filter(other =>
|
||||||
|
other !== node &&
|
||||||
|
!node.connections.includes(other) &&
|
||||||
|
Math.random() < params.connectedness * 0.1
|
||||||
|
);
|
||||||
|
|
||||||
|
const numConnections = Math.min(
|
||||||
|
maxConnections,
|
||||||
|
Math.floor(possibleConnections.length * params.connectedness) + 1
|
||||||
|
);
|
||||||
|
|
||||||
|
for (let i = 0; i < numConnections; i++) {
|
||||||
|
if (possibleConnections.length > 0) {
|
||||||
|
const target = possibleConnections[Math.floor(Math.random() * possibleConnections.length)];
|
||||||
|
node.connections.push(target);
|
||||||
|
if (!target.connections.includes(node)) {
|
||||||
|
target.connections.push(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Animation state
|
||||||
|
let time = 0;
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
function drawNetwork() {
|
||||||
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
// Update node positions with slight pulsing
|
||||||
|
const pulseFactor = 0.9 + 0.1 * Math.sin(time * params.pulse);
|
||||||
|
nodes.forEach(node => {
|
||||||
|
node.x += node.vx * pulseFactor;
|
||||||
|
node.y += node.vy * pulseFactor;
|
||||||
|
|
||||||
|
// Boundary check
|
||||||
|
if (node.x < 0 || node.x > canvas.width) node.vx *= -1;
|
||||||
|
if (node.y < 0 || node.y > canvas.height) node.vy *= -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Draw connections with varying thickness
|
||||||
|
ctx.strokeStyle = `rgba(180, 220, 220, ${params.tone.dryness * 0.3})`;
|
||||||
|
ctx.lineWidth = params.complexity * 1.5 + 0.5;
|
||||||
|
|
||||||
|
const maxDistance = 300 * (1 - params.density);
|
||||||
|
lines.length = 0;
|
||||||
|
|
||||||
|
nodes.forEach(node => {
|
||||||
|
node.connections.forEach(target => {
|
||||||
|
const dx = target.x - node.x;
|
||||||
|
const dy = target.y - node.y;
|
||||||
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||||
|
|
||||||
|
if (distance < maxDistance) {
|
||||||
|
const line = {
|
||||||
|
x1: node.x,
|
||||||
|
y1: node.y,
|
||||||
|
x2: target.x,
|
||||||
|
y2: target.y,
|
||||||
|
width: params.connectedness * params.complexity * 2 + 0.5
|
||||||
|
};
|
||||||
|
lines.push(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Draw lines with varying opacity
|
||||||
|
lines.forEach(line => {
|
||||||
|
ctx.globalAlpha = params.connectedness * 0.5;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(line.x1, line.y1);
|
||||||
|
ctx.lineTo(line.x2, line.y2);
|
||||||
|
ctx.stroke();
|
||||||
|
});
|
||||||
|
ctx.globalAlpha = 1;
|
||||||
|
|
||||||
|
// Draw nodes
|
||||||
|
nodes.forEach(node => {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(node.x, node.y, node.size * (0.8 + 0.2 * Math.sin(time * 0.1)), 0, Math.PI * 2);
|
||||||
|
ctx.fillStyle = node.color;
|
||||||
|
ctx.fill();
|
||||||
|
});
|
||||||
|
|
||||||
|
time += 0.01;
|
||||||
|
requestAnimationFrame(drawNetwork);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawNetwork();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue