154 lines
No EOL
4.7 KiB
HTML
154 lines
No EOL
4.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Entangled Resonance</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background: #0a0a0a;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: absolute;
|
|
bottom: 10px;
|
|
color: rgba(255, 255, 255, 0.3);
|
|
font-family: monospace;
|
|
font-size: 12px;
|
|
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');
|
|
|
|
// 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: 1.2,
|
|
b: 2.4,
|
|
c: 3.6,
|
|
d: 1.0,
|
|
e: 1.0,
|
|
f: 2.2,
|
|
x: 0.1,
|
|
y: 0.1,
|
|
z: 0.1,
|
|
scale: Math.min(canvas.width, canvas.height) * 0.4,
|
|
points: [],
|
|
maxPoints: 50000,
|
|
trails: []
|
|
};
|
|
|
|
// Color palette based on dryness
|
|
const palette = {
|
|
bg: '#0a0a0a',
|
|
line: '#ffffff',
|
|
pulse: 0.53
|
|
};
|
|
|
|
// Generate points
|
|
function generatePoints() {
|
|
// Adjust parameters based on motion & complexity
|
|
params.a = 1.0 + (Math.sin(Date.now() * 0.0005) * 0.3);
|
|
params.b = 2.0 + (Math.cos(Date.now() * 0.0003) * 0.4);
|
|
params.c = 3.0 + (Math.sin(Date.now() * 0.0002) * 0.5);
|
|
|
|
for (let i = 0; i < params.maxPoints; i++) {
|
|
// Strange attractor equations
|
|
const dt = 0.01;
|
|
const x1 = params.x;
|
|
const y1 = params.y;
|
|
const z1 = params.z;
|
|
|
|
params.x = Math.sin(params.a * y1) - Math.cos(params.b * x1);
|
|
params.y = Math.sin(params.c * x1) - Math.cos(params.d * z1);
|
|
params.z = Math.sin(params.e * z1) - Math.cos(params.f * x1);
|
|
|
|
// Scale and position
|
|
const px = params.x * params.scale + canvas.width/2;
|
|
const py = params.y * params.scale + canvas.height/2;
|
|
|
|
params.points.push({x: px, y: py});
|
|
|
|
// Limit point array
|
|
if (params.points.length > params.maxPoints) {
|
|
params.points.shift();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Draw points with trails
|
|
function drawPoints() {
|
|
ctx.fillStyle = '#00000020';
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
const pulse = (Math.sin(Date.now() * 0.002) * 0.5 + 0.5) * params.pulse;
|
|
const lineWidth = 0.5 + pulse * 2;
|
|
|
|
// Draw trails with fading alpha
|
|
ctx.strokeStyle = `${palette.line}20`;
|
|
ctx.lineWidth = lineWidth * 0.5;
|
|
ctx.lineCap = 'round';
|
|
|
|
if (params.trails.length > 0) {
|
|
ctx.beginPath();
|
|
ctx.moveTo(params.trails[0].x, params.trails[0].y);
|
|
for (let i = 1; i < params.trails.length; i++) {
|
|
ctx.lineTo(params.trails[i].x, params.trails[i].y);
|
|
}
|
|
ctx.stroke();
|
|
}
|
|
|
|
// Draw current points
|
|
ctx.strokeStyle = palette.line;
|
|
ctx.lineWidth = lineWidth;
|
|
ctx.lineCap = 'round';
|
|
|
|
if (params.points.length > 0) {
|
|
ctx.beginPath();
|
|
ctx.moveTo(params.points[0].x, params.points[0].y);
|
|
for (let i = 1; i < params.points.length; i++) {
|
|
ctx.lineTo(params.points[i].x, params.points[i].y);
|
|
}
|
|
ctx.stroke();
|
|
}
|
|
|
|
// Update trails
|
|
params.trails = [...params.points];
|
|
if (params.trails.length > 1000) {
|
|
params.trails = params.trails.slice(-1000);
|
|
}
|
|
}
|
|
|
|
// Animation loop
|
|
function animate() {
|
|
generatePoints();
|
|
drawPoints();
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
// Start animation
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |