156 lines
No EOL
5.2 KiB
HTML
156 lines
No EOL
5.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Chaotic Convergence</title>
|
|
<style>
|
|
body, html {
|
|
margin: 0;
|
|
padding: 0;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
background: #0a0a0a;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: absolute;
|
|
bottom: 20px;
|
|
left: 20px;
|
|
color: rgba(255,255,255,0.3);
|
|
font-size: 10px;
|
|
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');
|
|
|
|
// Set canvas to full window size
|
|
function resizeCanvas() {
|
|
canvas.width = window.innerWidth;
|
|
canvas.height = window.innerHeight;
|
|
}
|
|
window.addEventListener('resize', resizeCanvas);
|
|
resizeCanvas();
|
|
|
|
// Strange attractor parameters
|
|
const params = {
|
|
a: 2.0,
|
|
b: 0.6,
|
|
c: 1.2,
|
|
d: 1.1,
|
|
e: 2.0,
|
|
f: 0.4,
|
|
scale: 50,
|
|
hue: 0,
|
|
pulse: 1.25,
|
|
motion: 0.5,
|
|
complexity: 0.5
|
|
};
|
|
|
|
// Dynamic resolution based on parameters
|
|
const points = [];
|
|
const maxPoints = Math.floor(200 + params.motion * 1500);
|
|
const trailLength = Math.floor(5 + params.complexity * 20);
|
|
|
|
// Initialize points
|
|
for (let i = 0; i < maxPoints; i++) {
|
|
points.push({
|
|
x: Math.random() * 2 - 1,
|
|
y: Math.random() * 2 - 1,
|
|
z: Math.random() * 2 - 1,
|
|
history: [],
|
|
hue: Math.random() * 360
|
|
});
|
|
}
|
|
|
|
function draw() {
|
|
// Fade effect based on dryness/tension
|
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Dynamic scale based on pulse
|
|
const scale = params.scale * (0.8 + 0.4 * Math.sin(Date.now() * 0.0005 * params.pulse));
|
|
|
|
// Update and draw points
|
|
points.forEach(point => {
|
|
// Strange attractor equations (modified Hénon)
|
|
const x = point.x;
|
|
const y = point.y;
|
|
const z = point.z;
|
|
|
|
point.x = Math.sin(params.a * y) - Math.cos(params.b * x);
|
|
point.y = Math.sin(params.c * z) - Math.cos(params.d * y);
|
|
point.z = Math.sin(params.e * x) - Math.cos(params.f * z);
|
|
|
|
// Add small random variations based on motion
|
|
point.x += (Math.random() - 0.5) * 0.02 * params.motion;
|
|
point.y += (Math.random() - 0.5) * 0.02 * params.motion;
|
|
point.z += (Math.random() - 0.5) * 0.02 * params.motion;
|
|
|
|
// Store history for trails
|
|
point.history.push({
|
|
x: point.x * scale + canvas.width/2,
|
|
y: point.y * scale + canvas.height/2
|
|
});
|
|
if (point.history.length > trailLength) point.history.shift();
|
|
|
|
// Draw with trail
|
|
ctx.strokeStyle = `hsl(${point.hue}, 40%, ${70 + 10 * Math.sin(point.history.length * 0.1)}%)`;
|
|
ctx.lineWidth = 0.5 + 1.5 * params.motion * (point.history.length / trailLength);
|
|
|
|
ctx.beginPath();
|
|
point.history.forEach((pos, i) => {
|
|
const alpha = i / point.history.length;
|
|
ctx.globalAlpha = alpha * 0.8;
|
|
if (i === 0) {
|
|
ctx.moveTo(pos.x, pos.y);
|
|
} else {
|
|
ctx.lineTo(pos.x, pos.y);
|
|
}
|
|
});
|
|
ctx.stroke();
|
|
});
|
|
|
|
// Glow effect
|
|
ctx.globalAlpha = 0.1;
|
|
const gradient = ctx.createRadialGradient(
|
|
canvas.width/2, canvas.height/2, 50,
|
|
canvas.width/2, canvas.height/2, Math.min(canvas.width, canvas.height)/2
|
|
);
|
|
gradient.addColorStop(0, 'white');
|
|
gradient.addColorStop(1, 'transparent');
|
|
ctx.fillStyle = gradient;
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
ctx.globalAlpha = 1;
|
|
|
|
requestAnimationFrame(draw);
|
|
}
|
|
|
|
// Randomize parameters over time
|
|
function randomizeParams() {
|
|
params.a = 1.8 + Math.random() * 0.6;
|
|
params.b = 0.5 + Math.random() * 0.3;
|
|
params.c = 1.0 + Math.random() * 0.5;
|
|
params.d = 0.9 + Math.random() * 0.4;
|
|
params.e = 1.9 + Math.random() * 0.4;
|
|
params.f = 0.3 + Math.random() * 0.3;
|
|
params.scale = 30 + Math.random() * 40;
|
|
params.pulse = 1.0 + Math.random() * 0.6;
|
|
}
|
|
|
|
// Start animation
|
|
setTimeout(randomizeParams, 2000);
|
|
setInterval(randomizeParams, 15000);
|
|
draw();
|
|
</script>
|
|
</body>
|
|
</html> |