birth: Teal Strange Current
This commit is contained in:
parent
80f9af5a21
commit
b8762171a7
1 changed files with 125 additions and 0 deletions
125
index.html
Normal file
125
index.html
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Generative Flow</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #0a0a0a;
|
||||
color: #fff;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
canvas {
|
||||
flex: 1;
|
||||
}
|
||||
.attribution {
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
font-size: 10px;
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="canvas"></canvas>
|
||||
<div class="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
|
||||
let points = [];
|
||||
const numPoints = 150;
|
||||
const attractorA = 1.4;
|
||||
const attractorB = 0.3;
|
||||
const attractorC = -1.3;
|
||||
const attractorD = -1.4;
|
||||
|
||||
// Color scheme based on parameters
|
||||
const hue = 170; // teal for curiosity
|
||||
const saturation = 50 + Math.floor(70 * (1 - 0.8)); // dryness reduces saturation
|
||||
const lightness = 70;
|
||||
const color = `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
||||
|
||||
// Initialize points
|
||||
for (let i = 0; i < numPoints; i++) {
|
||||
points.push({
|
||||
x: Math.random() * canvas.width,
|
||||
y: Math.random() * canvas.height,
|
||||
px: Math.random() * canvas.width,
|
||||
py: Math.random() * canvas.height
|
||||
});
|
||||
}
|
||||
|
||||
// Animation parameters
|
||||
let time = 0;
|
||||
const motion = 0.5;
|
||||
const step = 0.005 * motion * 2;
|
||||
|
||||
function draw() {
|
||||
// Fade effect for previous frames
|
||||
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Update and draw points
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = 0.7 + Math.random() * 0.3;
|
||||
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
const p = points[i];
|
||||
const x = p.px;
|
||||
const y = p.py;
|
||||
|
||||
// Strange attractor formula
|
||||
const xNew = Math.sin(attractorA * y) - Math.cos(attractorB * x);
|
||||
const yNew = Math.sin(attractorC * x) - Math.cos(attractorD * y);
|
||||
|
||||
p.px = xNew * 100 + canvas.width/2;
|
||||
p.py = yNew * 100 + canvas.height/2;
|
||||
|
||||
// Connect to close points occasionally
|
||||
if (Math.random() < 0.1 * 0.5) { // connectedness factor
|
||||
const closest = points.reduce((acc, point) => {
|
||||
const dist = Math.hypot(point.px - p.px, point.py - p.py);
|
||||
return dist < 50 && dist > 0 ? point : acc;
|
||||
}, null);
|
||||
|
||||
if (closest) {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(p.px, p.py);
|
||||
ctx.lineTo(closest.px, closest.py);
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw point
|
||||
ctx.beginPath();
|
||||
ctx.arc(p.px, p.py, 1, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
time += step;
|
||||
requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
draw();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue