feat(3d): add camera animation

when hover on navbar
This commit is contained in:
xfy
2025-05-23 01:58:21 +08:00
parent 8e6cc3f8be
commit bbc4ba4eff
3 changed files with 80 additions and 1 deletions

View File

@ -1,8 +1,21 @@
import { create } from 'zustand';
// type NavbarHoverItemsKey = ['blog', 'projects', 'tags', 'friends', 'about'];
interface MainStore {
/** Loading state of the model */
modelLoading: boolean;
toggleLoading: (loaded: boolean) => void;
/** mouse hover on navbar */
navbarHoverItems: {
blog: boolean;
projects: boolean;
tags: boolean;
friends: boolean;
about: boolean;
};
toggleNavbarHoverItems: (item: string) => void;
}
const useStore = create<MainStore>()((set) => ({
@ -11,6 +24,23 @@ const useStore = create<MainStore>()((set) => ({
set(() => ({
modelLoading: loaded,
})),
navbarHoverItems: {
blog: false,
projects: false,
tags: false,
friends: false,
about: false,
} as const,
toggleNavbarHoverItems: (item) =>
set((state) => ({
navbarHoverItems: {
...state.navbarHoverItems,
[item as unknown as string]:
/** @ts-expect-error */
!state.navbarHoverItems[item],
},
})),
}));
export default useStore;