From 870b6dbdfb8f663cc8fda2a73fa6125d24f881a0 Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Sun, 11 Aug 2024 21:57:09 +0100 Subject: [PATCH] Footer: Animation depend on the direction. --- frontend/src/lib/components/footer.svelte | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/footer.svelte b/frontend/src/lib/components/footer.svelte index eb56246..258ed58 100644 --- a/frontend/src/lib/components/footer.svelte +++ b/frontend/src/lib/components/footer.svelte @@ -14,17 +14,18 @@ function slideText(event) { const id = event.detail.id; - const width = window.innerWidth; + const width = window.innerWidth/2; + const animTranslate = active > id ? [width, -width] : [-width, width]; anime({ targets: pageDiv, - translateX: width / 2, + translateX: animTranslate[0], opacity: 0, duration: 300, easing: 'easeInQuad', complete: function () { active = id; - pageDiv.style.transform = `translateX(-${width}px)`; + pageDiv.style.transform = `translateX(${animTranslate[1]}px)`; anime({ targets: pageDiv, translateX: 0,