birth: Pulsing Chaos Patterns
This commit is contained in:
parent
883586d947
commit
b92f6aa8bd
1 changed files with 105 additions and 0 deletions
105
index.html
Normal file
105
index.html
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Chaos in Motion</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background-color: #0a0a1a;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
#attribution {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
</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
|
||||
let points = [];
|
||||
const count = 150;
|
||||
const a = 1.5;
|
||||
const b = 2.5;
|
||||
const c = 3.5;
|
||||
const d = 1.0;
|
||||
const e = 1.0;
|
||||
|
||||
let time = 0;
|
||||
let hue = 0;
|
||||
|
||||
function draw() {
|
||||
// Dark background with subtle noise
|
||||
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Generate new points
|
||||
if (points.length < count) {
|
||||
points.push({
|
||||
x: Math.random() * canvas.width - canvas.width/2,
|
||||
y: Math.random() * canvas.height - canvas.height/2
|
||||
});
|
||||
}
|
||||
|
||||
// Update points using strange attractor equations
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
const p = points[i];
|
||||
const x = p.x;
|
||||
const y = p.y;
|
||||
|
||||
p.x = Math.sin(a * y) - Math.cos(b * x);
|
||||
p.y = Math.sin(c * x) - Math.cos(d * y);
|
||||
|
||||
// Scale and position
|
||||
const scale = 100;
|
||||
const px = (p.x * scale) + canvas.width/2;
|
||||
const py = (p.y * scale) + canvas.height/2;
|
||||
|
||||
// Color based on density
|
||||
const intensity = 0.5 + (Math.sin(hue + i * 0.1) * 0.5);
|
||||
ctx.fillStyle = `hsl(${hue}, 80%, ${intensity * 70}%)`;
|
||||
ctx.beginPath();
|
||||
ctx.arc(px, py, Math.max(1, intensity * 1.5), 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
hue = (hue + 0.5) % 360;
|
||||
time += 0.01;
|
||||
}
|
||||
|
||||
function animate() {
|
||||
draw();
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue