birth: Whispers of Chaotic Symmetry
This commit is contained in:
parent
4525955e96
commit
3b9353b9a1
1 changed files with 134 additions and 0 deletions
134
index.html
Normal file
134
index.html
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Strange Attractors in Motion</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #0a0a10;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
}
|
||||||
|
canvas {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#attribution {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
text-align: center;
|
||||||
|
color: #555;
|
||||||
|
font-size: 12px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
</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();
|
||||||
|
|
||||||
|
// Strange attractor parameters
|
||||||
|
const params = {
|
||||||
|
a: 2.24,
|
||||||
|
b: 0.43,
|
||||||
|
c: -0.65,
|
||||||
|
d: -2.43,
|
||||||
|
e: 1.0,
|
||||||
|
scale: Math.min(window.innerWidth, window.innerHeight) * 0.4,
|
||||||
|
x: 0.1,
|
||||||
|
y: 0.1,
|
||||||
|
hue: 180,
|
||||||
|
strokeStyle: 'hsla(180, 80%, 70%, 0.8)',
|
||||||
|
lineWidth: 1.5,
|
||||||
|
speed: 0.005,
|
||||||
|
maxPoints: 5000,
|
||||||
|
points: [],
|
||||||
|
decay: 0.995
|
||||||
|
};
|
||||||
|
|
||||||
|
// Modulate parameters based on pulse
|
||||||
|
function modulateParams(time) {
|
||||||
|
const pulse = 1.0 + 0.2 * Math.sin(time * 0.001);
|
||||||
|
params.scale = Math.min(window.innerWidth, window.innerHeight) * (0.3 + 0.1 * pulse);
|
||||||
|
params.speed = 0.005 * pulse;
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawAttractor() {
|
||||||
|
ctx.strokeStyle = params.strokeStyle;
|
||||||
|
ctx.lineWidth = params.lineWidth;
|
||||||
|
ctx.lineCap = 'round';
|
||||||
|
|
||||||
|
// Update points with attractor formula
|
||||||
|
const newX = Math.sin(params.a * params.y) - Math.cos(params.b * params.x);
|
||||||
|
const newY = Math.sin(params.c * params.x) - Math.cos(params.d * params.y);
|
||||||
|
|
||||||
|
// Add noise based on motion parameter
|
||||||
|
const noiseX = 0.01 * (Math.random() - 0.5) * (1 + params.x);
|
||||||
|
const noiseY = 0.01 * (Math.random() - 0.5) * (1 + params.y);
|
||||||
|
|
||||||
|
params.x = params.e * newX + noiseX;
|
||||||
|
params.y = params.e * newY + noiseY;
|
||||||
|
|
||||||
|
// Add to points array with decay
|
||||||
|
params.points.push({x: params.x * params.scale + window.innerWidth/2,
|
||||||
|
y: params.y * params.scale + window.innerHeight/2});
|
||||||
|
|
||||||
|
if (params.points.length > params.maxPoints) {
|
||||||
|
params.points.shift();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw fading trail
|
||||||
|
for (let i = 0; i < params.points.length; i++) {
|
||||||
|
const point = params.points[i];
|
||||||
|
const alpha = Math.pow(i / params.points.length, 0.3) * 0.8;
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
|
||||||
|
// Color based on tone (curiosity = teals)
|
||||||
|
const hue = 180 + 60 * Math.sin(i * 0.01);
|
||||||
|
ctx.strokeStyle = `hsla(${hue}, 80%, 70%, ${alpha})`;
|
||||||
|
|
||||||
|
if (i === 0) {
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(point.x, point.y);
|
||||||
|
} else {
|
||||||
|
ctx.lineTo(point.x, point.y);
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset alpha for next frame
|
||||||
|
ctx.globalAlpha = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function animate(time) {
|
||||||
|
modulateParams(time);
|
||||||
|
|
||||||
|
// Clear with semi-transparent overlay for motion blur
|
||||||
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
drawAttractor();
|
||||||
|
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
Loading…
Add table
Reference in a new issue