// 013 - Hyperbolic Poincaré (geometry)
// 1:1 Original algorithm engine source
function createHyperbolicTessellation() {
return {
setup() {
},
render(context, timeState, params) {
const { ctx, width, height } = context;
const t = timeState.time * Number(params.speed || 0.4);
const p = Number(params.symmetryP || 7);
const radius = Math.min(width, height) * 0.44;
ctx.fillStyle = "#08090d";
ctx.fillRect(0, 0, width, height);
const cx = width * 0.5;
const cy = height * 0.5;
ctx.strokeStyle = "rgba(56, 189, 248, 0.4)";
ctx.lineWidth = 1.5;
ctx.beginPath();
ctx.arc(cx, cy, radius, 0, Math.PI * 2);
ctx.stroke();
const layers = 14;
for (let l = 1; l <= layers; l++) {
const hypRadius = radius * Math.tanh(l * 0.25 + Math.sin(t) * 0.1);
const arcCount = p * l;
for (let i = 0; i < arcCount; i++) {
const angle = i / arcCount * Math.PI * 2 + t * (0.1 / l);
const arcX = cx + Math.cos(angle) * hypRadius;
const arcY = cy + Math.sin(angle) * hypRadius;
const arcR = (radius - hypRadius) * 0.5;
if (arcR <= 0.5) continue;
const hue = (l * 25 + i * 10 + t * 20) % 360;
ctx.strokeStyle = hsla(hue, 85, 60, 0.45);
ctx.lineWidth = Math.max(0.8, 2.5 - l * 0.15);
ctx.beginPath();
ctx.arc(arcX, arcY, arcR, 0, Math.PI * 2);
ctx.stroke();
}
}
}
};
}
// Default parameters from content metadata
const defaultParams = [
{
"key": "symmetryP",
"label": "Tessellation Symmetry (p)",
"type": "range",
"min": 4,
"max": 12,
"step": 1,
"defaultValue": 7,
"description": "Hyperbolic polygonal order"
},
{
"key": "speed",
"label": "Rotation Drift",
"type": "range",
"min": 0.1,
"max": 1.5,
"step": 0.05,
"defaultValue": 0.4,
"description": "Non-Euclidean drift speed"
}
];
if (!window.__art_instances) window.__art_instances = {};
if (!window.__art_instances['hyperbolic-tessellation']) {
const inst = typeof createHyperbolicTessellation === 'function' ? createHyperbolicTessellation() : null;
if (inst && inst.setup) {
inst.setup({ ctx, width, height, dpr: 1, aspectRatio: width / height }, defaultParams);
}
window.__art_instances['hyperbolic-tessellation'] = inst;
}
const instance = window.__art_instances['hyperbolic-tessellation'];
if (instance && instance.render) {
instance.render(
{ ctx, width, height, dpr: 1, aspectRatio: width / height },
{ time, deltaTime: dt, frameCount: Math.floor(time * 60), fps: 60 },
defaultParams
);
}