mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-20 04:14:12 +01:00
loader
This commit is contained in:
1 parent
078bc9d6cd
commit
6e35c06cfc
4 files changed
+81
-25
No files matched your search
@@ -0,0 +1,44 @@
|
||||
.loader {
|
||||
position: absolute;
|
||||
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--space-5);
|
||||
|
||||
opacity: 1;
|
||||
filter: blur(0);
|
||||
|
||||
transition: var(--duration-subtle);
|
||||
|
||||
&[data-visible="false"] {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
|
||||
filter: blur(4rem);
|
||||
}
|
||||
|
||||
.icon {
|
||||
height: 25%;
|
||||
}
|
||||
|
||||
.progress {
|
||||
height: var(--space-2);
|
||||
width: 100%;
|
||||
|
||||
background-color: var(--gray-3);
|
||||
|
||||
border-radius: calc(var(--space-2) / 2);
|
||||
overflow: hidden;
|
||||
|
||||
.bar {
|
||||
height: 100%;
|
||||
background-color: var(--accent-9);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { useProgress } from "@react-three/drei";
|
||||
import { Tankopedia } from "../../stores/tankopedia";
|
||||
import styles from "./index.module.css";
|
||||
|
||||
export function TankSandboxLoader() {
|
||||
const tank = Tankopedia.use((state) => state.protagonist.tank);
|
||||
const revealed = Tankopedia.use((state) => state.revealed);
|
||||
|
||||
const data = useProgress();
|
||||
|
||||
const isVisible = !revealed;
|
||||
|
||||
return (
|
||||
<div className={styles.loader} data-visible={isVisible}>
|
||||
<img
|
||||
className={styles.icon}
|
||||
src={alias("api", `/tanks/${tank}/icons/big.webp`)}
|
||||
/>
|
||||
<Progress value={data.progress} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface ProgressProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
function Progress({ value }: ProgressProps) {
|
||||
return (
|
||||
<div className={styles.progress}>
|
||||
<div className={styles.bar} style={{ width: `${value}%` }} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user