mirror of
https://github.com/Xevion/Pac-Man.git
synced 2026-01-31 02:25:04 -06:00
- 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
20 lines
713 B
TypeScript
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));
|
|
};
|