Skip to content

Commit 2143726

Browse files
committed
added config JSON file for hueRotation and other variables
1 parent aff1a1c commit 2143726

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

src/AppConfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"hueAnimDuration": 4000,
3+
"hueAnimDuration_Slow": 10000
4+
}

src/components/HomeView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import HomeViewFooter from "./HomeViewFooter";
66
import HomeViewContent from "./HomeViewContent";
77
import { SpringValue } from "react-spring";
88
import StyleContext from "../contexts/StyleContext";
9+
import AppConfig from "../AppConfig.json";
910

1011
interface Props {}
1112

1213
const HomeView = ({}: Props) => {
1314
// - - - - GENERAL STATES - - - -
14-
const [firstRender, setFirstRender] = useState<boolean>(true);
1515
const { hueRotation, setHueDuration } = useContext(StyleContext);
1616
// - - - - - TITLES AND TEXT - - - - -
1717
const [currentProject, setCurrentProject] = useState<string>("Deerfall");
@@ -76,7 +76,9 @@ const HomeView = ({}: Props) => {
7676
}
7777
console.log(currentPath);
7878

79-
// setHueDuration(12000);
79+
if (hueRotation != AppConfig.hueAnimDuration_Slow) {
80+
setHueDuration(AppConfig.hueAnimDuration_Slow);
81+
}
8082
}, [currentPath]);
8183

8284
return (

src/components/LandingPage.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import pixelBG from "../img/pixelBG_LowRes.png";
99
import pixelFadeBG from "../img/animated-14fps.png";
1010
import PersonalIntro from "./PersonalIntro";
1111
import StyleContext from "../contexts/StyleContext";
12+
import AppConfig from "../AppConfig.json";
1213

1314
interface Props {}
1415

@@ -65,7 +66,7 @@ const LandingPage = ({}: Props) => {
6566
setIsActivePage(false);
6667
setHideHV("");
6768
setTimeout(() => setHideLP("hide"), 2000);
68-
setHueDuration(12000);
69+
setHueDuration(AppConfig.hueAnimDuration_Slow);
6970
}
7071

7172
if (currentPath === "/") {
@@ -81,21 +82,21 @@ const LandingPage = ({}: Props) => {
8182
setLink1Path("/landing/webdev");
8283
setLink2Text("Game Dev");
8384
setLink2Path("/landing/gamedev");
84-
setHueDuration(4000);
85+
setHueDuration(AppConfig.hueAnimDuration);
8586
} else if (currentPath === "/landing/webdev") {
8687
setCurrentDisplay("Web Development");
8788
setLink1Text("Portfolio");
8889
setLink1Path("/landing/webdev/portfolio");
8990
setLink2Text("Blog");
9091
setLink2Path("/landing/webdev/blog");
91-
setHueDuration(4000);
92+
setHueDuration(AppConfig.hueAnimDuration);
9293
} else if (currentPath === "/landing/gamedev") {
9394
setCurrentDisplay("Game Development");
9495
setLink1Text("Portfolio");
9596
setLink1Path("/landing/webdev/portfolio");
9697
setLink2Text("Blog");
9798
setLink2Path("/landing/gamedev/blog");
98-
setHueDuration(4000);
99+
setHueDuration(AppConfig.hueAnimDuration);
99100
}
100101
}, [currentPath]);
101102

src/contexts/StyleContextProvider.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import StyleContext from "./StyleContext";
22
import { ReactNode, useEffect, useState } from "react";
33
import { useSpring } from "react-spring";
4+
import AppConfig from "../AppConfig.json";
45

56
interface Props {
67
children: ReactNode;
@@ -12,7 +13,9 @@ const StyleContextProvider = ({ children }: Props) => {
1213

1314
// ANIMATIONS / REACT SPRING
1415
const [bgAnimOff, setBgAnimOff] = useState<boolean>(false);
15-
const [hueDuration, setHueDuration] = useState<number>(4000);
16+
const [hueDuration, setHueDuration] = useState<number>(
17+
AppConfig.hueAnimDuration
18+
);
1619
const hueRotation = useSpring({
1720
loop: { reverse: true, config: { duration: hueDuration } },
1821
delay: 1000,

0 commit comments

Comments
 (0)