Files
Pac-Man/web/pages/+onPageTransitionStart.ts
Xevion 65a9c6bab9 feat(web): redesign navigation with centered logo and smooth page transitions
- Replace sidebar nav with centered header featuring PAC-MAN title
- Add glimmer animation effect for non-active logo state
- Implement 200ms fade transitions between pages
- Add custom scrollbar styling with OverlayScrollbars
- Switch to Russo One font for title, Outfit for body text
2025-12-29 02:53:55 -06:00

20 lines
713 B
TypeScript

import type { OnPageTransitionStartAsync } from "vike/types";
import { getPacmanWindow } from "@/lib/pacman";
const TRANSITION_DURATION = 200;
export const onPageTransitionStart: OnPageTransitionStartAsync = async () => {
console.log("Page transition start");
document.querySelector("body")?.classList.add("page-is-transitioning");
// Stop the game loop when navigating away from the game page
const win = getPacmanWindow();
if (win.Module?._stop_game) {
console.log("Stopping game loop for page transition");
win.Module._stop_game();
}
// Wait for fade-out animation to complete before page content changes
await new Promise((resolve) => setTimeout(resolve, TRANSITION_DURATION));
};