diff --git a/README.md b/README.md index 938b467..0320d91 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ Form teslimi için `CONTACT_WEBHOOK_URL` ortam değişkeni gereklidir. ## Hareket Animasyonlar bilgi taşıdığı yerde kullanılır: hero tek kısa jestle açılır, +sayfa değişirken üstte ince bir yükleme çizgisi akar ve yeni sayfa hafifçe belirir, bölümler görüş alanına girdiğinde bir kez yükselir, şemada noktalar bir aşamadan diğerine geçer ve her aşamanın çizimi o aşamanın yaptığı işi canlandırır. Tümü CSS keyframe'leridir ve `prefers-reduced-motion` tek kuralla diff --git a/src/app.css b/src/app.css index 1eaba7b..80d1ac0 100644 --- a/src/app.css +++ b/src/app.css @@ -1420,6 +1420,44 @@ } } +/* ---- Page change ------------------------------------------------------------ + While the next page's code loads, a hairline in brand runs along the top of + the viewport; once it lands, the page settles in with a short rise. The bar + waits 120ms before showing, so a page that is already cached never flashes + it. */ +.hz-route-progress { + position: fixed; + inset: 0 0 auto; + z-index: 60; + height: 2px; + background: var(--brand); + transform: scaleX(0); + transform-origin: left; + opacity: 0; + pointer-events: none; +} +.hz-route-progress.is-active { + opacity: 1; + animation: hz-progress 2.4s cubic-bezier(0.1, 0.7, 0.2, 1) 120ms forwards; +} +@keyframes hz-progress { + from { + transform: scaleX(0); + } + to { + transform: scaleX(0.85); + } +} +.hz-page-in { + animation: hz-page-in 0.42s var(--ease); +} +@keyframes hz-page-in { + from { + opacity: 0; + transform: translateY(10px); + } +} + /* ---- Scroll-triggered entrance -------------------------------------------- Blocks rise once on entry with a per-card stagger. `is-armed` is only ever set on the client, so server markup is never hidden by a script that has @@ -1452,6 +1490,8 @@ /* The diagram still reads as a diagram with every stage at rest. */ .hz-hero-copy > *, .hz-art-card, + .hz-page-in, + .hz-route-progress, .hz-flow-dot, .hz-flow-bar, .hz-flow-mark, diff --git a/src/app.tsx b/src/app.tsx index 4a8007c..df65e3f 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,13 +1,49 @@ import { MetaProvider } from "@solidjs/meta"; -import { Router } from "@solidjs/router"; +import { Router, useIsRouting, useLocation } from "@solidjs/router"; import { FileRoutes } from "@solidjs/start/router"; -import { Suspense } from "solid-js"; +import { createEffect, on, Suspense, type JSX } from "solid-js"; import Header from "~/components/Header"; import Footer from "~/components/Footer"; import "@fontsource-variable/inter"; import "@fontsource-variable/jetbrains-mono"; import "./app.css"; +/** + * The routed part of the page. A route's code arrives on demand, and until it + * does the router keeps the old page on screen — correct, but with nothing + * moving a click reads as a click that did nothing. So a bar runs along the + * top while the next page loads, and the new page fades in once it lands. + * Hash changes on the same page are scrolling, not navigation, and get + * neither. + */ +function Shell(props: { children: JSX.Element }) { + const location = useLocation(); + const routing = useIsRouting(); + let main!: HTMLElement; + + createEffect( + on( + () => location.pathname, + () => { + // Restart the animation: drop the class, force a style flush, re-add. + main.classList.remove("hz-page-in"); + void main.offsetWidth; + main.classList.add("hz-page-in"); + }, + { defer: true }, + ), + ); + + return ( + <> +
+