birth: Chromatic Vortex Entropy
This commit is contained in:
parent
7775716359
commit
54c602e963
1 changed files with 142 additions and 0 deletions
142
index.html
Normal file
142
index.html
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Neurameba Strange Attractor</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #0a0a0a;
|
||||
color: #f0f0f0;
|
||||
font-family: 'Courier New', monospace;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
canvas {
|
||||
flex: 1;
|
||||
}
|
||||
#attribution {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
background: 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();
|
||||
|
||||
// Parameters based on input
|
||||
const params = {
|
||||
motion: 0.5,
|
||||
density: 0.5,
|
||||
complexity: 0.5,
|
||||
connectedness: 0.5,
|
||||
lifespan: 0.5,
|
||||
pulse: { avg: 1.05, min: 1.0, max: 1.1 },
|
||||
tone: { anger: 0.0, sadness: 0.0, curiosity: 0.3, dryness: 0.9, playfulness: 0.0, tension: 0.0 }
|
||||
};
|
||||
|
||||
// Strange attractor parameters (adjust based on complexity)
|
||||
const attractor = {
|
||||
a: 0.2 * (1 + params.complexity * 4),
|
||||
b: 0.1 * (1 + params.complexity * 4),
|
||||
c: 1.0 * (1 + params.complexity * 2),
|
||||
d: 0.3 * (1 + params.complexity * 2),
|
||||
e: 1.0,
|
||||
f: 1.0,
|
||||
scale: 10 + params.complexity * 20,
|
||||
points: [],
|
||||
maxPoints: 10000 * (1 + params.density),
|
||||
decay: 0.99 - params.motion * 0.3,
|
||||
color: `hsl(${200 + params.tone.curiosity * 80}, ${30 + params.tone.dryness * 70}%, ${50 + params.tone.dryness * 10}%)`,
|
||||
lineWidth: 1 + params.density * 2,
|
||||
pulse: params.pulse.avg
|
||||
};
|
||||
|
||||
// Initialize points
|
||||
function init() {
|
||||
attractor.points = [];
|
||||
for (let i = 0; i < attractor.maxPoints; i++) {
|
||||
attractor.points.push({
|
||||
x: (Math.random() - 0.5) * canvas.width,
|
||||
y: (Math.random() - 0.5) * canvas.height,
|
||||
lifetime: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Strange attractor equations (Rössler-like)
|
||||
function attractorStep(p) {
|
||||
const x = p.x / attractor.scale;
|
||||
const y = p.y / attractor.scale;
|
||||
const z = params.motion * 0.1 + 0.01;
|
||||
|
||||
const dx = -y - z;
|
||||
const dy = x + attractor.a * y;
|
||||
const dz = attractor.b + z * (x - attractor.c);
|
||||
|
||||
p.x += dx * attractor.pulse;
|
||||
p.y += dy * attractor.pulse;
|
||||
p.z = dz;
|
||||
|
||||
// Apply decay to prevent explosion
|
||||
p.x *= attractor.decay;
|
||||
p.y *= attractor.decay;
|
||||
}
|
||||
|
||||
function draw() {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.globalAlpha = 0.8;
|
||||
|
||||
attractor.points.forEach(p => {
|
||||
attractorStep(p);
|
||||
p.lifetime++;
|
||||
|
||||
// Fade out old points
|
||||
const alpha = Math.min(1, 1 - (p.lifetime / attractor.maxPoints) * 2);
|
||||
ctx.globalAlpha = alpha;
|
||||
|
||||
// Draw point
|
||||
ctx.fillStyle = attractor.color;
|
||||
ctx.beginPath();
|
||||
ctx.arc(
|
||||
canvas.width/2 + p.x,
|
||||
canvas.height/2 + p.y,
|
||||
attractor.lineWidth * (0.5 + Math.sin(p.lifetime * 0.01) * 0.5),
|
||||
0,
|
||||
Math.PI * 2
|
||||
);
|
||||
ctx.fill();
|
||||
});
|
||||
|
||||
ctx.globalAlpha = 1;
|
||||
requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
// Add pulse variation
|
||||
setInterval(() => {
|
||||
attractor.pulse = params.pulse.min + (params.pulse.max - params.pulse.min) * Math.random();
|
||||
}, 1000);
|
||||
|
||||
init();
|
||||
draw();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue