birth: Fractal Veins of Light
This commit is contained in:
parent
eb897f2505
commit
7d5e2e94ec
1 changed files with 158 additions and 0 deletions
158
index.html
Normal file
158
index.html
Normal file
|
|
@ -0,0 +1,158 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Neurameba · motd.social</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #0a0a0a;
|
||||||
|
color: #fff;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
}
|
||||||
|
#attribution {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.5;
|
||||||
|
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 params = {
|
||||||
|
motion: 0.5,
|
||||||
|
density: 0.5,
|
||||||
|
complexity: 0.5,
|
||||||
|
connectedness: 0.5,
|
||||||
|
lifespan: 0.5
|
||||||
|
};
|
||||||
|
|
||||||
|
const pulse = { avg: 1.06, min: 0.9, max: 1.2 };
|
||||||
|
const tone = { anger: 0, sadness: 0, curiosity: 0.1, dryness: 0.8, playfulness: 0, tension: 0 };
|
||||||
|
|
||||||
|
// Network Graph Implementation
|
||||||
|
class Node {
|
||||||
|
constructor() {
|
||||||
|
this.x = Math.random() * canvas.width;
|
||||||
|
this.y = Math.random() * canvas.height;
|
||||||
|
this.vx = (Math.random() - 0.5) * params.motion * 2;
|
||||||
|
this.vy = (Math.random() - 0.5) * params.motion * 2;
|
||||||
|
this.size = (Math.random() * 2 + 1) * (1 + params.density);
|
||||||
|
this.life = Math.random() * 1000 * params.lifespan;
|
||||||
|
this.maxConnections = Math.floor(params.connectedness * 5) + 1;
|
||||||
|
this.connections = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.life -= 1;
|
||||||
|
if (this.life <= 0) return false;
|
||||||
|
|
||||||
|
this.x += this.vx;
|
||||||
|
this.y += this.vy;
|
||||||
|
|
||||||
|
// Bounce off edges
|
||||||
|
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
|
||||||
|
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw() {
|
||||||
|
ctx.fillStyle = `rgba(255, 255, 255, ${0.8 + Math.sin(Date.now() * 0.001) * 0.2})`;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
|
||||||
|
ctx.fill();
|
||||||
|
|
||||||
|
// Draw connections
|
||||||
|
this.connections.forEach(conn => {
|
||||||
|
const alpha = 1 - (Date.now() - conn.created) / (conn.lifespan * 1000);
|
||||||
|
ctx.strokeStyle = `rgba(255, 255, 255, ${alpha * 0.5})`;
|
||||||
|
ctx.lineWidth = 1;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(this.x, this.y);
|
||||||
|
ctx.lineTo(conn.node.x, conn.node.y);
|
||||||
|
ctx.stroke();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Network {
|
||||||
|
constructor() {
|
||||||
|
this.nodes = [];
|
||||||
|
this.initNodes();
|
||||||
|
this.updateConnections();
|
||||||
|
}
|
||||||
|
|
||||||
|
initNodes() {
|
||||||
|
const nodeCount = Math.floor(params.density * 200) + 50;
|
||||||
|
for (let i = 0; i < nodeCount; i++) {
|
||||||
|
this.nodes.push(new Node());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateConnections() {
|
||||||
|
this.nodes.forEach(node => {
|
||||||
|
// Clear old connections
|
||||||
|
node.connections = node.connections.filter(conn => {
|
||||||
|
return conn.node.life > 0 &&
|
||||||
|
Date.now() - conn.created < (conn.lifespan * 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create new connections
|
||||||
|
if (node.connections.length < node.maxConnections && Math.random() < 0.1) {
|
||||||
|
const other = this.nodes[Math.floor(Math.random() * this.nodes.length)];
|
||||||
|
if (other !== node && other.life > 0) {
|
||||||
|
node.connections.push({
|
||||||
|
node: other,
|
||||||
|
created: Date.now(),
|
||||||
|
lifespan: 2 + Math.random() * 3
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.nodes = this.nodes.filter(node => node.update());
|
||||||
|
this.updateConnections();
|
||||||
|
}
|
||||||
|
|
||||||
|
draw() {
|
||||||
|
this.nodes.forEach(node => node.draw());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let network = new Network();
|
||||||
|
|
||||||
|
function animate() {
|
||||||
|
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
network.update();
|
||||||
|
network.draw();
|
||||||
|
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
animate();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue