From b2a3d4f7018de89bce40adc2986d23e228cfabfd Mon Sep 17 00:00:00 2001 From: legonzaur Date: Fri, 24 May 2024 13:04:39 +0200 Subject: [PATCH] Feat : add cards floating animation --- components/CardPreview.vue | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/components/CardPreview.vue b/components/CardPreview.vue index 97b1d78..ab24abd 100644 --- a/components/CardPreview.vue +++ b/components/CardPreview.vue @@ -22,6 +22,8 @@ const settingsStore = useSettingsStore() const childCount = ref(0) +const card = ref() + function cardClick() { if (!props.card_id) return emit("click") @@ -42,12 +44,17 @@ watch( props.wrapped ? rotation.value = (Math.random() * 4) - 2 : rotation.value = Math.random() > .5 ? 2 : -2 }, { immediate: true }) + + +onMounted(() => { + card.value?.style.setProperty("--random-seed", -Math.abs(Math.random() * 2) + 's') +})