From f8faaed36965b0d83b06a201b65a1ac5d6e4683f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Sat, 9 Nov 2024 03:52:12 +0900 Subject: [PATCH] audio player visualization wip --- .../frontend/src/components/MkMediaAudio.vue | 70 +++--- .../frontend/src/components/MkMediaBanner.vue | 5 +- .../frontend/src/components/MkMediaList.vue | 3 +- packages/frontend/src/components/MkNote.vue | 2 +- .../src/components/MkNoteDetailed.vue | 2 +- .../src/components/MkSubNoteContent.vue | 2 +- .../src/components/MkUserRippleEffect.vue | 207 ++++++++++++++++++ .../frontend/src/pages/user/index.files.vue | 2 +- .../frontend/src/pages/welcome.timeline.vue | 2 +- 9 files changed, 256 insertions(+), 39 deletions(-) create mode 100644 packages/frontend/src/components/MkUserRippleEffect.vue diff --git a/packages/frontend/src/components/MkMediaAudio.vue b/packages/frontend/src/components/MkMediaAudio.vue index b23ef9b72..5e97f8a90 100644 --- a/packages/frontend/src/components/MkMediaAudio.vue +++ b/packages/frontend/src/components/MkMediaAudio.vue @@ -35,40 +35,43 @@ SPDX-License-Identifier: AGPL-3.0-only -
- -
- -
-
- -
-
{{ hms(elapsedTimeMs) }}
-
- +
+ +
+ +
+ +
+
+ +
+
{{ hms(elapsedTimeMs) }}
+
+ + +
-
@@ -83,11 +86,13 @@ import * as os from '@/os.js'; import bytes from '@/filters/bytes.js'; import { hms } from '@/filters/hms.js'; import MkMediaRange from '@/components/MkMediaRange.vue'; +import MkUserRippleEffect from '@/components/MkUserRippleEffect.vue'; import { pleaseLogin } from '@/scripts/please-login.js'; import { $i, iAmModerator } from '@/account.js'; const props = defineProps<{ audio: Misskey.entities.DriveFile; + user?: Misskey.entities.UserLite; }>(); const keymap = { @@ -126,6 +131,7 @@ function hasFocus() { const playerEl = shallowRef(); const audioEl = shallowRef(); +const userRippleEffect = ref>(); // eslint-disable-next-line vue/no-setup-props-destructure const hide = ref((defaultStore.state.nsfw === 'force' || defaultStore.state.dataSaver.media) ? true : (props.audio.isSensitive && defaultStore.state.nsfw !== 'ignore')); @@ -264,9 +270,11 @@ function togglePlayPause() { if (isPlaying.value) { audioEl.value.pause(); + userRippleEffect.value?.pauseAnimation(); isPlaying.value = false; } else { audioEl.value.play(); + userRippleEffect.value?.resumeAnimation(); isPlaying.value = true; oncePlayed.value = true; } diff --git a/packages/frontend/src/components/MkMediaBanner.vue b/packages/frontend/src/components/MkMediaBanner.vue index 7a128fbad..7eeab073c 100644 --- a/packages/frontend/src/components/MkMediaBanner.vue +++ b/packages/frontend/src/components/MkMediaBanner.vue @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only