221 lines
No EOL
7.1 KiB
HTML
221 lines
No EOL
7.1 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: Neural Flux</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background-color: #111;
|
|
color: #444;
|
|
font-family: 'Courier New', monospace;
|
|
cursor: crosshair;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#info {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
left: 10px;
|
|
font-size: 10px;
|
|
color: #555;
|
|
}
|
|
</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 the provided specifications
|
|
const params = {
|
|
motion: 0.408,
|
|
density: 0.517,
|
|
complexity: 0.470,
|
|
connectedness: 0.418,
|
|
lifespan: 0.536,
|
|
survivingNodes: 81,
|
|
branchCount: 68,
|
|
loops: 198,
|
|
maxDepth: 19,
|
|
thicknessRatio: 1.25,
|
|
fractalDimension: 1.632,
|
|
finalEnergy: 433.3,
|
|
pulse: { avg: 0.70, min: 0.30, max: 2.00 },
|
|
tone: {
|
|
anger: 0.00,
|
|
sadness: 0.00,
|
|
curiosity: 0.70,
|
|
dryness: 0.80,
|
|
playfulness: 0.10,
|
|
tension: 0.00
|
|
},
|
|
palette: {
|
|
curiosity: '#4ECDC4',
|
|
dryness: '#AAAAAA',
|
|
playfulness: '#FF6B6B'
|
|
}
|
|
};
|
|
|
|
// Network graph simulation
|
|
class Node {
|
|
constructor(x, y, fixed = false) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.fixed = fixed;
|
|
this.vx = 0;
|
|
this.vy = 0;
|
|
this.radius = 1 + Math.random() * 3;
|
|
this.connectionRadius = 100 + Math.random() * 200;
|
|
this.life = 0;
|
|
this.maxLife = 1000 + Math.random() * 2000;
|
|
this.targetRadius = this.radius;
|
|
}
|
|
|
|
update(others) {
|
|
if (this.fixed) return;
|
|
|
|
// Simple physics
|
|
this.vx += (Math.random() - 0.5) * 0.2;
|
|
this.vy += (Math.random() - 0.5) * 0.2;
|
|
this.vx *= 0.9;
|
|
this.vy *= 0.9;
|
|
|
|
// Bounce off edges
|
|
if (this.x < 0 || this.x > canvas.width) this.vx *= -0.5;
|
|
if (this.y < 0 || this.y > canvas.height) this.vy *= -0.5;
|
|
|
|
this.x += this.vx;
|
|
this.y += this.vy;
|
|
|
|
// Update radius based on pulse
|
|
const pulseFactor = params.pulse.avg * (0.7 + Math.sin(Date.now() * 0.001) * 0.3);
|
|
this.radius = this.targetRadius * pulseFactor;
|
|
|
|
// Aging
|
|
this.life += 1;
|
|
if (this.life > this.maxLife) {
|
|
this.radius *= 0.9;
|
|
}
|
|
}
|
|
|
|
draw() {
|
|
// Fade out when old
|
|
const alpha = Math.min(1, 1 - (this.life / this.maxLife) * 0.8);
|
|
ctx.globalAlpha = alpha;
|
|
|
|
// Draw node
|
|
ctx.beginPath();
|
|
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
|
|
ctx.fillStyle = params.palette.dryness;
|
|
ctx.fill();
|
|
|
|
// Draw connection lines
|
|
others.forEach(other => {
|
|
const dx = other.x - this.x;
|
|
const dy = other.y - this.y;
|
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
|
|
if (distance < this.connectionRadius && distance > 0) {
|
|
// Dynamic thickness based on fractal dimension
|
|
const thickness = 0.5 + params.fractalDimension * 0.5;
|
|
ctx.lineWidth = thickness;
|
|
|
|
// Pulse-based color variation
|
|
const hue = params.tone.curiosity;
|
|
const saturation = 10 + params.pulse.avg * 20;
|
|
const value = 50 + params.pulse.avg * 30;
|
|
ctx.strokeStyle = `hsl(${hue}, ${saturation}%, ${value}%)`;
|
|
|
|
ctx.beginPath();
|
|
ctx.moveTo(this.x, this.y);
|
|
ctx.lineTo(other.x, other.y);
|
|
ctx.stroke();
|
|
}
|
|
});
|
|
|
|
ctx.globalAlpha = 1;
|
|
}
|
|
}
|
|
|
|
// Create network
|
|
const nodes = [];
|
|
const centerX = canvas.width / 2;
|
|
const centerY = canvas.height / 2;
|
|
|
|
// Create core nodes
|
|
for (let i = 0; i < params.survivingNodes; i++) {
|
|
const angle = (i / params.survivingNodes) * Math.PI * 2;
|
|
const distance = 100 + Math.random() * 200;
|
|
const x = centerX + Math.cos(angle) * distance;
|
|
const y = centerY + Math.sin(angle) * distance;
|
|
nodes.push(new Node(x, y, i === 0)); // Fix one node in center
|
|
}
|
|
|
|
// Add some random nodes
|
|
for (let i = 0; i < params.survivingNodes * 0.5; i++) {
|
|
nodes.push(new Node(
|
|
Math.random() * canvas.width,
|
|
Math.random() * canvas.height
|
|
));
|
|
}
|
|
|
|
// Connect nodes
|
|
nodes.forEach(node => {
|
|
node.connections = [];
|
|
nodes.forEach(other => {
|
|
if (node !== other && Math.random() < params.connectedness) {
|
|
// Determine connection strength based on graph properties
|
|
const distance = Math.sqrt(
|
|
Math.pow(other.x - node.x, 2) +
|
|
Math.pow(other.y - node.y, 2)
|
|
);
|
|
if (distance < node.connectionRadius * 1.5) {
|
|
node.connections.push(other);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
// Animation loop
|
|
function animate() {
|
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
ctx.fillStyle = '#111';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Update all nodes
|
|
nodes.forEach(node => node.update(nodes));
|
|
|
|
// Draw connections and nodes
|
|
nodes.forEach(node => node.draw());
|
|
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
|
|
// Interactive elements
|
|
canvas.addEventListener('click', (e) => {
|
|
const rect = canvas.getBoundingClientRect();
|
|
const x = e.clientX - rect.left;
|
|
const y = e.clientY - rect.top;
|
|
|
|
// Add new node at click position
|
|
nodes.push(new Node(x, y));
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |