birth: Frayed Echoes in Static
This commit is contained in:
parent
660a636877
commit
1ada1a72de
1 changed files with 155 additions and 0 deletions
155
index.html
Normal file
155
index.html
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Network Echoes</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #0a0a0a;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
#attribution {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
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 derived from input
|
||||
const params = {
|
||||
motion: 0.5,
|
||||
density: 0.5,
|
||||
complexity: 0.5,
|
||||
connectedness: 0.5,
|
||||
lifespan: 0.5,
|
||||
pulse: { avg: 1.1, min: 1.0, max: 1.3 },
|
||||
tone: { dryness: 0.8, playfulness: 0.1 },
|
||||
color: '#888'
|
||||
};
|
||||
|
||||
// Network graph setup
|
||||
const nodes = [];
|
||||
const edges = [];
|
||||
const maxNodes = Math.floor(params.density * 300) + 50;
|
||||
const nodeSize = 2 + params.complexity * 8;
|
||||
const edgeThickness = 0.5 + params.connectedness * 1.5;
|
||||
const pulseSpeed = 0.001 + params.motion * 0.01;
|
||||
const pulseRange = params.pulse.max - params.pulse.min;
|
||||
|
||||
// Initialize nodes
|
||||
for (let i = 0; i < maxNodes; i++) {
|
||||
nodes.push({
|
||||
x: Math.random() * canvas.width,
|
||||
y: Math.random() * canvas.height,
|
||||
vx: (Math.random() - 0.5) * 0.5 * params.motion,
|
||||
vy: (Math.random() - 0.5) * 0.5 * params.motion,
|
||||
size: nodeSize * (0.7 + Math.random() * 0.6),
|
||||
pulse: params.pulse.min + Math.random() * pulseRange,
|
||||
phase: Math.random() * Math.PI * 2
|
||||
});
|
||||
}
|
||||
|
||||
// Create edges based on proximity
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
for (let j = i + 1; j < nodes.length; j++) {
|
||||
const dx = nodes[j].x - nodes[i].x;
|
||||
const dy = nodes[j].y - nodes[i].y;
|
||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||
const maxDist = 150 + params.connectedness * 150;
|
||||
|
||||
if (distance < maxDist) {
|
||||
edges.push({
|
||||
from: i,
|
||||
to: j,
|
||||
distance: distance,
|
||||
thickness: edgeThickness * (0.5 + 0.5 * (1 - distance / maxDist)),
|
||||
pulse: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Animation
|
||||
let time = 0;
|
||||
function animate() {
|
||||
// Clear with fade effect
|
||||
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Update nodes
|
||||
nodes.forEach(node => {
|
||||
// Movement
|
||||
node.x += node.vx;
|
||||
node.y += node.vy;
|
||||
|
||||
// Boundary check
|
||||
if (node.x < 0) { node.x = canvas.width; }
|
||||
if (node.x > canvas.width) { node.x = 0; }
|
||||
if (node.y < 0) { node.y = canvas.height; }
|
||||
if (node.y > canvas.height) { node.y = 0; }
|
||||
|
||||
// Pulse effect
|
||||
const pulseScale = 1 + Math.sin(time * node.pulse + node.phase) * 0.1 * params.pulse.avg;
|
||||
node.size = nodeSize * pulseScale;
|
||||
});
|
||||
|
||||
// Update edges
|
||||
edges.forEach(edge => {
|
||||
edge.pulse += pulseSpeed;
|
||||
const pulseScale = 1 + Math.sin(time * params.pulse.avg + edge.pulse) * 0.1;
|
||||
edge.thickness = edgeThickness * pulseScale;
|
||||
});
|
||||
|
||||
// Draw edges
|
||||
edges.forEach(edge => {
|
||||
const fromNode = nodes[edge.from];
|
||||
const toNode = nodes[edge.to];
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(fromNode.x, fromNode.y);
|
||||
ctx.lineTo(toNode.x, toNode.y);
|
||||
ctx.strokeStyle = params.color;
|
||||
ctx.lineWidth = edge.thickness;
|
||||
ctx.stroke();
|
||||
});
|
||||
|
||||
// Draw nodes
|
||||
nodes.forEach(node => {
|
||||
ctx.beginPath();
|
||||
ctx.arc(node.x, node.y, node.size, 0, Math.PI * 2);
|
||||
ctx.fillStyle = params.color;
|
||||
ctx.fill();
|
||||
});
|
||||
|
||||
time += 0.01;
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue