110 lines
No EOL
3.6 KiB
HTML
110 lines
No EOL
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Neurameba · motd.social</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
overflow: hidden;
|
|
background: #000;
|
|
color: #fff;
|
|
font-family: monospace;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
#attribution {
|
|
position: fixed;
|
|
bottom: 10px;
|
|
right: 10px;
|
|
font-size: 10px;
|
|
opacity: 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');
|
|
|
|
function resizeCanvas() {
|
|
canvas.width = window.innerWidth;
|
|
canvas.height = window.innerHeight;
|
|
}
|
|
|
|
window.addEventListener('resize', resizeCanvas);
|
|
resizeCanvas();
|
|
|
|
// Fractal parameters derived from inputs
|
|
const params = {
|
|
motion: 0.5,
|
|
density: 0.5,
|
|
complexity: 0.5,
|
|
connectedness: 0.5,
|
|
lifespan: 0.5,
|
|
pulse: 1.08,
|
|
tone: { anger: 0, sadness: 0, curiosity: 0.1, dryness: 0.9, playfulness: 0, tension: 0 }
|
|
};
|
|
|
|
// Fractal variables
|
|
let angle = 0;
|
|
let depth = 0;
|
|
const maxDepth = 8; // Adjusted based on complexity
|
|
const branchAngle = Math.PI * 0.6; // Adjusted based on connectedness
|
|
const branchLength = (canvas.width + canvas.height) * 0.01 * params.pulse;
|
|
const thickness = Math.max(1, Math.min(8, params.density * 6 + 1));
|
|
const color = `hsl(0, 0%, ${50 + 20 * params.tone.dryness}%)`; // Monochrome
|
|
|
|
function drawFractal(x, y, len, angle, depth, maxDepth) {
|
|
if (depth > maxDepth || len < 2) return;
|
|
|
|
const rad = angle * Math.PI / 180;
|
|
const x2 = x + Math.cos(rad) * len;
|
|
const y2 = y + Math.sin(rad) * len;
|
|
|
|
// Draw branch
|
|
ctx.strokeStyle = color;
|
|
ctx.lineWidth = thickness * (1 - depth / maxDepth);
|
|
ctx.beginPath();
|
|
ctx.moveTo(x, y);
|
|
ctx.lineTo(x2, y2);
|
|
ctx.stroke();
|
|
|
|
// Recursive branches
|
|
const nextLen = len * params.motion * 0.8;
|
|
const variations = Math.ceil(params.complexity * 5);
|
|
|
|
for (let i = 0; i < variations; i++) {
|
|
const newAngle = angle + (Math.random() * branchAngle * 2 - branchAngle) * params.connectedness;
|
|
drawFractal(x2, y2, nextLen, newAngle, depth + 1, maxDepth);
|
|
}
|
|
}
|
|
|
|
function animate() {
|
|
// Clear with fade effect based on lifespan
|
|
ctx.fillStyle = `rgba(0, 0, 0, ${0.1 + 0.9 * (1 - params.lifespan)})`;
|
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
// Calculate center with pulse effect
|
|
const centerX = canvas.width / 2 + Math.sin(angle * 0.02) * 10 * params.pulse;
|
|
const centerY = canvas.height / 2 + Math.cos(angle * 0.03) * 10 * params.pulse;
|
|
|
|
// Draw fractal
|
|
ctx.save();
|
|
ctx.translate(centerX, centerY);
|
|
ctx.rotate(angle * 0.01 * params.motion);
|
|
drawFractal(0, 0, branchLength, 0, 0, maxDepth);
|
|
ctx.restore();
|
|
|
|
angle += 0.5 * params.motion;
|
|
requestAnimationFrame(animate);
|
|
}
|
|
|
|
animate();
|
|
</script>
|
|
</body>
|
|
</html> |