280 lines
No EOL
10 KiB
HTML
280 lines
No EOL
10 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</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background: #0a0a0a;
|
|
font-family: 'Courier New', monospace;
|
|
color: #ccc;
|
|
}
|
|
#info {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
right: 10px;
|
|
font-size: 10px;
|
|
opacity: 0.6;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas"></canvas>
|
|
<div id="info">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.643,
|
|
density: 0.701,
|
|
complexity: 0.649,
|
|
connectedness: 0.533,
|
|
lifespan: 0.750,
|
|
survivingNodes: 6,
|
|
branchCount: 6,
|
|
loops: 20,
|
|
maxDepth: 6,
|
|
thicknessRatio: 1.00,
|
|
fractalDimension: 0.500,
|
|
pulseAvg: 0.35,
|
|
pulseMin: 0.30,
|
|
pulseMax: 1.20,
|
|
dryness: 0.80,
|
|
curiosity: 0.30,
|
|
finalEnergy: 41.6
|
|
};
|
|
|
|
// Network Graph implementation
|
|
class NetworkNode {
|
|
constructor(x, y, index) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.origX = x;
|
|
this.origY = y;
|
|
this.velX = 0;
|
|
this.velY = 0;
|
|
this.index = index;
|
|
this.links = [];
|
|
this.radius = 1 + Math.random() * 2;
|
|
this.energy = Math.random() * 0.5 + 0.5;
|
|
this.evolution = Math.random();
|
|
this.pulseTimer = 0;
|
|
this.pulseSpeed = 0.05 + Math.random() * 0.1;
|
|
this.pulseSize = this.radius;
|
|
this.targetPulse = 1 + Math.random() * 2;
|
|
}
|
|
|
|
addLink(node) {
|
|
if (!this.links.includes(node) && node !== this) {
|
|
this.links.push(node);
|
|
node.links.push(this);
|
|
}
|
|
}
|
|
|
|
update(loopIndex) {
|
|
// Gentle oscillation
|
|
this.pulseTimer += this.pulseSpeed;
|
|
this.pulseSize = this.radius * (1 + 0.3 * Math.sin(this.pulseTimer));
|
|
|
|
// Subtle movement based on network energy
|
|
this.velX += (Math.random() - 0.5) * params.motion * 0.1;
|
|
this.velY += (Math.random() - 0.5) * params.motion * 0.1;
|
|
this.velX *= 0.9;
|
|
this.velY *= 0.9;
|
|
|
|
this.x += this.velX;
|
|
this.y += this.velY;
|
|
|
|
// Add some inertia toward original position
|
|
this.x += (this.origX - this.x) * 0.001;
|
|
this.y += (this.origY - this.y) * 0.001;
|
|
}
|
|
|
|
draw(ctx) {
|
|
// Draw link shadows first
|
|
ctx.beginPath();
|
|
ctx.strokeStyle = `rgba(255,255,255,${0.05 * params.dryness})`;
|
|
ctx.lineWidth = this.radius * 0.2;
|
|
ctx.lineCap = 'round';
|
|
|
|
for (const link of this.links) {
|
|
const dist = Math.hypot(this.x - link.x, this.y - link.y);
|
|
if (dist < 200) {
|
|
ctx.moveTo(this.x, this.y);
|
|
ctx.lineTo(link.x, link.y);
|
|
}
|
|
}
|
|
ctx.stroke();
|
|
|
|
// Draw node
|
|
ctx.beginPath();
|
|
const hue = 180 + (this.index * 360 / params.survivingNodes * 0.3);
|
|
const saturation = 30 + this.energy * 70;
|
|
const value = 80 + this.energy * 20;
|
|
|
|
ctx.fillStyle = `hsl(${hue}, ${saturation * params.dryness}%, ${value}%)`;
|
|
ctx.arc(this.x, this.y, this.pulseSize, 0, Math.PI * 2);
|
|
ctx.fill();
|
|
|
|
ctx.beginPath();
|
|
ctx.strokeStyle = `hsl(${hue}, ${saturation * params.dryness}%, 90%)`;
|
|
ctx.lineWidth = 1;
|
|
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
|
|
ctx.stroke();
|
|
}
|
|
}
|
|
|
|
class NetworkGraph {
|
|
constructor() {
|
|
this.nodes = [];
|
|
this.createdNodes = 0;
|
|
this.maxNodes = params.survivingNodes * 2;
|
|
this.establishConnections();
|
|
}
|
|
|
|
establishConnections() {
|
|
// Create initial nodes
|
|
const centerX = canvas.width / 2;
|
|
const centerY = canvas.height / 2;
|
|
const radius = Math.min(canvas.width, canvas.height) * 0.3;
|
|
|
|
for (let i = 0; i < params.survivingNodes; i++) {
|
|
const angle = (i / params.survivingNodes) * Math.PI * 2;
|
|
const x = centerX + Math.cos(angle) * radius;
|
|
const y = centerY + Math.sin(angle) * radius;
|
|
this.nodes.push(new NetworkNode(x, y, i));
|
|
this.createdNodes++;
|
|
}
|
|
|
|
// Create additional nodes based on density
|
|
const additionalNodes = Math.floor(params.density * 10);
|
|
for (let i = 0; i < additionalNodes && this.createdNodes < this.maxNodes; i++) {
|
|
const angle = Math.random() * Math.PI * 2;
|
|
const dist = Math.random() * radius * 0.8 + radius * 0.2;
|
|
const x = centerX + Math.cos(angle) * dist;
|
|
const y = centerY + Math.sin(angle) * dist;
|
|
this.nodes.push(new NetworkNode(x, y, this.createdNodes));
|
|
this.createdNodes++;
|
|
}
|
|
|
|
// Connect nodes based on connectedness and complexity
|
|
const targetConnections = Math.floor(params.connectedness * params.survivingNodes * 2);
|
|
|
|
for (let i = 0; i < this.nodes.length; i++) {
|
|
const node = this.nodes[i];
|
|
const connections = Math.floor(Math.random() * targetConnections * params.complexity) + 1;
|
|
|
|
for (let j = 0; j < connections; j++) {
|
|
if (this.nodes.length > 1) {
|
|
const other = this.nodes[Math.floor(Math.random() * this.nodes.length)];
|
|
node.addLink(other);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Ensure at least some loops exist
|
|
for (let i = 0; i < params.loops; i++) {
|
|
if (this.nodes.length >= 3) {
|
|
const a = Math.floor(Math.random() * this.nodes.length);
|
|
const b = Math.floor(Math.random() * this.nodes.length);
|
|
const c = Math.floor(Math.random() * this.nodes.length);
|
|
|
|
this.nodes[a].addLink(this.nodes[b]);
|
|
this.nodes[b].addLink(this.nodes[c]);
|
|
this.nodes[c].addLink(this.nodes[a]);
|
|
}
|
|
}
|
|
|
|
// Remove isolated nodes
|
|
this.nodes = this.nodes.filter(node => node.links.length > 0);
|
|
}
|
|
|
|
update() {
|
|
this.nodes.forEach(node => node.update());
|
|
}
|
|
|
|
draw() {
|
|
// Draw links that are behind nodes first
|
|
ctx.beginPath();
|
|
ctx.strokeStyle = `rgba(255,255,255,${0.1 * params.dryness})`;
|
|
ctx.lineWidth = 1;
|
|
ctx.lineCap = 'round';
|
|
|
|
for (const node of this.nodes) {
|
|
for (const link of node.links) {
|
|
const dist = Math.hypot(node.x - link.x, node.y - link.y);
|
|
if (dist < 250) {
|
|
ctx.moveTo(node.x, node.y);
|
|
ctx.lineTo(link.x, link.y);
|
|
}
|
|
}
|
|
}
|
|
ctx.stroke();
|
|
|
|
// Draw nodes
|
|
this.nodes.forEach(node => node.draw(ctx));
|
|
|
|
// Draw links on top with glow
|
|
ctx.beginPath();
|
|
ctx.strokeStyle = `rgba(255,255,255,${0.15 * params.dryness})`;
|
|
ctx.shadowBlur = 5;
|
|
ctx.shadowColor = 'white';
|
|
|
|
for (const node of this.nodes) {
|
|
for (const link of node.links) {
|
|
const dist = Math.hypot(node.x - link.x, node.y - link.y);
|
|
if (dist < 250) {
|
|
ctx.moveTo(node.x, node.y);
|
|
ctx.lineTo(link.x, link.y);
|
|
}
|
|
}
|
|
}
|
|
ctx.stroke();
|
|
|
|
ctx.shadowBlur = 0;
|
|
}
|
|
}
|
|
|
|
let network = new NetworkGraph();
|
|
let frameCount = 0;
|
|
|
|
function animate() {
|
|
frameCount++;
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Add new nodes occasionally based on density and complexity
|
|
if (frameCount % 100 === 0 && network.createdNodes < network.maxNodes && Math.random() < params.density * params.complexity) {
|
|
const centerX = canvas.width / 2;
|
|
const centerY = canvas.height / 2;
|
|
const radius = Math.min(canvas.width, canvas.height) * 0.3;
|
|
const angle = Math.random() * Math.PI * 2;
|
|
const dist = Math.random() * radius * 0.8 + radius * 0.2;
|
|
const x = centerX + Math.cos(angle) * dist;
|
|
const y = centerY + Math.sin(angle) * dist;
|
|
network.nodes.push(new NetworkNode(x, y, network.createdNodes));
|
|
network.createdNodes++;
|
|
}
|
|
|
|
network.update();
|
|
network.draw();
|
|
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |