From f0b24b4631f635fdcd33178946f40fa80f2581b9 Mon Sep 17 00:00:00 2001 From: tisachi Date: Thu, 29 Oct 2026 02:40:38 +0100 Subject: [PATCH] =?UTF-8?q?Web:=20dopracowanie=20animacji=20ekosystemu=20?= =?UTF-8?q?=E2=80=94=20promienie=20rdzenia=20z=20wariantem=20fade=20(Revea?= =?UTF-8?q?l=20fade,=20bez=20drygu=20CSS),=20klasy=20is-live/ray-flow=20w?= =?UTF-8?q?=20Ecosystem,=20porzadki=20w=20BootLog/Concepts/Tracks=20+=20st?= =?UTF-8?q?yle=20(cvx);=20web=208=20testow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/BootLog.tsx | 22 ++++++------ web/src/components/Reveal.tsx | 6 ++-- web/src/sections/Concepts.tsx | 15 +++----- web/src/sections/Ecosystem.tsx | 65 +++++++++++++++++++++++++++------- web/src/sections/Tracks.tsx | 2 +- web/src/styles.css | 30 ++++++++-------- 6 files changed, 91 insertions(+), 49 deletions(-) diff --git a/web/src/components/BootLog.tsx b/web/src/components/BootLog.tsx index 89f0893..75e30d4 100644 --- a/web/src/components/BootLog.tsx +++ b/web/src/components/BootLog.tsx @@ -16,22 +16,24 @@ function prefersReducedMotion() { ); } -/** Boot log z efektem typewritera; w prefers-reduced-motion renderuje się od razu. */ +/** + * Boot log z efektem typewritera. Pisania NIE wyłączamy w prefers-reduced-motion: + * to pojawianie się tekstu, nie ruch — przyspieszamy tylko tempo. + */ export function BootLog() { const { t, i18n } = useTranslation('boot'); const LINES = useMemo( () => t('lines', { returnObjects: true }) as unknown as BootLine[], [t, i18n.language], ); - const done = prefersReducedMotion(); - const [visible, setVisible] = useState<{ line: number; char: number }>( - done ? { line: LINES.length, char: 0 } : { line: 0, char: 0 }, - ); + const [visible, setVisible] = useState<{ line: number; char: number }>({ line: 0, char: 0 }); useEffect(() => { - if (done) return; let cancelled = false; let timer: ReturnType; + const rm = prefersReducedMotion(); + const charMs = rm ? CHAR_MS / 2 : CHAR_MS; + const lineMs = rm ? LINE_MS / 2 : LINE_MS; const tick = (line: number, char: number) => { if (cancelled) return; @@ -39,9 +41,9 @@ export function BootLog() { if (line >= LINES.length) return; const text = LINES[line].text; if (char < text.length) { - timer = setTimeout(() => tick(line, char + 1), CHAR_MS); + timer = setTimeout(() => tick(line, char + 1), charMs); } else { - timer = setTimeout(() => tick(line + 1, 0), LINE_MS); + timer = setTimeout(() => tick(line + 1, 0), lineMs); } }; @@ -50,7 +52,7 @@ export function BootLog() { cancelled = true; clearTimeout(timer); }; - }, [done, LINES]); + }, [LINES]); return (
             {shown}
             {l.ok && finished && OK}
-            {i === visible.line && !done && }
+            {i === visible.line && visible.line < LINES.length && }
           
         );
       })}
diff --git a/web/src/components/Reveal.tsx b/web/src/components/Reveal.tsx
index 7fd0c74..9d55457 100644
--- a/web/src/components/Reveal.tsx
+++ b/web/src/components/Reveal.tsx
@@ -6,10 +6,12 @@ interface RevealProps {
   className?: string;
   delayMs?: number;
   id?: string;
+  /** Fade bez przesunięcia — dla układów mierzonych w DOM (promienie rdzenia). */
+  fade?: boolean;
 }
 
 /** Wejście sekcji na scroll — IntersectionObserver; reduced-motion ogarnia CSS (.reveal). */
-export function Reveal({ children, className, delayMs = 0, id }: RevealProps) {
+export function Reveal({ children, className, delayMs = 0, id, fade = false }: RevealProps) {
   const ref = useRef(null);
   const [visible, setVisible] = useState(false);
 
@@ -41,7 +43,7 @@ export function Reveal({ children, className, delayMs = 0, id }: RevealProps) {
     
{children} diff --git a/web/src/sections/Concepts.tsx b/web/src/sections/Concepts.tsx index c5482d3..232256a 100644 --- a/web/src/sections/Concepts.tsx +++ b/web/src/sections/Concepts.tsx @@ -45,9 +45,6 @@ function ChartBackdrop() { const len2 = line2.getTotalLength(); line2.style.strokeDasharray = String(len2); - const reduce = - typeof window.matchMedia === 'function' && - window.matchMedia('(prefers-reduced-motion: reduce)').matches; // na dotyku wypelnienia ida przez clip (CSS), bez maski feather — // przesuwanie stopów gradientu co klatkę wymusza re-rasteryzacje maski const feather = @@ -92,13 +89,9 @@ function ChartBackdrop() { if (!inView) return; const r = wrap.getBoundingClientRect(); const vh = window.innerHeight; - // p=0 gdy nagłówek mija środek widoku, p=1 przy końcu sekcji - const p = reduce ? 1 : Math.min(Math.max((vh * 0.4 - r.top) / (r.height * 0.85), 0), 1); - if (reduce) { - shown = p; - paint(); - return; - } + // p=0 gdy gora sekcji wchodzi dolna krawedzia widoku (start od lewej), + // p=1 gdy sekcja przesyla polowe widoku powyzej (koniec przy wyjsciu) + const p = Math.min(Math.max((vh - r.top) / (r.height + vh * 0.5), 0), 1); target = p; if (!frame) frame = requestAnimationFrame(run); }; @@ -453,6 +446,8 @@ const CONCEPTS: Concept[] = [ export function Concepts() { const { t } = useTranslation('concepts'); return ( + // BEZ cvx: content-visibility => paint containment => przycina wylew + // na pełną szerokość okna (w-dvw) wykres tła do boków sekcji
diff --git a/web/src/sections/Ecosystem.tsx b/web/src/sections/Ecosystem.tsx index 95bc98a..20257f5 100644 --- a/web/src/sections/Ecosystem.tsx +++ b/web/src/sections/Ecosystem.tsx @@ -50,7 +50,16 @@ interface WireTarget { side: 'left' | 'right' | 'top' | 'bottom'; } -function basePoint(r: DOMRect, cr: DOMRect, side: WireTarget['side']) { +interface Box { + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; +} + +function basePoint(r: Box, cr: Box, side: WireTarget['side']) { switch (side) { case 'left': return { x: r.right - cr.left, y: r.top + r.height / 2 - cr.top }; @@ -63,6 +72,25 @@ function basePoint(r: DOMRect, cr: DOMRect, side: WireTarget['side']) { } } +/** + * Suma transformów `.reveal` nad elementem (kafelki wjeżdżają z opóźnieniami). + * Promienie muszą liczyć się z pozycji docelowej: `getBoundingClientRect` oddaje + * transform w locie, więc ResizeObserver wywołany zmianą wysokości okna (pasek + * adresu na mobile) ustawiał podstawy trójkątów w połowie drogi do kafelka. + */ +function revealShift(el: HTMLElement): number { + let sum = 0; + let node: HTMLElement | null = el; + while (node) { + if (node.classList.contains('reveal')) { + const m = /matrix\(([^)]+)\)/.exec(getComputedStyle(node).transform); + if (m) sum += Number.parseFloat(m[1].split(',')[5]) || 0; + } + node = node.parentElement; + } + return sum; +} + /** * Promienie—trójkąty mierzone w DOM: wierzchołek na obwodzie rdzenia, * podstawy na ścianach kafelków. Współrzędne w % kontenera (viewBox 0–100). @@ -75,24 +103,37 @@ function measureWires( ) { const cr = container.getBoundingClientRect(); if (!cr.width || !cr.height) return { wires: [] as Wire[], hub: { x: 50, y: 50 } }; - const hr = hubEl.getBoundingClientRect(); + const hostShift = revealShift(container); + const box = (el: HTMLElement): Box => { + const r = el.getBoundingClientRect(); + const off = revealShift(el) - hostShift; + return { + left: r.left, + top: r.top - off, + right: r.right, + bottom: r.bottom - off, + width: r.width, + height: r.height, + }; + }; + const hr = box(hubEl); const cx = hr.left + hr.width / 2 - cr.left; const cy = hr.top + hr.height / 2 - cr.top; const wires: Wire[] = []; for (const t of targets) { if (!t.el) continue; - const r = t.el.getBoundingClientRect(); + const r = box(t.el); const midX = r.left + r.width / 2 - cr.left; const midY = r.top + r.height / 2 - cr.top; const dx = midX - cx; const dy = midY - cy; const len = Math.hypot(dx, dy) || 1; - const base = basePoint(r, cr, t.side); + const foot = basePoint(r, cr, t.side); wires.push({ x1: ((cx + (dx / len) * hubRadius) / cr.width) * 100, y1: ((cy + (dy / len) * hubRadius) / cr.height) * 100, - x2: (base.x / cr.width) * 100, - y2: (base.y / cr.height) * 100, + x2: (foot.x / cr.width) * 100, + y2: (foot.y / cr.height) * 100, // połowa podstawy trójkąta jako % wymiaru kontenera w osi rozrzutu spread: (t.side === 'left' || t.side === 'right' ? SPREAD_PX / cr.height : SPREAD_PX / cr.width) * @@ -355,18 +396,18 @@ function StackDiagram() {
- +
- +
- +
- +
- +
@@ -401,7 +442,7 @@ export function Ecosystem() { const [sectionRef, inView] = useInView('0px'); return ( -
+
diff --git a/web/src/sections/Tracks.tsx b/web/src/sections/Tracks.tsx index d1a31a0..1bc8dc8 100644 --- a/web/src/sections/Tracks.tsx +++ b/web/src/sections/Tracks.tsx @@ -123,7 +123,7 @@ export function Tracks() { }; return ( -
+

/sciezka

{t('introTitle')}

diff --git a/web/src/styles.css b/web/src/styles.css index 04b9185..31a1671 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -225,6 +225,19 @@ transform: none; } +/* Układy mierzone w DOM (rdzeń ekosystemu): fade bez przesunięcia, bo transform + w locie rozjeżdża pomiar promieni względem krawędzi kafelków */ +.reveal-fade { + transform: none; +} + +/* Sekcje o ciężkim układzie: przeglądarka pomija ich renderowanie, dopóki nie + zbliżają się do viewportu — główna ulga dla scrolla na mobile w długiej stronie */ +.cvx { + content-visibility: auto; + contain-intrinsic-size: auto 1400px; +} + /* Paralaksa tła — warstwy trzymane na GPU, żeby scroll nie „żabkował” */ [data-parallax] { will-change: transform; @@ -306,7 +319,8 @@ } } -/* Redukcja ruchu: typewriter/kropki/wejścia renderują się statycznie */ +/* Redukcja ruchu: bez paralaksy/przesunięć/rysowania — zachowane subtelne, + lokalne pętle (promienie), żeby sekcje nie wyglądały na „martwe” */ @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; @@ -317,25 +331,13 @@ animation: none; } - .boot-caret { - display: none; - } - .streak-dot { animation: none; } - .ray-flow, - .is-live .ray-flow { - animation: none; - stroke-dasharray: 10 90; - stroke-dashoffset: -30; - } - .reveal { - opacity: 1; transform: none; - transition: none; + transition: opacity 240ms var(--ease-out-quart); } .window-glow:hover {