From 70a44fd1ea119d43f875e6cfac56fb25747d8913 Mon Sep 17 00:00:00 2001 From: lq64 Date: Mon, 15 Dec 2025 10:06:02 +0100 Subject: [PATCH] feat(ui): FRO-5 Animation Card Played (#23) Added a fade Up Out animation. Also added a sliding animation for the remaining cards Co-authored-by: LQ63 Reviewed-on: https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Frontend/pulls/23 Co-authored-by: lq64 Co-committed-by: lq64 --- src/components/ingame/HandC.vue | 36 ++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/components/ingame/HandC.vue b/src/components/ingame/HandC.vue index 9a79b2d..77b90a1 100644 --- a/src/components/ingame/HandC.vue +++ b/src/components/ingame/HandC.vue @@ -25,8 +25,7 @@ function triggerWiggle(index: number) { function handlePlayCard(index: number | null) { if (index === null) return - wb.sendAndWait("PlayCard", { cardindex: index }) - .catch((error) => { + wb.sendAndWait("PlayCard", { cardindex: index }).catch((error) => { triggerWiggle(index) $q.notify({ @@ -37,7 +36,14 @@ function handlePlayCard(index: number | null) { }) } - +function onBeforeLeave(el: Element) { + const element = el as HTMLElement; + const { marginLeft, marginTop, width, height } = window.getComputedStyle(element); + element.style.left = `${element.offsetLeft - parseFloat(marginLeft)}px`; + element.style.top = `${element.offsetTop - parseFloat(marginTop)}px`; + element.style.width = width; + element.style.height = height; +} function handleSkipDogLife() { //TODO: Add some animation or feedback for skipping turn } @@ -52,13 +58,19 @@ function getCardImagePath(cardPath: string) {