birth: Fractal Webs of Perpetual Current
This commit is contained in:
parent
4a227d65bc
commit
ffc5b25cb9
1 changed files with 173 additions and 0 deletions
173
index.html
Normal file
173
index.html
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
<!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;
|
||||
font-family: 'Courier New', monospace;
|
||||
color: #fff;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
#footer {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
font-size: 10px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas"></canvas>
|
||||
<div id="footer">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();
|
||||
|
||||
const config = {
|
||||
motion: 0.501,
|
||||
density: 0.481,
|
||||
complexity: 0.511,
|
||||
connectedness: 0.508,
|
||||
lifespan: 0.523,
|
||||
survivingNodes: 107,
|
||||
branchCount: 65,
|
||||
loops: 116,
|
||||
maxDepth: 25,
|
||||
thicknessRatio: 1.50,
|
||||
fractalDim: 1.322,
|
||||
finalEnergy: 541.0,
|
||||
pulse: { avg: 1.31, min: 0.30, max: 2.00 },
|
||||
tone: { anger: 0.00, sadness: 0.00, curiosity: 0.10, dryness: 0.80, playfulness: 0.00, tension: 0.00 }
|
||||
};
|
||||
|
||||
class Node {
|
||||
constructor(x, y, id) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.id = id;
|
||||
this.links = [];
|
||||
this.radius = 1 + Math.random() * 3;
|
||||
this.angle = Math.random() * Math.PI * 2;
|
||||
this.rotationSpeed = (Math.random() - 0.5) * 0.02;
|
||||
this.targetAngle = this.angle;
|
||||
this.opacity = 0.8 + Math.random() * 0.2;
|
||||
}
|
||||
|
||||
addLink(node) {
|
||||
if (!this.links.includes(node)) {
|
||||
this.links.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
update() {
|
||||
this.targetAngle += this.rotationSpeed;
|
||||
this.angle += (this.targetAngle - this.angle) * 0.05;
|
||||
}
|
||||
|
||||
draw() {
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
|
||||
ctx.fillStyle = `rgba(200, 200, 200, ${this.opacity})`;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
class NetworkGraph {
|
||||
constructor() {
|
||||
this.nodes = [];
|
||||
this.links = [];
|
||||
this.pulseTimer = 0;
|
||||
this.maxLinks = config.survivingNodes * config.connectedness * 50;
|
||||
this.createNodes();
|
||||
this.createLinks();
|
||||
}
|
||||
|
||||
createNodes() {
|
||||
const centerX = canvas.width / 2;
|
||||
const centerY = canvas.height / 2;
|
||||
const radius = Math.min(canvas.width, canvas.height) * 0.4;
|
||||
|
||||
for (let i = 0; i < config.survivingNodes; i++) {
|
||||
const angle = (i / config.survivingNodes) * Math.PI * 2;
|
||||
const x = centerX + Math.cos(angle) * radius * (0.5 + Math.random() * 0.5);
|
||||
const y = centerY + Math.sin(angle) * radius * (0.5 + Math.random() * 0.5);
|
||||
this.nodes.push(new Node(x, y, i));
|
||||
}
|
||||
}
|
||||
|
||||
createLinks() {
|
||||
for (let i = 0; i < this.nodes.length; i++) {
|
||||
const connections = Math.floor(config.connectedness * 5 + Math.random() * 3);
|
||||
|
||||
for (let j = 0; j < connections; j++) {
|
||||
const target = Math.floor(Math.random() * this.nodes.length);
|
||||
if (target !== i && this.nodes[i].links.length < connections) {
|
||||
this.nodes[i].addLink(this.nodes[target]);
|
||||
this.links.push({ from: this.nodes[i], to: this.nodes[target] });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update() {
|
||||
this.nodes.forEach(node => node.update());
|
||||
this.pulseTimer += 0.01;
|
||||
}
|
||||
|
||||
draw() {
|
||||
// Draw links with pulse effect
|
||||
this.links.forEach(link => {
|
||||
const pulse = config.pulse.avg + Math.sin(this.pulseTimer) * (config.pulse.max - config.pulse.avg);
|
||||
const dist = Math.hypot(link.from.x - link.to.x, link.from.y - link.to.y);
|
||||
const thickness = 0.5 + (dist / 500) * config.thicknessRatio * pulse;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(link.from.x, link.from.y);
|
||||
ctx.lineTo(link.to.x, link.to.y);
|
||||
ctx.strokeStyle = `rgba(200, 200, 200, ${0.2 + pulse * 0.05})`;
|
||||
ctx.lineWidth = thickness;
|
||||
ctx.stroke();
|
||||
});
|
||||
|
||||
// Draw nodes
|
||||
this.nodes.forEach(node => node.draw());
|
||||
}
|
||||
}
|
||||
|
||||
const graph = new NetworkGraph();
|
||||
let lastTime = 0;
|
||||
let hueShift = 0;
|
||||
|
||||
function animate(time) {
|
||||
const deltaTime = time - lastTime;
|
||||
lastTime = time;
|
||||
|
||||
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
hueShift += deltaTime * 0.01;
|
||||
graph.update();
|
||||
graph.draw();
|
||||
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
requestAnimationFrame(animate);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue