mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
15 lines
327 B
TypeScript
15 lines
327 B
TypeScript
import { useProgress } from "@react-three/drei";
|
|
import { useRef } from "react";
|
|
|
|
export function useStableProgress() {
|
|
const { loaded, total } = useProgress();
|
|
const progress = useRef(0);
|
|
|
|
progress.current = Math.max(
|
|
progress.current,
|
|
total === 0 ? 0 : (loaded / total) * 100
|
|
);
|
|
|
|
return progress.current;
|
|
}
|