birth: Drifting Curiosity Particles
This commit is contained in:
parent
bc83f87ffc
commit
37a28bb674
1 changed files with 153 additions and 0 deletions
153
index.html
Normal file
153
index.html
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
<!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: #0a0a0a;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
#attribution {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
color: #444;
|
||||
font-size: 10px;
|
||||
text-shadow: 0 0 5px rgba(0,0,0,0.5);
|
||||
}
|
||||
</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();
|
||||
|
||||
// Particle system configuration
|
||||
const config = {
|
||||
count: Math.floor(200 * (0.5 + Math.random() * 0.5)),
|
||||
motion: 0.5,
|
||||
density: 0.5,
|
||||
complexity: 0.5,
|
||||
connectedness: 0.5,
|
||||
lifespan: 0.5,
|
||||
pulse: {
|
||||
avg: 1.08,
|
||||
min: 0.95,
|
||||
max: 1.20
|
||||
},
|
||||
tone: {
|
||||
anger: 0.00,
|
||||
sadness: 0.00,
|
||||
curiosity: 0.80,
|
||||
dryness: 0.90,
|
||||
playfulness: 0.10,
|
||||
tension: 0.00
|
||||
}
|
||||
};
|
||||
|
||||
// Create particles with varying behaviors
|
||||
class Particle {
|
||||
constructor() {
|
||||
this.reset();
|
||||
this.life = 0;
|
||||
this.maxLife = 100 + Math.random() * 200;
|
||||
this.energy = Math.random();
|
||||
this.trail = [];
|
||||
this.maxTrail = 5 + Math.floor(Math.random() * 10);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.pos = {
|
||||
x: Math.random() * canvas.width,
|
||||
y: Math.random() * canvas.height
|
||||
};
|
||||
this.vel = {
|
||||
x: (Math.random() - 0.5) * 4 * config.motion,
|
||||
y: (Math.random() - 0.5) * 4 * config.motion
|
||||
};
|
||||
this.size = 1 + Math.random() * 3;
|
||||
this.color = `hsl(180, 30%, ${70 + Math.random() * 10}%)`;
|
||||
if (Math.random() > 0.8) this.color = `hsl(180, 20%, ${60 + Math.random() * 20}%)`;
|
||||
}
|
||||
|
||||
update() {
|
||||
// Apply pulse variations
|
||||
const pulseFactor = 0.95 + Math.sin(Date.now() * 0.001) * 0.25;
|
||||
|
||||
this.pos.x += this.vel.x * pulseFactor;
|
||||
this.pos.y += this.vel.y * pulseFactor;
|
||||
|
||||
// Wrap around edges
|
||||
if (this.pos.x < 0) this.pos.x = canvas.width;
|
||||
if (this.pos.x > canvas.width) this.pos.x = 0;
|
||||
if (this.pos.y < 0) this.pos.y = canvas.height;
|
||||
if (this.pos.y > canvas.height) this.pos.y = 0;
|
||||
|
||||
// Add to trail
|
||||
this.trail.push({...this.pos});
|
||||
if (this.trail.length > this.maxTrail) this.trail.shift();
|
||||
|
||||
this.life++;
|
||||
if (this.life > this.maxLife) {
|
||||
this.reset();
|
||||
this.life = 0;
|
||||
}
|
||||
}
|
||||
|
||||
draw() {
|
||||
// Draw trail
|
||||
for (let i = 0; i < this.trail.length; i++) {
|
||||
const alpha = i / this.trail.length;
|
||||
const size = this.size * (0.3 + alpha * 0.7);
|
||||
ctx.globalAlpha = alpha * 0.5;
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.trail[i].x, this.trail[i].y, size, 0, Math.PI * 2);
|
||||
ctx.fillStyle = this.color;
|
||||
ctx.fill();
|
||||
}
|
||||
ctx.globalAlpha = 1;
|
||||
|
||||
// Draw particle
|
||||
ctx.beginPath();
|
||||
ctx.arc(this.pos.x, this.pos.y, this.size, 0, Math.PI * 2);
|
||||
ctx.fillStyle = this.color;
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
const particles = Array(config.count).fill().map(() => new Particle());
|
||||
|
||||
function animate() {
|
||||
// Dark background
|
||||
ctx.fillStyle = 'rgba(10, 10, 10, 0.05)';
|
||||
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>
|
||||
Loading…
Add table
Reference in a new issue