Skip to content

Commit bdac7d3

Browse files
committed
fixed another bug where hueRotation was 'clipping' by being reset mid cycle. Also disabled call to setHueDuration longer elsewhere
1 parent c553a5c commit bdac7d3

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/components/HomeView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const HomeView = ({}: Props) => {
7676
}
7777
console.log(currentPath);
7878

79-
setHueDuration(12000);
79+
// setHueDuration(12000);
8080
}, [currentPath]);
8181

8282
return (

src/contexts/StyleContextProvider.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { User } from "firebase/auth";
21
import StyleContext from "./StyleContext";
32
import { ReactNode, useEffect, useState } from "react";
4-
import { useSpring, config } from "react-spring";
3+
import { useSpring } from "react-spring";
54

65
interface Props {
76
children: ReactNode;
@@ -13,19 +12,17 @@ const StyleContextProvider = ({ children }: Props) => {
1312

1413
// ANIMATIONS / REACT SPRING
1514
const [bgAnimOff, setBgAnimOff] = useState<boolean>(false);
16-
const [hueDuration, setHueDuration] = useState<number>(4500);
15+
const [hueDuration, setHueDuration] = useState<number>(4000);
1716
const hueRotation = useSpring({
18-
loop: { reverse: true },
17+
loop: { reverse: true, config: { duration: hueDuration } },
1918
delay: 1000,
20-
reset: true,
2119
to: {
2220
filter: "hue-rotate(130deg) saturate(80%) sepia(30%)",
2321
},
2422
from: {
2523
filter: "hue-rotate(0deg) saturate(100%) sepia(0%)",
2624
},
27-
cancel: bgAnimOff,
28-
config: { duration: hueDuration },
25+
config: { duration: hueDuration, precision: 0.001 },
2926
});
3027

3128
const checkWindowSize = () => {

0 commit comments

Comments
 (0)