feat(buttonNavigation): customize selector animation

This commit is contained in:
2026-01-19 00:21:04 +01:00
parent d4377094b4
commit 425195cf5f
5 changed files with 22 additions and 4 deletions

View File

@@ -1,13 +1,12 @@
import gsap from "gsap";
const DURATION = 0.11;
export const useButtonNavigation = <T extends Record<string, Rect>>({
buttons,
initialButton,
onButtonClick,
navigation,
disabled,
selectorAnimation,
}: {
buttons: T;
initialButton: keyof T;
@@ -23,6 +22,10 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
}
>;
disabled?: Ref<boolean>;
selectorAnimation: {
duration: number;
ease: gsap.EaseString;
};
}) => {
type Entry = keyof T;
@@ -165,8 +168,7 @@ export const useButtonNavigation = <T extends Record<string, Rect>>({
[1]: buttonRect[1],
[2]: buttonRect[2],
[3]: buttonRect[3],
duration: DURATION,
ease: "none",
...selectorAnimation,
},
"+=0",
);