pulsing-quantum-dust-jv3d/index.html

118 lines
No EOL
3.6 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 Particle System</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0a;
font-family: 'Courier New', monospace;
color: #33ff33;
}
#info {
position: absolute;
bottom: 10px;
left: 10px;
font-size: 10px;
text-shadow: 0 0 5px #33ff33;
}
</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');
// Set canvas to full window size
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
// Particle system parameters
const params = {
motion: 0.5,
density: 0.5,
complexity: 0.5,
connectedness: 0.5,
lifespan: 0.5,
pulse: { avg: 1.25, min: 1.0, max: 1.55 },
tone: { anger: 0.0, sadness: 0.0, curiosity: 0.1, dryness: 0.9, playfulness: 0.0, tension: 0.0 }
};
// Create particles
class Particle {
constructor() {
this.reset();
this.life = Math.random() * 200 + 50;
this.decay = Math.random() * 0.01 + 0.002;
}
reset() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.vx = (Math.random() - 0.5) * 2 * params.motion;
this.vy = (Math.random() - 0.5) * 2 * params.motion;
this.size = Math.random() * 3 + 1;
this.color = `rgba(255, 255, 255, ${0.7 * params.tone.dryness})`;
}
update() {
this.x += this.vx;
this.y += this.vy;
// Boundary collision
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
// Pulse effect
const pulseFactor = params.pulse.avg + Math.sin(Date.now() * 0.002) * 0.2;
this.size = Math.max(1, this.size * pulseFactor * 0.7);
// Energy decay
this.life -= this.decay;
if (this.life <= 0) this.reset();
}
draw() {
ctx.fillStyle = this.color;
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fill();
}
}
// Create particle system
const particles = [];
const particleCount = Math.floor(canvas.width * canvas.height * 0.0005 * params.density);
for (let i = 0; i < particleCount; i++) {
particles.push(new Particle());
}
// Animation loop
function animate() {
// Clear with slight fade
ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Update and draw particles
particles.forEach(p => {
p.update();
p.draw();
});
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>