-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
84 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import useGlobalStore from "@/app/stores/useGlobalStore"; | ||
import useVMD from "../animation/useAnimation"; | ||
import usePresetStore from "@/app/stores/usePresetStore"; | ||
import { AnimationMixer } from "three"; | ||
import { useEffect, useMemo } from "react"; | ||
|
||
function Animation() { | ||
const runtimeCharacter = useGlobalStore(state => state.runtimeCharacter) | ||
const character = useGlobalStore(state => state.character) | ||
const motionFile = usePresetStore(state => state.motionFile) | ||
|
||
const mixer = useMemo(() => new AnimationMixer(character), [character]); | ||
|
||
useVMD(character, mixer, motionFile) | ||
|
||
useEffect(() => { | ||
mixer.addEventListener('loop', () => { | ||
runtimeCharacter.looped = true; | ||
}); | ||
}, [mixer]) | ||
return ( | ||
<></> | ||
); | ||
} | ||
|
||
export default Animation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { use } from "react"; | ||
import useGlobalStore from "./useGlobalStore"; | ||
|
||
function usePresetReady() { | ||
const presetReadyPromise = useGlobalStore(state => state.presetReadyPromise) | ||
use(presetReadyPromise) | ||
} | ||
|
||
export default usePresetReady; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters