From ab474204ce6c34ee6bd9510391b3392b6c013b25 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 27 Oct 2025 17:24:49 +0800 Subject: [PATCH] [+] Transition --- src/views/Photo.vue | 64 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/src/views/Photo.vue b/src/views/Photo.vue index 9660875..eb4703b 100644 --- a/src/views/Photo.vue +++ b/src/views/Photo.vue @@ -59,6 +59,23 @@ export default class Photos extends Vue { const angle = (detRandom(s) * 20) - 10 // -10 to +10 degrees return `rotate(${angle}deg)` } + + async clickPhoto(p: PhotoMetadata, e: MouseEvent) { + console.log("Clicked photo:", p.id) + const dom = e.currentTarget as HTMLDivElement + const photoEl = dom.querySelector('.photo-abs-container') as HTMLDivElement + + photoEl.style.viewTransitionName = `photo-${p.id}` + + const transition = document.startViewTransition(() => { + // Toggle .active on dom + dom.classList.toggle('active') + + }) + + await transition.finished + photoEl.style.viewTransitionName = '' + } } @@ -69,11 +86,15 @@ export default class Photos extends Vue {