font: tweak duration of some animations
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import gsap from "gsap";
|
||||
|
||||
const DURATION = 0.11;
|
||||
|
||||
export const useMenuAnimation = (key: string, isOpen: Ref<boolean>) => {
|
||||
const animation = useState(`animation-${key}`, () => ({
|
||||
playing: false,
|
||||
@@ -8,7 +10,6 @@ export const useMenuAnimation = (key: string, isOpen: Ref<boolean>) => {
|
||||
}));
|
||||
|
||||
watch(isOpen, (current, previous) => {
|
||||
const duration = 0.1;
|
||||
const timeline = gsap.timeline({
|
||||
onStart: () => {
|
||||
animation.value.playing = true;
|
||||
@@ -23,24 +24,24 @@ export const useMenuAnimation = (key: string, isOpen: Ref<boolean>) => {
|
||||
.fromTo(
|
||||
animation.value,
|
||||
{ stage1Offset: 48 },
|
||||
{ stage1Offset: 0, duration },
|
||||
{ stage1Offset: 0, ease: "none", duration: DURATION },
|
||||
)
|
||||
.fromTo(
|
||||
animation.value,
|
||||
{ stage2Offset: 48 },
|
||||
{ stage2Offset: 0, duration },
|
||||
{ stage2Offset: 0, ease: "none", duration: DURATION },
|
||||
);
|
||||
} else if (current === false && previous === true) {
|
||||
timeline
|
||||
.fromTo(
|
||||
animation.value,
|
||||
{ stage2Offset: 0 },
|
||||
{ stage2Offset: 48, duration },
|
||||
{ stage2Offset: 48, ease: "none", duration: DURATION },
|
||||
)
|
||||
.fromTo(
|
||||
animation.value,
|
||||
{ stage1Offset: 0 },
|
||||
{ stage1Offset: 48, duration },
|
||||
{ stage1Offset: 48, ease: "none", duration: DURATION },
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user