From fef1a8c234087adbee8946a78503e50f390744af Mon Sep 17 00:00:00 2001 From: valere Date: Fri, 3 Oct 2025 09:44:30 +0200 Subject: [PATCH] flippable cards --- app/components/molecule/box.vue | 1 - app/components/molecule/card.vue | 92 ++++++++++++++------- app/components/molecule/player.vue | 10 +++ app/components/organism/compilationPage.vue | 5 +- app/store/player.ts | 5 ++ 5 files changed, 82 insertions(+), 31 deletions(-) diff --git a/app/components/molecule/box.vue b/app/components/molecule/box.vue index c4cd126..14f06f6 100644 --- a/app/components/molecule/box.vue +++ b/app/components/molecule/box.vue @@ -200,7 +200,6 @@ watch(() => props.compilation, () => applyColor(), { deep: true }) &-scene { height: calc(var(--size) * 20); - width: var(--width); perspective: 1000px; touch-action: none; } diff --git a/app/components/molecule/card.vue b/app/components/molecule/card.vue index 6ff059e..f25d4b5 100644 --- a/app/components/molecule/card.vue +++ b/app/components/molecule/card.vue @@ -1,34 +1,36 @@ @@ -37,7 +39,7 @@ import type { Track } from '~~/types/types' import { usePlayerStore } from '~/store/player' -const props = defineProps<{ track: Track }>() +const props = defineProps<{ track: Track, isflipped: false }>() const playerStore = usePlayerStore() const coverUrl = props.track.coverId.startsWith('http') ? props.track.coverId @@ -50,4 +52,38 @@ const coverUrl = props.track.coverId.startsWith('http') font-weight: bold; text-align: center; } + +/* Flip effect */ +.flip-card { + perspective: 1000px; +} + +.flip-inner { + position: relative; + width: 100%; + height: 100%; + transition: transform 0.6s; + transform-style: preserve-3d; +} + +.flip-card[data-flipped=false] .flip-inner { + transform: rotateY(180deg); +} + +.flip-front, +.flip-back { + position: absolute; + width: 100%; + height: 100%; + backface-visibility: hidden; + will-change: transform; +} + +.flip-front { + transform: rotateY(0deg); +} + +.flip-back { + transform: rotateY(180deg); +} \ No newline at end of file diff --git a/app/components/molecule/player.vue b/app/components/molecule/player.vue index 848266e..924eedc 100644 --- a/app/components/molecule/player.vue +++ b/app/components/molecule/player.vue @@ -36,3 +36,13 @@ watch( } ) + + diff --git a/app/components/organism/compilationPage.vue b/app/components/organism/compilationPage.vue index b5dd111..5cae10d 100644 --- a/app/components/organism/compilationPage.vue +++ b/app/components/organism/compilationPage.vue @@ -1,6 +1,7 @@ diff --git a/app/store/player.ts b/app/store/player.ts index b65778d..10c5574 100644 --- a/app/store/player.ts +++ b/app/store/player.ts @@ -21,6 +21,11 @@ export const usePlayerStore = defineStore('player', { }, playTrack(track?: Track) { + // load compile if not allready loaded + // play if track is not already played + // else pause + + if (track) this.setTrack(track) if (!this.currentTrack || !this.audio) return