feat(pages): add an animated Tux 404 page

The previous 404 reused hero styles that only load on the home page, so it
rendered almost unstyled. Give it a self-contained scene instead: Tux unplugs
an RJ45 cable from a switch, then drops it on the floor where it settles.
This commit is contained in:
BlackAngelTV committed 2026-10-02 17:47:10 +02:00
1 parent 7cd7f5c8fa
commit b524ae91d3
3 files changed
+621 -6

No files matched your search

+188 -6
View File
@@ -1,6 +1,11 @@
<?php
/**
* FWS Linux — page 404 (incluse par page.php avec http_response_code(404)).
*
* La scène (Tux qui débranche le câble RJ45 d'un switch) est un SVG statique
* dans son état « branché » ; p/assets/js/not-found.js anime ensuite Tux, le
* connecteur et le câble (physique à ressort, câble recalculé chaque image).
* Sans JavaScript, la scène reste propre et immobile.
*/
declare(strict_types=1);
@@ -10,12 +15,189 @@ if (!isset($title, $extraCss, $extraJs)) {
exit('Page introuvable.');
}
$title = 'Page introuvable | FWS Linux';
$title = 'Page introuvable | FWS Linux';
$extraCss[] = fws_url('/p/assets/styles/404.css');
$extraJs[] = fws_url('/p/assets/js/not-found.js');
?>
<section class="hero">
<h1>Page introuvable</h1>
<p class="lead">Cette page n'existe pas ou a été déplacée.</p>
<div class="hero-actions">
<a class="button button-primary" href="<?= e(fws_url('/?p/index/')) ?>">Retour à l'accueil</a>
<section class="notfound" aria-labelledby="notfound-title">
<div class="notfound-copy">
<p class="notfound-code" aria-hidden="true">404</p>
<h1 class="notfound-title" id="notfound-title">Cette page a été débranchée</h1>
<p class="notfound-lead">Tux a tiré un peu fort sur le câble RJ45… La page demandée n'existe pas ou a été déplacée. Le reste du réseau tient bon.</p>
<div class="notfound-actions">
<a class="button button-primary" href="<?= e(fws_url('/?p/index/')) ?>">Retour à l'accueil</a>
<a class="button button-secondary" href="<?= e(fws_url('/?p/contact/')) ?>">Signaler un lien cassé</a>
</div>
</div>
<div class="notfound-visual" aria-hidden="true">
<svg class="nf-scene" viewBox="0 0 720 440" xmlns="http://www.w3.org/2000/svg" focusable="false">
<defs>
<linearGradient id="nf-switch-body" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#3a4a68" />
<stop offset="1" stop-color="#202b3e" />
</linearGradient>
<radialGradient id="nf-ambient" cx="50%" cy="50%" r="50%">
<stop offset="0" stop-color="rgba(56,189,248,0.15)" />
<stop offset="1" stop-color="rgba(56,189,248,0)" />
</radialGradient>
<radialGradient id="nf-tux-glow" cx="50%" cy="50%" r="50%">
<stop offset="0" stop-color="rgba(125,211,252,0.22)" />
<stop offset="1" stop-color="rgba(125,211,252,0)" />
</radialGradient>
<linearGradient id="nf-body" x1="0.15" y1="0" x2="0.9" y2="1">
<stop offset="0" stop-color="#33405a" />
<stop offset="1" stop-color="#151d2b" />
</linearGradient>
<linearGradient id="nf-body-light" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#3d4c69" />
<stop offset="1" stop-color="#1a2231" />
</linearGradient>
<linearGradient id="nf-belly" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#ffffff" />
<stop offset="1" stop-color="#dae2ec" />
</linearGradient>
<linearGradient id="nf-beak" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#fcd34d" />
<stop offset="1" stop-color="#f59e0b" />
</linearGradient>
<linearGradient id="nf-plug" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#e2e8f0" />
<stop offset="1" stop-color="#b6c2d1" />
</linearGradient>
<clipPath id="nf-body-clip">
<path d="M 180 92 C 138 92 112 124 110 166 C 108 196 126 212 130 234 C 118 266 104 298 104 326 C 104 352 138 364 180 364 C 222 364 256 352 256 326 C 256 298 242 266 230 234 C 234 212 252 196 250 166 C 248 124 222 92 180 92 Z" />
</clipPath>
</defs>
<!-- Ambiance -->
<ellipse cx="420" cy="330" rx="340" ry="130" fill="url(#nf-ambient)" />
<ellipse cx="180" cy="252" rx="185" ry="195" fill="url(#nf-tux-glow)" />
<!-- ── Switch ──────────────────────────────────────────────────────── -->
<g id="nf-switch">
<ellipse cx="515" cy="306" rx="190" ry="16" fill="rgba(0,0,0,0.38)" />
<rect x="326" y="196" width="16" height="40" rx="4" fill="#1b2434" />
<rect x="688" y="196" width="16" height="40" rx="4" fill="#1b2434" />
<rect x="340" y="120" width="350" height="172" rx="20" fill="url(#nf-switch-body)" stroke="rgba(148,163,184,0.28)" stroke-width="2" />
<rect x="344" y="124" width="342" height="42" rx="16" fill="rgba(226,232,240,0.06)" />
<circle cx="668" cy="146" r="7" fill="#22c55e" opacity="0.2" />
<circle cx="668" cy="146" r="3.5" fill="#22c55e" />
<text x="364" y="152" fill="rgba(226,232,240,0.75)" font-family="'Segoe UI', system-ui, sans-serif" font-size="16" font-weight="600">SW-FWS-01</text>
<!-- Pastille « link down » -->
<g id="nf-badge" opacity="0">
<circle cx="648" cy="150" r="18" fill="#ef4444" />
<circle cx="648" cy="150" r="18" fill="none" stroke="rgba(255,255,255,0.35)" stroke-width="2" />
<rect x="645.5" y="140" width="5" height="12" rx="2.5" fill="#ffffff" />
<circle cx="648" cy="158" r="3" fill="#ffffff" />
</g>
<!-- Bandeau des ports -->
<rect x="356" y="196" width="318" height="68" rx="12" fill="#141d2b" stroke="rgba(15,23,42,0.6)" />
<?php foreach ([372, 414, 456, 498, 540, 582] as $i => $px): ?>
<g>
<rect x="<?= $px ?>" y="216" width="34" height="26" rx="5" fill="#0b1220" stroke="rgba(148,163,184,0.3)" />
<rect x="<?= $px + 5 ?>" y="221" width="24" height="16" rx="3" fill="#070d18" />
<rect x="<?= $px + 12 ?>" y="214" width="10" height="5" rx="2" fill="#2b3a52" />
<?php foreach ([8, 13, 18, 23] as $g): ?>
<rect x="<?= $px + $g ?>" y="230" width="2.5" height="5" rx="1" fill="rgba(245,158,11,0.55)" />
<?php endforeach; ?>
<text x="<?= $px + 17 ?>" y="259" text-anchor="middle" fill="rgba(148,163,184,0.45)" font-family="'Segoe UI', system-ui, sans-serif" font-size="10"><?= $i + 1 ?></text>
</g>
<?php endforeach; ?>
<!-- Anneau du port utilisé -->
<rect x="538" y="213" width="38" height="32" rx="7" fill="none" stroke="rgba(56,189,248,0.45)" />
<!-- LED du port utilisé -->
<circle class="nf-led-green" cx="557" cy="186" r="12" fill="#22c55e" opacity="0.18" />
<circle class="nf-led-green" cx="557" cy="186" r="6" fill="#22c55e" />
<circle class="nf-led-red" cx="557" cy="186" r="12" fill="#ef4444" opacity="0" />
<circle class="nf-led-red" cx="557" cy="186" r="6" fill="#ef4444" opacity="0" />
<!-- LED des autres ports -->
<?php foreach ([389, 431, 473, 515, 599] as $lx): ?>
<circle cx="<?= $lx ?>" cy="186" r="5" fill="#22c55e" opacity="0.32" />
<?php endforeach; ?>
</g>
<!-- Étincelle de débranchement -->
<g id="nf-spark" opacity="0" transform="translate(557 228) scale(0.7) translate(-557 -228)">
<g stroke="#fde68a" stroke-width="2.5" stroke-linecap="round">
<line x1="557" y1="212" x2="557" y2="198" />
<line x1="541" y1="216" x2="530" y2="206" />
<line x1="573" y1="216" x2="584" y2="206" />
<line x1="536" y1="232" x2="520" y2="232" />
<line x1="578" y1="232" x2="594" y2="232" />
</g>
<circle cx="557" cy="205" r="3" fill="#fef3c7" />
<circle cx="534" cy="212" r="2.4" fill="#fef3c7" />
<circle cx="581" cy="213" r="2.4" fill="#fef3c7" />
</g>
<!-- ── Tux ─────────────────────────────────────────────────────────── -->
<g id="nf-tux">
<ellipse cx="180" cy="362" rx="74" ry="13" fill="rgba(0,0,0,0.35)" />
<!-- Aileron arrière -->
<ellipse cx="110" cy="250" rx="18" ry="56" transform="rotate(16 110 250)" fill="url(#nf-body)" stroke="rgba(125,211,252,0.25)" stroke-width="2" />
<!-- Corps -->
<path d="M 180 92 C 138 92 112 124 110 166 C 108 196 126 212 130 234 C 118 266 104 298 104 326 C 104 352 138 364 180 364 C 222 364 256 352 256 326 C 256 298 242 266 230 234 C 234 212 252 196 250 166 C 248 124 222 92 180 92 Z"
fill="url(#nf-body)" stroke="rgba(125,211,252,0.35)" stroke-width="2" />
<g clip-path="url(#nf-body-clip)">
<ellipse cx="180" cy="286" rx="52" ry="72" fill="url(#nf-belly)" />
<ellipse cx="152" cy="158" rx="30" ry="37" fill="#ffffff" />
<ellipse cx="208" cy="158" rx="30" ry="37" fill="#ffffff" />
</g>
<g id="nf-eyes">
<circle cx="156" cy="150" r="12" fill="#eef2f7" />
<circle cx="204" cy="150" r="12" fill="#eef2f7" />
<circle cx="156" cy="150" r="8.5" fill="#101826" />
<circle cx="204" cy="150" r="8.5" fill="#101826" />
<circle cx="153" cy="147" r="3" fill="#ffffff" />
<circle cx="201" cy="147" r="3" fill="#ffffff" />
</g>
<path d="M 172 178 C 198 180 218 186 230 194 C 216 204 196 208 174 206 C 178 196 176 186 172 178 Z" fill="url(#nf-beak)" />
<path d="M 176 195 C 194 199 212 195 226 190" fill="none" stroke="rgba(120,53,15,0.45)" stroke-width="2" stroke-linecap="round" />
<!-- Pattes (devant le corps pour rester visibles) -->
<g id="nf-foot-l">
<ellipse cx="134" cy="358" rx="34" ry="15" fill="url(#nf-beak)" />
<path d="M 121 348 L 121 368 M 147 346 L 147 370" stroke="rgba(120,53,15,0.4)" stroke-width="2" stroke-linecap="round" />
</g>
<g id="nf-foot-r">
<ellipse cx="226" cy="358" rx="34" ry="15" fill="url(#nf-beak)" />
<path d="M 213 346 L 213 370 M 239 348 L 239 368" stroke="rgba(120,53,15,0.4)" stroke-width="2" stroke-linecap="round" />
</g>
</g>
<!-- ── Câble (recalculé par le JS) ─────────────────────────────────── -->
<path class="nf-cable" d="M 534 236 C 488 305, 340 320, 276 265" fill="none" stroke="#38bdf8" stroke-width="13" stroke-linecap="round" stroke-linejoin="round" opacity="0.12" />
<path class="nf-cable" d="M 534 236 C 488 305, 340 320, 276 265" fill="none" stroke="#475569" stroke-width="9" stroke-linecap="round" stroke-linejoin="round" />
<path class="nf-cable" d="M 534 236 C 488 305, 340 320, 276 265" fill="none" stroke="#94a3b8" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5" />
<!-- ── Aileron avant (tient le câble) ──────────────────────────────── -->
<g id="nf-arm">
<ellipse cx="237" cy="245" rx="16" ry="44" transform="rotate(118 237 245)" fill="url(#nf-body-light)" stroke="rgba(125,211,252,0.3)" stroke-width="2" />
<ellipse cx="274" cy="263" rx="15" ry="12" fill="url(#nf-body-light)" stroke="rgba(125,211,252,0.3)" stroke-width="2" />
</g>
<!-- ── Connecteur RJ45 ─────────────────────────────────────────────── -->
<g id="nf-connector">
<rect x="524" y="229" width="12" height="14" rx="3" fill="#475569" />
<rect x="534" y="223" width="32" height="22" rx="4" fill="url(#nf-plug)" stroke="#94a3b8" stroke-width="1.5" />
<rect x="540" y="216" width="14" height="9" rx="2" fill="#94a3b8" />
<rect x="534" y="227" width="9" height="3" rx="1.5" fill="#f59e0b" />
<rect x="534" y="232" width="9" height="3" rx="1.5" fill="#f59e0b" />
<rect x="534" y="237" width="9" height="3" rx="1.5" fill="#f59e0b" />
<rect x="546" y="226" width="14" height="3" rx="1.5" fill="rgba(255,255,255,0.6)" />
</g>
</svg>
</div>
</section>
+323
View File
@@ -0,0 +1,323 @@
/**
* FWS Linux — animation de la page 404.
*
* Une seule fois, puis on s'arrête sur l'image finale : Tux s'approche,
* attrape le câble RJ45, le débranche (la LED passe au rouge, une pastille
* « link down » apparaît), puis lâche le câble qui tombe au sol et s'immobilise.
*
* Le connecteur suit sa cible via un ressort sous-amorti et, à partir du
* lâcher, les deux extrémités du câble deviennent des points libres soumis à
* la gravité (avec rebond et frottement). Le tracé du câble est recalculé à
* chaque image, ce qui donne le fouetté et la chute naturels.
*
* Sans JavaScript, la scène reste dans son état « branché » défini dans le SVG.
*/
(function () {
'use strict';
var svg = document.querySelector('.nf-scene');
if (!svg) {
return;
}
var el = {
switch: svg.querySelector('#nf-switch'),
tux: svg.querySelector('#nf-tux'),
arm: svg.querySelector('#nf-arm'),
connector: svg.querySelector('#nf-connector'),
cables: svg.querySelectorAll('.nf-cable'),
ledGreen: svg.querySelectorAll('.nf-led-green'),
ledRed: svg.querySelectorAll('.nf-led-red'),
badge: svg.querySelector('#nf-badge'),
spark: svg.querySelector('#nf-spark'),
footL: svg.querySelector('#nf-foot-l'),
footR: svg.querySelector('#nf-foot-r'),
eyes: svg.querySelector('#nf-eyes')
};
/* Géométrie — doit rester synchronisée avec le dessin dans p/404.php. */
var G = {
feet: [180, 356],
armPivot: [198, 224],
hand: [276, 265],
plugPivot: [555, 236],
connAttach: [534, 236]
};
/* Timeline (ms) : tout se joue une fois, puis l'image finale reste. */
var APPROACH_A = 1000, APPROACH_B = 1750;
var PULL_A = 1800, RELEASE = 2900;
var HAND_RELEASE = 3500, RECOVER = 4600;
var TOTAL = 6400;
var PULL_X = -112;
var FLOOR = 386;
var GRAVITY = 1600;
/* ── Helpers ─────────────────────────────────────────────────────────── */
function clamp01(x) { return x < 0 ? 0 : (x > 1 ? 1 : x); }
function smoothstep(e0, e1, x) {
var t = clamp01((x - e0) / (e1 - e0));
return t * t * (3 - 2 * t);
}
function easeInOut(t) {
return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
}
function mul(A, B) {
return [
A[0] * B[0] + A[2] * B[1],
A[1] * B[0] + A[3] * B[1],
A[0] * B[2] + A[2] * B[3],
A[1] * B[2] + A[3] * B[3],
A[0] * B[4] + A[2] * B[5] + A[4],
A[1] * B[4] + A[3] * B[5] + A[5]
];
}
function tr(x, y) { return [1, 0, 0, 1, x, y]; }
function rot(deg, cx, cy) {
var r = deg * Math.PI / 180, c = Math.cos(r), s = Math.sin(r);
return [c, s, -s, c, cx - c * cx + s * cy, cy - s * cx - c * cy];
}
function apply(m, x, y) { return [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]]; }
function tx(x, y, deg, px, py) {
return 'translate(' + x + ' ' + y + ')'
+ (deg ? ' rotate(' + deg + ' ' + px + ' ' + py + ')' : '');
}
function setOpacity(list, value) {
for (var i = 0; i < list.length; i++) {
list[i].setAttribute('opacity', value.toFixed(3));
}
}
function setCable(d) {
for (var i = 0; i < el.cables.length; i++) {
el.cables[i].setAttribute('d', d);
}
}
/* ── État persistant ─────────────────────────────────────────────────── */
var springX = 0, springV = 0; // connecteur tant qu'il est tenu
var prevPull = 0, gait = 0;
var released = false; // le câble est-il lâché (chute libre) ?
var endA = { x: 0, y: 0, vx: 0, vy: 0, rest: false }; // extrémité connecteur
var endB = { x: 0, y: 0, vx: 0, vy: 0, rest: false }; // extrémité libre (main)
var connDeg = 0, connDegV = 0;
function springStep(pos, vel, target, k, d, dt) {
var acc = -k * (pos - target) - d * vel;
vel += acc * dt;
pos += vel * dt;
return [pos, vel];
}
/* Chute d'une extrémité : gravité, rebond amorti, frottement au sol. */
function fall(pt, dt) {
if (pt.rest) {
return;
}
pt.vy += GRAVITY * dt;
pt.vx *= 0.995;
pt.x += pt.vx * dt;
pt.y += pt.vy * dt;
if (pt.y >= FLOOR) {
pt.y = FLOOR;
if (pt.vy > 40) {
pt.vy = -pt.vy * 0.38; // rebond
pt.vx *= 0.6;
} else {
pt.vy = 0;
}
pt.vx *= 0.86; // frottement
if (Math.abs(pt.vx) < 7 && Math.abs(pt.vy) < 1) {
pt.vx = 0;
pt.rest = true;
}
}
}
/* ── Un pas d'animation ──────────────────────────────────────────────── */
function advance(t, dt) {
/* Courbe de traction : Tux tire, puis se détend et se relève partiellement */
var pull;
if (t <= PULL_A) {
pull = 0;
} else if (t < RELEASE) {
pull = easeInOut((t - PULL_A) / (RELEASE - PULL_A));
} else if (t < HAND_RELEASE) {
pull = 1;
} else if (t < RECOVER) {
pull = 1 - 0.5 * easeInOut((t - HAND_RELEASE) / (RECOVER - HAND_RELEASE));
} else {
pull = 0.5;
}
var approach = smoothstep(APPROACH_A, APPROACH_B, t);
var sinceRel = (t - RELEASE) / 1000;
var yank = (t >= RELEASE && t < RELEASE + 900)
? -13 * Math.sin(sinceRel * 13) * Math.exp(-sinceRel * 5) : 0;
var struggle = -3 * Math.sin(t / 70) * (pull * (1 - pull) * 4);
var tuxX = 9 * approach + PULL_X * pull + yank + struggle;
var tuxRot = 5 * approach - 13 * pull - yank * 0.12;
var bob = Math.sin(t / 520) * 1.2 - 2 * pull;
/* Démarche : la phase avance avec la distance parcourue */
var dp = pull - prevPull;
gait += Math.abs(dp) * 16;
var walk = smoothstep(0.006, 0.05, Math.abs(dp) / Math.max(dt, 0.001) * 0.1);
var swing = Math.sin(gait) * 9 * walk;
var liftL = Math.max(0, Math.sin(gait)) * 6 * walk;
var liftR = Math.max(0, Math.sin(gait + Math.PI)) * 6 * walk;
prevPull = pull;
el.tux.setAttribute('transform', tx(tuxX, bob, tuxRot, G.feet[0], G.feet[1]));
el.footL.setAttribute('transform', 'translate(' + (swing * 0.7).toFixed(2) + ' ' + (-liftL).toFixed(2) + ')');
el.footR.setAttribute('transform', 'translate(' + (-swing * 0.7).toFixed(2) + ' ' + (-liftR).toFixed(2) + ')');
var armRot = 16 * approach - 24 * pull;
el.arm.setAttribute('transform',
tx(tuxX, bob, tuxRot, G.feet[0], G.feet[1])
+ ' rotate(' + armRot + ' ' + G.armPivot[0] + ' ' + G.armPivot[1] + ')');
/* Regard : Tux suit le connecteur, puis regarde le câble au sol */
var gx = 0, gy = 0;
if (t >= HAND_RELEASE) { gx = -2; gy = 5; }
else if (t >= RELEASE) { gx = 3; gy = -1.5; }
if (el.eyes) {
el.eyes.setAttribute('transform', 'translate(' + gx + ' ' + gy + ')');
}
/* Connecteur tenu : ressort vers la main tant qu'il est branché/tenu */
var target = t >= RELEASE ? tuxX : 0;
var sp = springStep(springX, springV, target, 150, 14, dt);
springX = sp[0];
springV = sp[1];
var tuxM = mul(tr(tuxX, bob), rot(tuxRot, G.feet[0], G.feet[1]));
var armM = mul(tuxM, rot(armRot, G.armPivot[0], G.armPivot[1]));
var hand = apply(armM, G.hand[0], G.hand[1]);
var heldRot = (t >= RELEASE && t < HAND_RELEASE)
? 15 * Math.sin(sinceRel * 7) * Math.exp(-sinceRel * 1.2) : 0;
var heldA = [G.connAttach[0] + springX, G.connAttach[1]];
/* Point A = extrémité câble du connecteur ; point B = extrémité libre */
var A, B, deg;
if (t < HAND_RELEASE) {
A = heldA;
B = hand;
deg = heldRot;
released = false;
} else {
if (!released) {
/* Lâcher : les deux extrémités deviennent des points libres, avec la
vitesse héritée du ressort (le connecteur part vers la gauche). */
released = true;
endA.x = heldA[0]; endA.y = heldA[1];
endA.vx = springV * 0.5 - 140; endA.vy = 0;
endB.x = hand[0]; endB.y = hand[1];
endB.vx = -14; endB.vy = 0;
connDeg = heldRot;
connDegV = 60;
}
fall(endA, dt);
fall(endB, dt);
/* Le connecteur bascule sur le flanc puis se stabilise */
connDegV += (-(connDeg - (-82)) * 130 - connDegV * 12) * dt;
connDeg += connDegV * dt;
A = [endA.x, endA.y];
B = [endB.x, endB.y];
deg = connDeg;
}
/* Connecteur : translation calculée pour amener son point d'attache en A */
var R = rot(deg, G.plugPivot[0], G.plugPivot[1]);
var ar = apply(R, G.connAttach[0], G.connAttach[1]);
el.connector.setAttribute('transform',
'translate(' + (A[0] - ar[0]).toFixed(2) + ' ' + (A[1] - ar[1]).toFixed(2) + ')'
+ ' rotate(' + deg.toFixed(2) + ' ' + G.plugPivot[0] + ' ' + G.plugPivot[1] + ')');
/* Câble : affaissement réduit quand il se tend, jamais sous le sol */
var dist = Math.sqrt((A[0] - B[0]) * (A[0] - B[0]) + (A[1] - B[1]) * (A[1] - B[1]));
var taut = clamp01((dist - 150) / 220);
var velWorld = released ? endA.vx : springV;
var wob = Math.max(-18, Math.min(18, velWorld * 0.05));
var sway = 5 * Math.sin(t / 620) + 2 * Math.sin(t / 370 + 1.3);
var sag = 92 * (1 - taut * 0.55) + (released ? 0 : sway);
var lim = FLOOR - 3;
var c1x = A[0] - 46 - 16 * taut;
var c1y = Math.min(lim, A[1] + sag);
var c2x = B[0] + 64;
var c2y = Math.min(lim, Math.min(lim, B[1] + sag * 0.8) + wob);
setCable('M ' + A[0].toFixed(2) + ' ' + A[1].toFixed(2)
+ ' C ' + c1x.toFixed(2) + ' ' + c1y.toFixed(2)
+ ', ' + c2x.toFixed(2) + ' ' + c2y.toFixed(2)
+ ', ' + B[0].toFixed(2) + ' ' + B[1].toFixed(2));
/* LED : vert au départ, rouge clignotant une fois débranché */
var greenA = clamp01(1 - smoothstep(RELEASE - 60, RELEASE + 40, t));
var redA = (1 - greenA) * (0.55 + 0.45 * Math.abs(Math.sin(t / 90)));
setOpacity(el.ledGreen, greenA);
setOpacity(el.ledRed, redA);
/* Pastille « link down » */
var badgeA = smoothstep(RELEASE, RELEASE + 220, t);
el.badge.setAttribute('opacity', badgeA.toFixed(3));
el.badge.setAttribute('transform',
'translate(648 150) scale(' + (0.55 + 0.45 * badgeA).toFixed(3) + ') translate(-648 -150)');
/* Étincelle de débranchement */
var sparkA = (t >= RELEASE && sinceRel < 0.55) ? Math.exp(-sinceRel * 7) : 0;
el.spark.setAttribute('opacity', sparkA.toFixed(3));
el.spark.setAttribute('transform',
'translate(557 228) scale(' + (0.7 + sinceRel * 1.6).toFixed(3) + ') translate(-557 -228)');
/* Secousse du switch */
var jx = 0, jr = 0;
if (t >= RELEASE) {
jx = 4 * Math.sin(sinceRel * 32) * Math.exp(-sinceRel * 7);
jr = 0.55 * Math.sin(sinceRel * 32) * Math.exp(-sinceRel * 7);
}
el.switch.setAttribute('transform', tx(jx, 0, jr, 515, 206));
}
/* ── Lancement ───────────────────────────────────────────────────────── */
var reduceMotion = window.matchMedia
&& window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (reduceMotion || typeof window.requestAnimationFrame !== 'function') {
/* Accessibilité / vieux navigateurs : on saute directement à l'image finale. */
var step = 1000 / 60;
for (var sim = 0; sim < TOTAL; sim += step) {
advance(sim, step / 1000);
}
advance(TOTAL, step / 1000);
return;
}
var start = null;
var last = 0;
function frame(now) {
if (start === null) {
start = now;
last = now;
}
var t = now - start;
var dt = Math.min(0.05, (now - last) / 1000) || 0.016;
last = now;
if (t >= TOTAL) {
advance(TOTAL, dt); // image finale, puis on s'arrête
return;
}
advance(t, dt);
window.requestAnimationFrame(frame);
}
window.requestAnimationFrame(frame);
})();
+110
View File
@@ -0,0 +1,110 @@
@import "./var.css";
/* ── 404 — Tux débranche le câble réseau ─────────────────────────────────────
Mise en page uniquement : le mouvement (Tux, connecteur, câble) est piloté
par p/assets/js/not-found.js. Le SVG est livré dans son état « branché »,
donc la page reste propre même sans JavaScript. */
.notfound {
position: relative;
overflow: hidden;
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
align-items: center;
gap: clamp(1.5rem, 4vw, 3rem);
padding: clamp(1.75rem, 4vw, 3.25rem);
border-radius: 1.25rem;
background: var(--surface);
border: 1px solid var(--border);
box-shadow: var(--shadow-lg);
}
.notfound::before {
content: "";
position: absolute;
inset: -35% -10% auto;
height: 70%;
background: radial-gradient(60% 100% at 78% 0%, rgba(56, 189, 248, 0.16), transparent 70%);
pointer-events: none;
}
.notfound-copy {
position: relative;
z-index: 2;
}
.notfound-code {
margin: 0 0 0.35rem;
font-family: "Georgia", "Palatino Linotype", serif;
font-size: clamp(3.5rem, 11vw, 6.5rem);
line-height: 0.9;
letter-spacing: -0.04em;
color: transparent;
background: linear-gradient(180deg, var(--accent-soft), var(--accent-strong));
-webkit-background-clip: text;
background-clip: text;
}
.notfound-title {
margin: 0 0 0.75rem;
font-family: "Georgia", "Palatino Linotype", serif;
font-size: clamp(1.6rem, 3.6vw, 2.6rem);
line-height: 1.1;
color: var(--text);
}
.notfound-lead {
margin: 0 0 1.5rem;
max-width: 46ch;
color: var(--text-secondary);
line-height: 1.7;
text-wrap: pretty;
}
.notfound-actions {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
}
.notfound-visual {
position: relative;
z-index: 2;
}
.nf-scene {
display: block;
width: 100%;
height: auto;
overflow: visible;
}
/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
.notfound {
grid-template-columns: 1fr;
text-align: center;
}
.notfound-visual {
order: 2;
max-width: 34rem;
margin: 0 auto;
}
.notfound-lead {
margin-left: auto;
margin-right: auto;
}
.notfound-actions {
justify-content: center;
}
}
@media (max-width: 700px) {
.notfound-actions .button {
width: 100%;
}
}