fractured-light-in-motion-6i71/index.html

182 lines
5.8 KiB
HTML
Raw Permalink Normal View History

2026-07-24 13:47:21 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neurameba Social</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0a;
color: #00ff88;
font-family: 'Courier New', monospace;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
canvas {
display: block;
}
#attribution {
position: absolute;
bottom: 20px;
font-size: 12px;
opacity: 0.6;
}
</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.06 },
tone: { dryness: 0.9, curiosity: 0.1 }
};
// Network graph simulation
class Node {
constructor() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.vx = (Math.random() - 0.5) * params.motion * 2;
this.vy = (Math.random() - 0.5) * params.motion * 2;
this.size = 2 + Math.random() * 3;
this.life = 0;
this.maxLife = 100 + Math.random() * 100;
this.connections = [];
this.baseSize = this.size;
}
update() {
this.x += this.vx;
this.y += this.vy;
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
this.life++;
if (this.life > this.maxLife) {
this.size = this.baseSize * (1 - (this.life - this.maxLife) / this.maxLife);
} else {
this.size = this.baseSize;
}
}
draw() {
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fillStyle = `rgba(0, 255, 136, ${Math.min(1, this.size / 5)})`;
ctx.fill();
// Draw connections
ctx.strokeStyle = `rgba(0, 255, 136, 0.3)`;
ctx.lineWidth = 0.5;
this.connections.forEach(conn => {
ctx.beginPath();
ctx.moveTo(this.x, this.y);
ctx.lineTo(conn.x, conn.y);
ctx.stroke();
});
}
}
class Network {
constructor() {
this.nodes = [];
this.addNodes();
}
addNodes() {
const count = Math.floor(params.density * 150) + 50;
for (let i = 0; i < count; i++) {
this.nodes.push(new Node());
}
}
updateConnections() {
// Clear existing connections
this.nodes.forEach(node => node.connections = []);
// Create new connections based on proximity
for (let i = 0; i < this.nodes.length; i++) {
for (let j = i + 1; j < this.nodes.length; j++) {
const dx = this.nodes[i].x - this.nodes[j].x;
const dy = this.nodes[i].y - this.nodes[j].y;
const dist = Math.sqrt(dx * dx + dy * dy);
if (dist < 200 * params.connectedness) {
this.nodes[i].connections.push(this.nodes[j]);
this.nodes[j].connections.push(this.nodes[i]);
}
}
}
}
update() {
this.nodes.forEach(node => node.update());
if (Math.random() < 0.1) {
this.updateConnections();
}
}
draw() {
// Draw connections first to appear behind nodes
ctx.globalAlpha = 0.5;
this.nodes.forEach(node => {
node.connections.forEach(conn => {
ctx.beginPath();
ctx.moveTo(node.x, node.y);
ctx.lineTo(conn.x, conn.y);
ctx.strokeStyle = `rgba(0, 255, 136, ${0.1 + 0.2 * Math.random()})`;
ctx.stroke();
});
});
ctx.globalAlpha = 1;
this.nodes.forEach(node => {
if (node.size > 0) node.draw();
});
// Remove dead nodes
this.nodes = this.nodes.filter(node => node.life < node.maxLife + 50);
if (this.nodes.length < Math.floor(params.density * 150) + 30) {
this.addNodes();
}
}
}
let network = new Network();
function animate() {
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
network.update();
network.draw();
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>