Skip to content

Commit cbc41a7

Browse files
authored
Merge pull request #480 from EarthyScience/jp/keyframe-time
keyframe Time
2 parents 71b37a6 + 978c2bd commit cbc41a7

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

src/components/LandingHome.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export function LandingHome() {
7878
return () => { isMounted = false; };
7979
}, [currentStore, setZMeta, setVariables, setTitleDescription])
8080

81-
// useEffect(()=>{
82-
// sendPing()
83-
// },[])
81+
useEffect(()=>{
82+
sendPing()
83+
},[])
8484

8585
return (
8686
<>

src/components/plots/KeyFramePreviewer.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ export const KeyFramePreviewer = () => {
4343
const KeyFrameLerper = (startState: Record<string,any>, endState:Record<string,any>, alpha:number, useCamera=true) => {
4444
const startVizState = startState["visual"]
4545
const endVizState = endState["visual"]
46+
const startTime = startState["time"]
47+
const endTime = endState["time"]
4648
const lerpedVizState: Record<string, any> = {};
4749
const lerpedCamState: Record<string, any> = {};
50+
4851
Object.keys(startVizState).forEach(key => {
4952
const sourceValue = startVizState[key];
5053
const targetValue = endVizState[key];
@@ -69,6 +72,10 @@ export const KeyFramePreviewer = () => {
6972
}
7073
});
7174
usePlotStore.setState(lerpedVizState)
75+
if (!useTime){
76+
const newTime = lerp(startTime, endTime, alpha)
77+
usePlotStore.setState({animProg: newTime})
78+
}
7279

7380
if (useCamera){ // Don't lerp camera if orbiting
7481
const startCamState = startState["camera"]

src/components/ui/KeyFrames.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ const SetKeyFrame = (frame: number) =>{
5656
}
5757
const thisState = {
5858
visual : keyState,
59-
camera: cameraState
59+
camera: cameraState,
60+
time: usePlotStore.getState().animProg
6061
}
6162
addKeyFrame(frame, thisState)
6263
}
@@ -102,16 +103,25 @@ const KeyFrames = () => {
102103

103104
{/* Information */}
104105
useEffect(() => {
105-
if (orbit || useTime) {
106-
toast.warning("Warning!", {
107-
description: "Camera Motion overwritten by orbit!",
108-
action: {
109-
label: "close",
110-
onClick: () => console.log("close"),
111-
},
112-
});
113-
}
114-
}, [orbit, useTime]);
106+
if (orbit) {
107+
toast.warning("Warning!", {
108+
description: "Camera Motion overwritten by Orbit!",
109+
action: {
110+
label: "close",
111+
onClick: () => null,
112+
},
113+
});
114+
}
115+
if (useTime) {
116+
toast.warning("Warning!", {
117+
description: "Time changes overwritten by Animate Time!",
118+
action: {
119+
label: "close",
120+
onClick: () => null,
121+
},
122+
});
123+
}
124+
}, [orbit, useTime]);
115125

116126
useEffect(() => {
117127
if ((orbit || useTime) && !keyFrames) {

0 commit comments

Comments
 (0)