diff --git a/apps/website/composables/useSmoothScroll.ts b/apps/website/composables/useSmoothScroll.ts index f7ebb86..3dd5e39 100644 --- a/apps/website/composables/useSmoothScroll.ts +++ b/apps/website/composables/useSmoothScroll.ts @@ -13,9 +13,9 @@ export const useSmoothScroll = () => { window.removeEventListener('keydown', cancelScroll) } - // Linear easing for constant-speed scrolling - const easeLinear = (t: number): number => { - return t + // Ease-out cubic: starts fast, slows down as it approaches target + const easeOutCubic = (t: number): number => { + return 1 - Math.pow(1 - t, 3) } const smoothScrollTo = (target: number | Element, duration: number = 800) => { @@ -43,7 +43,7 @@ export const useSmoothScroll = () => { if (startTime === null) startTime = currentTime const timeElapsed = currentTime - startTime const progress = Math.min(timeElapsed / duration, 1) - const easedProgress = easeLinear(progress) + const easedProgress = easeOutCubic(progress) window.scrollTo(0, startPosition + distance * easedProgress)