212 lines
No EOL
7 KiB
HTML
212 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>Neurameba · motd.social</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background-color: #0a0a0a;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: fixed;
|
|
bottom: 10px;
|
|
right: 10px;
|
|
color: #666;
|
|
font-size: 10px;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
</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 the abstract specifications
|
|
const params = {
|
|
motion: 0.5,
|
|
density: 0.5,
|
|
complexity: 0.5,
|
|
connectedness: 0.5,
|
|
lifespan: 0.5,
|
|
pulse: 1.08,
|
|
tone: { anger: 0, sadness: 0, curiosity: 0.1, dryness: 0.9, playfulness: 0, tension: 0 },
|
|
topology: { survivingNodes: 0, branchCount: 0, loops: 0, maxDepth: 0, thicknessRatio: 0, fractalDimension: 0 }
|
|
};
|
|
|
|
// Network graph simulation
|
|
class Node {
|
|
constructor(x, y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.vx = 0;
|
|
this.vy = 0;
|
|
this.radius = 1 + Math.random() * 2;
|
|
this.targetRadius = this.radius;
|
|
this.links = [];
|
|
this.phase = Math.random() * Math.PI * 2;
|
|
}
|
|
|
|
update(targets, connectedness) {
|
|
// Pulsing behavior
|
|
this.radius += (this.targetRadius - this.radius) * 0.05;
|
|
this.targetRadius = 1 + Math.sin(this.phase) * 0.5 + 1;
|
|
this.phase += 0.02 * params.pulse;
|
|
|
|
// Simple physics with neighbors
|
|
this.vx *= 0.9;
|
|
this.vy *= 0.9;
|
|
|
|
// Repel from other nodes
|
|
targets.forEach(target => {
|
|
if (target === this) return;
|
|
|
|
const dx = target.x - this.x;
|
|
const dy = target.y - this.y;
|
|
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
if (dist < 100 && dist > 0) {
|
|
const repelForce = (100 - dist) * 0.01 * params.connectedness;
|
|
this.vx -= dx / dist * repelForce;
|
|
this.vy -= dy / dist * repelForce;
|
|
}
|
|
});
|
|
|
|
this.x += this.vx;
|
|
this.y += this.vy;
|
|
|
|
// Boundary check
|
|
if (this.x < 0) { this.x = 0; this.vx *= -0.5; }
|
|
if (this.y < 0) { this.y = 0; this.vy *= -0.5; }
|
|
if (this.x > canvas.width) { this.x = canvas.width; this.vx *= -0.5; }
|
|
if (this.y > canvas.height) { this.y = canvas.height; this.vy *= -0.5; }
|
|
}
|
|
|
|
draw() {
|
|
ctx.beginPath();
|
|
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
|
|
|
|
// Tone-based color scheme (dryness = monochrome)
|
|
const intensity = 0.3 + 0.7 * (1 - params.tone.dryness);
|
|
ctx.fillStyle = `rgba(${255 * intensity}, ${255 * intensity}, ${255 * intensity}, 0.8)`;
|
|
ctx.fill();
|
|
|
|
ctx.strokeStyle = `rgba(255, 255, 255, 0.2)`;
|
|
ctx.lineWidth = 0.5;
|
|
ctx.stroke();
|
|
}
|
|
}
|
|
|
|
class NetworkGraph {
|
|
constructor() {
|
|
this.nodes = [];
|
|
this.links = [];
|
|
this.initNodes();
|
|
this.initLinks();
|
|
}
|
|
|
|
initNodes() {
|
|
const count = Math.max(10, Math.floor(params.density * 50 + 20));
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
this.nodes.push(new Node(
|
|
Math.random() * canvas.width,
|
|
Math.random() * canvas.height
|
|
));
|
|
}
|
|
}
|
|
|
|
initLinks() {
|
|
// Create links based on connectedness
|
|
const maxLinks = Math.max(1, Math.floor(params.connectedness * 20));
|
|
|
|
for (let i = 0; i < this.nodes.length; i++) {
|
|
const node = this.nodes[i];
|
|
const linkCount = Math.floor(Math.random() * maxLinks * 0.5) + 1;
|
|
|
|
for (let j = 0; j < linkCount; j++) {
|
|
const target = this.nodes[Math.floor(Math.random() * this.nodes.length)];
|
|
if (target !== node && !this.hasLink(node, target)) {
|
|
this.links.push({
|
|
from: node,
|
|
to: target,
|
|
strength: 0.5 + Math.random() * 0.5
|
|
});
|
|
node.links.push(target);
|
|
target.links.push(node);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
hasLink(a, b) {
|
|
return this.links.some(link =>
|
|
(link.from === a && link.to === b) ||
|
|
(link.from === b && link.to === a)
|
|
);
|
|
}
|
|
|
|
update() {
|
|
this.nodes.forEach(node => node.update(this.nodes));
|
|
|
|
// Update links with pulsing
|
|
this.links.forEach(link => {
|
|
const dist = Math.sqrt(
|
|
Math.pow(link.to.x - link.from.x, 2) +
|
|
Math.pow(link.to.y - link.from.y, 2)
|
|
);
|
|
|
|
link.strength = 0.5 + 0.5 * Math.sin(Date.now() * 0.001 + link.from.x * 0.01);
|
|
});
|
|
}
|
|
|
|
draw() {
|
|
// Draw links first
|
|
ctx.strokeStyle = `rgba(255, 255, 255, 0.1)`;
|
|
ctx.lineWidth = 0.5;
|
|
|
|
this.links.forEach(link => {
|
|
ctx.beginPath();
|
|
ctx.moveTo(link.from.x, link.from.y);
|
|
ctx.lineTo(link.to.x, link.to.y);
|
|
ctx.stroke();
|
|
});
|
|
|
|
// Draw nodes
|
|
this.nodes.forEach(node => node.draw());
|
|
}
|
|
}
|
|
|
|
let graph = new NetworkGraph();
|
|
|
|
function animate() {
|
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
graph.update();
|
|
graph.draw();
|
|
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |