157 lines
No EOL
4.9 KiB
HTML
157 lines
No EOL
4.9 KiB
HTML
<!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-color: #0a0a0a;
|
|
font-family: monospace;
|
|
color: #555;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
right: 10px;
|
|
font-size: 10px;
|
|
color: #333;
|
|
}
|
|
</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 based on input
|
|
const params = {
|
|
motion: 0.5,
|
|
density: 0.5,
|
|
complexity: 0.5,
|
|
connectedness: 0.5,
|
|
lifespan: 0.5,
|
|
pulse: { avg: 1.04, min: 1.0, max: 1.1 },
|
|
tone: { dryness: 0.9, curiosity: 0.1 }
|
|
};
|
|
|
|
// Network graph implementation
|
|
class NetworkNode {
|
|
constructor(x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.vx = (Math.random() - 0.5) * 2;
|
|
this.vy = (Math.random() - 0.5) * 2;
|
|
this.size = 2 + Math.random() * 3;
|
|
this.color = `rgba(200, 200, 200, ${0.3 + Math.random() * 0.2})`;
|
|
this.lifespan = params.lifespan * 1000 * (Math.random() * 0.5 + 0.5);
|
|
this.age = 0;
|
|
this.connections = [];
|
|
}
|
|
|
|
update() {
|
|
this.x += this.vx * params.motion * 2;
|
|
this.y += this.vy * params.motion * 2;
|
|
this.age++;
|
|
|
|
// Boundary behavior
|
|
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
|
|
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
|
|
|
|
// Fade out with age
|
|
if (this.age > this.lifespan) {
|
|
this.color = `rgba(200, 200, 200, ${Math.max(0, 1 - (this.age - this.lifespan)/200)})`;
|
|
}
|
|
}
|
|
|
|
draw() {
|
|
ctx.beginPath();
|
|
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
|
|
ctx.fillStyle = this.color;
|
|
ctx.fill();
|
|
|
|
// Draw connections
|
|
ctx.strokeStyle = `rgba(200, 200, 200, ${0.1 + params.connectedness * 0.2})`;
|
|
ctx.lineWidth = 0.5 * params.complexity;
|
|
this.connections.forEach(conn => {
|
|
ctx.beginPath();
|
|
ctx.moveTo(this.x, this.y);
|
|
ctx.lineTo(conn.x, conn.y);
|
|
ctx.stroke();
|
|
});
|
|
}
|
|
}
|
|
|
|
function createNetwork() {
|
|
const nodes = [];
|
|
const nodeCount = Math.floor(params.density * 100 + 20);
|
|
|
|
// Create nodes
|
|
for (let i = 0; i < nodeCount; i++) {
|
|
nodes.push(new NetworkNode(
|
|
Math.random() * canvas.width,
|
|
Math.random() * canvas.height
|
|
));
|
|
}
|
|
|
|
// Create connections
|
|
for (let i = 0; i < nodes.length; i++) {
|
|
const maxConnections = params.connectedness * 5;
|
|
const connectionCount = Math.floor(Math.random() * maxConnections);
|
|
|
|
for (let j = 0; j < connectionCount; j++) {
|
|
const target = Math.floor(Math.random() * nodes.length);
|
|
if (target !== i) {
|
|
nodes[i].connections.push(nodes[target]);
|
|
}
|
|
}
|
|
}
|
|
|
|
return nodes;
|
|
}
|
|
|
|
let networkNodes = createNetwork();
|
|
let frameCount = 0;
|
|
|
|
function animate() {
|
|
// Clear with subtle trail
|
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Update and draw nodes
|
|
networkNodes.forEach(node => {
|
|
node.update();
|
|
node.draw();
|
|
});
|
|
|
|
// Occasionally add new nodes
|
|
if (frameCount % 30 === 0 && Math.random() < params.density * 0.1) {
|
|
networkNodes.push(new NetworkNode(
|
|
Math.random() * canvas.width,
|
|
Math.random() * canvas.height
|
|
));
|
|
}
|
|
|
|
frameCount++;
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |