teal-veins-of-inquiry-308e/index.html

200 lines
No EOL
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>Pulsing Nexus</title>
<style>
body { margin: 0; overflow: hidden; background: #0a0a0a; }
canvas { display: block; }
#attribution { position: absolute; bottom: 10px; right: 10px; color: #444; font-family: monospace; font-size: 10px; }
</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.575,
density: 0.521,
complexity: 0.485,
connectedness: 0.544,
lifespan: 0.499,
survivingNodes: 83,
branchCount: 58,
loops: 169,
maxDepth: 19,
thicknessRatio: 1.25,
fractalDim: 1.601,
finalEnergy: 422.5,
pulse: { avg: 0.65, min: 0.3, max: 1.75 },
tone: { anger: 0.0, sadness: 0.0, curiosity: 0.8, dryness: 0.9, playfulness: 0.1, tension: 0.0 }
};
// Node and edge properties
const nodeCount = Math.floor(params.survivingNodes * (1 + params.connectedness * 0.5));
const edgeCount = Math.floor(params.branchCount * (1 + params.complexity * 0.3));
const loopCount = Math.floor(params.loops * (1 + params.connectedness * 0.4));
// Color palette (curiosity=teals, dryness=monochrome)
const colorBase = params.tone.dryness > 0.8 ?
`hsl(0, 0%, ${Math.floor(10 + Math.random() * 20)}%)` :
`hsl(${Math.floor(160 + Math.random() * 40)}, 70%, 60%)`;
const colorHighlight = params.tone.dryness > 0.8 ?
`hsl(0, 0%, ${Math.floor(50 + Math.random() * 30)}%)` :
`hsl(${Math.floor(160 + Math.random() * 40)}, 90%, 70%)`;
// Network graph
class Node {
constructor(x, y, id) {
this.x = x;
this.y = y;
this.id = id;
this.size = 1 + Math.random() * 2;
this.vx = 0;
this.vy = 0;
this.targetVx = (Math.random() - 0.5) * params.motion;
this.targetVy = (Math.random() - 0.5) * params.motion;
this.connections = [];
this.velocity = 0;
this.saturation = 70 + Math.random() * 30;
}
update() {
this.vx += (this.targetVx - this.vx) * 0.05;
this.vy += (this.targetVy - this.vy) * 0.05;
this.x += this.vx;
this.y += this.vy;
this.x = Math.max(0, Math.min(canvas.width, this.x));
this.y = Math.max(0, Math.min(canvas.height, this.y));
// Pulse effect
const pulse = params.pulse.avg * (0.8 + 0.4 * Math.sin(Date.now() * 0.001 + this.id));
this.size = 1 + pulse * 0.5;
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size * (1 + params.connectedness * 0.3), 0, Math.PI * 2);
ctx.fillStyle = colorBase;
ctx.fill();
// Highlight nodes with more connections
if (this.connections.length > 3) {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size * 1.5, 0, Math.PI * 2);
ctx.strokeStyle = colorHighlight;
ctx.lineWidth = 1;
ctx.stroke();
}
}
}
class Edge {
constructor(nodeA, nodeB) {
this.nodeA = nodeA;
this.nodeB = nodeB;
this.length = Math.sqrt(Math.pow(nodeB.x - nodeA.x, 2) + Math.pow(nodeB.y - nodeA.y, 2));
this.thickness = 0.5 + Math.random() * params.thicknessRatio;
this.age = 0;
}
update() {
this.age++;
// Fade out edges over time
this.thickness = 0.5 + 0.5 * Math.exp(-this.age / 100);
}
draw() {
const alpha = Math.min(1, this.age / 50);
ctx.beginPath();
ctx.moveTo(this.nodeA.x, this.nodeA.y);
ctx.lineTo(this.nodeB.x, this.nodeB.y);
ctx.strokeStyle = `${colorBase.replace(')', `, ${alpha})`)}`;
ctx.lineWidth = this.thickness;
ctx.stroke();
}
}
// Create nodes
const nodes = [];
for (let i = 0; i < nodeCount; i++) {
nodes.push(new Node(
Math.random() * canvas.width,
Math.random() * canvas.height,
i
));
}
// Create edges with loops
const edges = [];
for (let i = 0; i < edgeCount; i++) {
const nodeA = nodes[Math.floor(Math.random() * nodes.length)];
const nodeB = nodes[Math.floor(Math.random() * nodes.length)];
nodeA.connections.push(nodeB);
nodeB.connections.push(nodeA);
edges.push(new Edge(nodeA, nodeB));
}
// Create additional loop connections
for (let i = 0; i < loopCount; i++) {
const nodeA = nodes[Math.floor(Math.random() * nodes.length)];
const nodeB = nodes[Math.floor(Math.random() * nodes.length)];
nodeA.connections.push(nodeB);
nodeB.connections.push(nodeA);
edges.push(new Edge(nodeA, nodeB));
}
// Main animation
function animate() {
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Update and draw edges first (so they appear behind nodes)
edges.forEach(edge => {
edge.update();
edge.draw();
if (edge.thickness < 0.1) {
edges.splice(edges.indexOf(edge), 1);
}
});
// Update and draw nodes
nodes.forEach(node => {
node.update();
node.draw();
});
// Occasionally add new nodes
if (Math.random() < 0.01) {
nodes.push(new Node(
Math.random() * canvas.width,
Math.random() * canvas.height,
nodes.length
));
}
// Occasionally remove old nodes
if (nodes.length > 200 && Math.random() < 0.005) {
nodes.splice(Math.floor(Math.random() * nodes.length), 1);
}
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>