Skip to content

Commit bdcfa0d

Browse files
committed
feature: improve loady bar thing
1 parent 7c878b7 commit bdcfa0d

File tree

4 files changed

+52
-9
lines changed

4 files changed

+52
-9
lines changed

src/renderer/scenes/interstitial-scene/interstitial-scene.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const InterstitialScene = ({
3030
{error && <GlobalErrorState error={error} action={null} />}
3131
<WrappedCanvas canvas={surface} style={{ zIndex: "-1" }} />
3232
<LoadBar
33-
color="rgb(100 200 87)"
33+
color="#64c857"
3434
thickness={5}
3535
style={{ marginBottom: "var(--size-10)" }}
3636
/>
Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useProcessStore } from "@stores/process-store";
2-
import { useEffect, useRef } from "react";
2+
import { useLayoutEffect, useRef } from "react";
3+
import { Color } from "three";
34

45
interface LoadBarProps {
56
color: string;
@@ -10,24 +11,49 @@ interface LoadBarProps {
1011
export const LoadBar = ({ color, thickness, style }: LoadBarProps) => {
1112
const divRef = useRef<HTMLDivElement>(null);
1213

13-
useEffect(() => {
14+
useLayoutEffect(() => {
1415
return useProcessStore.subscribe((store) => {
1516
if (!divRef.current) return;
1617
divRef.current.style.transform = `scaleX(${store.getTotalProgress()})`;
1718
});
1819
}, []);
1920

21+
const c1 = new Color(color);
22+
const hsl = {
23+
h: 0,
24+
s: 0,
25+
l: 0,
26+
};
27+
c1.getHSL(hsl);
28+
hsl.l -= 0.75;
29+
c1.setHSL(hsl.h, hsl.s, hsl.l);
30+
31+
hsl.h += 0.1;
32+
hsl.l -= 0.1;
33+
const c2 = new Color().setHSL(hsl.h, hsl.s, hsl.l);
34+
const gradient = c2.getHexString();
35+
2036
return (
2137
<div
22-
ref={divRef}
2338
style={{
24-
background: color,
39+
background: `linear-gradient(-45deg, ${color}, #${gradient})`,
40+
backgroundSize: "400% 400%",
41+
animation: "gradient 15s ease infinite",
2542
height: `${thickness}px`,
2643
width: "100%",
44+
position: "relative",
2745
...style,
2846
}}
2947
>
30-
&nbsp;
48+
<div
49+
ref={divRef}
50+
style={{
51+
position: "absolute",
52+
background: color,
53+
height: `${thickness}px`,
54+
width: "100%",
55+
}}
56+
></div>
3157
</div>
3258
);
3359
};

src/renderer/scenes/pre-home-scene/pre-home-scene.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const styleCenterText = {
1414
position: "absolute",
1515
left: "50%",
1616
top: "50%",
17-
transform: `translate(-50%, -50%)`,
17+
transform: "translate(-50%, -50%)",
1818
cursor: "wait",
1919
color: "#ffeedd",
2020
fontFamily: "Conthrax",
@@ -53,7 +53,8 @@ export const PreHomeScene = () => {
5353

5454
useEffect(() => {
5555
//@ts-ignore
56-
document.body.style.backdropFilter = `blur(20px) grayscale(0.2) contrast(0.5) brightness(0.2)`;
56+
document.body.style.backdropFilter =
57+
"blur(20px) grayscale(0.2) contrast(0.5) brightness(0.2)";
5758
document.body.style.background = `url(${titanReactorLogo}) center center / cover`;
5859
return () => {
5960
//@ts-ignore
@@ -81,7 +82,11 @@ export const PreHomeScene = () => {
8182
//@ts-ignore
8283
<div style={styleCenterText}>
8384
<div>{imbateamLogo}</div>
84-
<LoadBar color="white" thickness={20} style={{ marginTop: "20px" }} />
85+
<LoadBar
86+
color="#ffffff"
87+
thickness={20}
88+
style={{ marginTop: "20px" }}
89+
/>
8590
</div>
8691
)}
8792
{initialInstall && (

src/renderer/scenes/pre-home-scene/styles.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,15 @@ body {
3636
max-inline-size: 100%;
3737
overflow: hidden;
3838
}
39+
40+
@keyframes gradient {
41+
0% {
42+
background-position: 0% 50%;
43+
}
44+
50% {
45+
background-position: 100% 50%;
46+
}
47+
100% {
48+
background-position: 0% 50%;
49+
}
50+
}

0 commit comments

Comments
 (0)