forked from markNZed/processism-react-three
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneSelector.js
More file actions
25 lines (21 loc) · 899 Bytes
/
Copy pathSceneSelector.js
File metadata and controls
25 lines (21 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SceneSelector.js
import React from 'react'
import useStore from './useStore' // Make sure the path is correct
const SceneSelector = () => {
const setCurrentScene = useStore((state) => state.setCurrentScene)
const setReloadScene = useStore((state) => state.setReloadScene)
const clearAllAnimationStates = useStore((state) => state.clearAllAnimationStates)
const initializeScene = (sceneName) => {
clearAllAnimationStates() // Clear all animation states
setCurrentScene(sceneName) // Set the current scene
setReloadScene(true)
}
return (
<div style={{ zIndex: 10 }}>
<button onClick={() => initializeScene('SceneOne')}>Go to Scene One</button>
<button onClick={() => initializeScene('SceneTwo')}>Go to Scene Two</button>
<button onClick={() => initializeScene('SceneThree')}>Go to Scene Three</button>
</div>
)
}
export default SceneSelector