Commit 273f464c by PLN (Algolia)

404: a hydra sketch that never repeats behind one honest line

Fullscreen generative canvas (five sketch families, random palettes and
frequencies, composed fresh per visit — the void is never the same
twice), a 404, one line FR, one line EN, the door home. noindex.
parent 1de5ffcc
import Link from 'next/link';
import NotFoundHydra from '@/components/not-found-hydra';
export const metadata = {
title: '404 — perdu·e',
robots: { index: false, follow: false },
};
/** The void: a fullscreen hydra sketch (different every visit) behind a
* single honest line. Copy rule: no slop — say the thing, link the door. */
export default function NotFound() {
return (
<div className="relative min-h-[100dvh] flex items-center justify-center px-6">
<NotFoundHydra />
<div
aria-hidden="true"
className="absolute inset-0 bg-[var(--surface)] opacity-60"
style={{ zIndex: 0 }}
/>
<main className="relative text-center" style={{ zIndex: 1 }}>
<h1 className="text-7xl font-bold tracking-tight text-[var(--text-primary)]">
404
</h1>
<p className="mt-6 text-lg text-[var(--text-primary)] text-balance">
Rien ici — mais tout le reste existe, par là.
</p>
<p className="mt-1 text-sm text-[var(--text-muted)]">
Nothing here. Everything else, that way.
</p>
<p className="mt-8">
<Link
href="/"
className="inline-block rounded-xl border border-[var(--border)] bg-[var(--surface)] px-5 py-2.5 text-[var(--text-primary)] hover:bg-[var(--surface-raised)] transition-colors"
>
← l&apos;accueil
</Link>
</p>
</main>
</div>
);
}
'use client';
import React, { useEffect, useRef } from 'react';
/** The 404 backdrop: a hydra sketch that never repeats. The source string is
* composed fresh on every mount — random family, palette, frequencies — so
* the void looks different each time you fall into it. Client-only; the
* sketch runs on a fullscreen canvas behind the page copy. */
const PALETTES = [
[0.29, 0.0, 0.58],
[0.95, 0.3, 0.15],
[0.0, 0.65, 0.85],
[0.6, 0.1, 0.1],
[0.1, 0.5, 0.2],
[0.8, 0.7, 0.0],
];
const r = (a, b) => +(a + Math.random() * (b - a)).toFixed(3);
const pick = (arr) => arr[Math.floor(Math.random() * arr.length)];
function composeSource() {
const [r0, r1] = PALETTES.sort(() => Math.random() - 0.5);
const P = [r(r0[0], 1), r(0, r0[1] + 0.15), r(0, r0[2] + 0.2)];
const Q = [r1[0], r1[1], r1[2]];
const k = Math.floor(r(2, 6));
const f1 = r(30, 140);
const f2 = r(5, 40);
const s1 = r(0.02, 0.09);
const s2 = r(0.05, 0.2);
const rot = r(0, Math.PI);
const families = [
`osc(${f1}, ${s1}).kaleid(${k}).color(P[0], P[1], P[2]).modulate(osc(${f2}, ${s2}).rotate(${rot}), 0.4).out()`,
`voronoi(${f2}, ${s2}, ${r(0, 1)}).color(P[0], P[1], P[2]).brightness(${r(0.03, 0.12)}).out()`,
`noise(${f2}, ${s1}).colorama(${r(0.002, 0.01)}).kaleid(${k}).brightness(${r(0.05, 0.15)}).out()`,
`shape(${Math.floor(r(3, 8))}, ${r(0.15, 0.45)}).mult(osc(${f1}, ${s1})).kaleid(${k}).color(P[0], P[1], P[2]).out()`,
`osc(${f1}, ${s1}, 1.7).diff(osc(${f2}, ${s2}).rotate(${rot})).color(P[0], P[1], P[2]).hue(${r(0, 0.4)}).out()`,
];
return `speed = ${r(0.35, 1.1)}
P = [${P.join(', ')}]
Q = [${Q.join(', ')}]
${pick(families)}`;
}
export default function NotFoundHydra() {
const canvasRef = useRef(null);
useEffect(() => {
if (!canvasRef.current) return;
let instance = null;
import('hydra-synth').then((HydraModule) => {
const canvas = canvasRef.current;
if (!canvas) return;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
instance = new HydraModule.default({
canvas,
detectAudio: false,
width: canvas.width,
height: canvas.height,
});
try {
instance.eval(composeSource());
} catch {
// a bad roll of the dice should never break the page: the sketch
// simply stays abstract noise (which hydra shows anyway)
}
});
return () => {
if (instance && typeof instance.close === 'function') instance.close();
};
}, []);
return (
<canvas
ref={canvasRef}
aria-hidden="true"
style={{ position: 'fixed', inset: 0, width: '100vw', height: '100vh', zIndex: 0 }}
/>
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment