Feat/polish-mission1 #12

Merged
math-pixel merged 42 commits from feat/polish-mission1 into develop 2026-06-01 21:51:09 +00:00
8 changed files with 45 additions and 8 deletions
Showing only changes of commit 7c35090dbd - Show all commits
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+29 -4
View File
@@ -1,10 +1,18 @@
import { useEffect, useState } from "react";
import { AppLoadingIndicator } from "@/components/ui/AppLoadingIndicator"; import { AppLoadingIndicator } from "@/components/ui/AppLoadingIndicator";
import type { SceneLoadingState } from "@/types/world/sceneLoading"; import type { SceneLoadingState } from "@/types/world/sceneLoading";
const LOADING_BACKGROUND_PATH = "/assets/bg-site.png"; const LOADING_BACKGROUND_PATH = "/assets/bg-site.webp";
const LOADING_LOGO_PATH = "/assets/logo.png"; const LOADING_FRAME_RATE = 12;
const LOADING_FRAME_INTERVAL_MS = 1000 / LOADING_FRAME_RATE;
const LOADING_LOGO_FRAMES = [
"/assets/loader/Loader-1.png",
"/assets/loader/Loader-2.png",
"/assets/loader/Loader-3.png",
"/assets/loader/Loader-4.png",
] as const;
for (const path of [LOADING_BACKGROUND_PATH, LOADING_LOGO_PATH]) { for (const path of [LOADING_BACKGROUND_PATH, ...LOADING_LOGO_FRAMES]) {
const image = new Image(); const image = new Image();
image.src = path; image.src = path;
} }
@@ -16,8 +24,25 @@ interface SceneLoadingOverlayProps {
export function SceneLoadingOverlay({ export function SceneLoadingOverlay({
state, state,
}: SceneLoadingOverlayProps): React.JSX.Element | null { }: SceneLoadingOverlayProps): React.JSX.Element | null {
const [logoFrameIndex, setLogoFrameIndex] = useState(0);
const isReady = state.status === "ready"; const isReady = state.status === "ready";
const progress = Math.round(Math.max(0, Math.min(1, state.progress)) * 100); const progress = Math.round(Math.max(0, Math.min(1, state.progress)) * 100);
const logoFramePath =
LOADING_LOGO_FRAMES[logoFrameIndex] ?? LOADING_LOGO_FRAMES[0];
useEffect(() => {
if (isReady) return undefined;
const intervalId = window.setInterval(() => {
setLogoFrameIndex(
(currentIndex) => (currentIndex + 1) % LOADING_LOGO_FRAMES.length,
);
}, LOADING_FRAME_INTERVAL_MS);
return () => {
window.clearInterval(intervalId);
};
}, [isReady]);
return ( return (
<div <div
@@ -33,7 +58,7 @@ export function SceneLoadingOverlay({
<img <img
alt="La Fabrik Durable" alt="La Fabrik Durable"
className="scene-loading-overlay__logo" className="scene-loading-overlay__logo"
src={LOADING_LOGO_PATH} src={logoFramePath}
/> />
<div className="scene-loading-overlay__footer"> <div className="scene-loading-overlay__footer">
<div className="scene-loading-overlay__meta"> <div className="scene-loading-overlay__meta">
+1 -1
View File
@@ -1,6 +1,6 @@
import type { CSSProperties } from "react"; import type { CSSProperties } from "react";
const BACKGROUND_IMAGE = "/assets/bg-site.png"; const BACKGROUND_IMAGE = "/assets/bg-site.webp";
export const SITE_CONFIG = { export const SITE_CONFIG = {
backgroundImage: BACKGROUND_IMAGE, backgroundImage: BACKGROUND_IMAGE,