feat: better loader

This commit is contained in:
TrèsAbhi committed 2024-07-10 18:57:27 -05:00
1 parent 6f387e28f9
commit 0a836826c2
4 files changed
+14 -5

No files matched your search

BIN
View File
Binary file not shown.
@@ -59,7 +59,7 @@ export function Controls() {
const [autoRotate, setAutoRotate] = useState(true); const [autoRotate, setAutoRotate] = useState(true);
useEffect(() => { useEffect(() => {
camera.position.set(-10, 12, -12); camera.position.set(-10, 5, -12);
orbitControls.current?.target.set(0, 1.25, 0); orbitControls.current?.target.set(0, 1.25, 0);
}, [camera]); }, [camera]);
@@ -110,7 +110,6 @@ export function HeroSection({ id }: { id: number }) {
<Box width="100%" height="100%"> <Box width="100%" height="100%">
<Suspense fallback={<TankSandboxLoader id={id} />}> <Suspense fallback={<TankSandboxLoader id={id} />}>
<TankSandbox /> <TankSandbox />
<TankSandboxLoader id={id} />
</Suspense> </Suspense>
</Box> </Box>
@@ -1,11 +1,21 @@
import { Flex, Spinner } from '@radix-ui/themes'; import { Flex, Progress } from '@radix-ui/themes';
import { useProgress } from '@react-three/drei';
import { tankIcon } from '../../../../../../core/blitzkit/tankIcon'; import { tankIcon } from '../../../../../../core/blitzkit/tankIcon';
export function TankSandboxLoader({ id }: { id: number }) { export function TankSandboxLoader({ id }: { id: number }) {
const data = useProgress();
return ( return (
<Flex width="100%" height="100%" align="center" justify="center"> <Flex width="100%" height="100%" align="center" justify="center">
<img src={tankIcon(id)} style={{ height: '75%', filter: 'blur(0rem)' }} /> <img
<Spinner size="3" style={{ position: 'absolute' }} /> src={tankIcon(id)}
style={{ height: '60%', filter: 'blur(4px) grayscale(1)' }}
/>
<Progress
size="3"
value={data.progress}
style={{ position: 'absolute', width: 128 }}
/>
</Flex> </Flex>
); );
} }