0819-eve-1

This commit is contained in:
feie9456 2025-08-19 23:38:39 +08:00
parent ee3cd001af
commit 21f8a72184
5 changed files with 72 additions and 16 deletions

Binary file not shown.

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch, useTemplateRef } from 'vue';
import { ref, onMounted, onUnmounted, watch, useTemplateRef } from 'vue';
import AniEle from '../../components/AniEle.vue';
import assets from '../../assets';
import AudioEffects from '../../assets/sounds'
@ -29,6 +29,39 @@ const emit = defineEmits(['resetGame', 'showShareMask']);
const hasP2AnimationPlayed = ref(false);
const currentPosterIndex = ref(0);
const autoScrollTimer = ref<NodeJS.Timeout | null>(null);
const isUserInteracting = ref(false);
//
function startAutoScroll() {
if (autoScrollTimer.value) {
clearTimeout(autoScrollTimer.value);
}
autoScrollTimer.value = setTimeout(() => {
if (!isUserInteracting.value) {
//
const nextIndex = currentPosterIndex.value === 0 ? 1 : 0;
scrollToPoster(nextIndex);
//
startAutoScroll();
}
}, 5000); // 5
}
//
function resetAutoScroll() {
isUserInteracting.value = true;
if (autoScrollTimer.value) {
clearTimeout(autoScrollTimer.value);
}
// 1
setTimeout(() => {
isUserInteracting.value = false;
startAutoScroll();
}, 1000);
}
onMounted(() => {
// Intersection Observer p2
@ -75,26 +108,42 @@ onMounted(() => {
console.warn('P1 element not found');
}
// 8p2p2
setTimeout(() => {
if (!hasP2AnimationPlayed.value) {
console.log('Auto scrolling to P2 after 8 seconds');
//
startAutoScroll();
//
const posterContainer = document.querySelector('.poster-container');
scrollToPoster(1); // p2
if (posterContainer) {
posterContainer.addEventListener('touchstart', resetAutoScroll);
posterContainer.addEventListener('scroll', resetAutoScroll);
posterContainer.addEventListener('mousedown', resetAutoScroll);
}
})
onUnmounted(() => {
//
if (autoScrollTimer.value) {
clearTimeout(autoScrollTimer.value);
}
}, 8000); // 8 = 8000
})
function scrollToPoster(index: number) {
currentPosterIndex.value = index;
const posterContainer = document.querySelector('.poster-container');
if (posterContainer) {
// p250%
//
posterContainer.scrollTo({
left: posterContainer.scrollWidth * 0.5 *index,
left: posterContainer.scrollWidth * 0.5 * index,
behavior: 'smooth'
});
}
// p2
if (index === 1 && !hasP2AnimationPlayed.value) {
hasP2AnimationPlayed.value = true;
posterP2Ele.value?.jumpTo('p2');
console.log('Poster P2 animation triggered by scroll');
}
}
}
</script>
@ -111,19 +160,19 @@ function scrollToPoster(index: number) {
<AniEle :url="assets.ani.海报p1" ref="gui-ani-end-post-p1"
style="width: 50%; flex-shrink: 0; scroll-snap-align: start;" class="gui-ani-end-post" :height="940"
:width="671" :rules="[
{ name: 'p1', frame: 32, loop: 1, pauseAfter: true, duration: 33 },
{ name: 'p1', frame: 22, loop: 1, pauseAfter: true, duration: 33 },
]" />
<AniEle :url="assets.ani.海报p2" ref="gui-ani-end-post-p2"
style="width: 50%; flex-shrink: 0; scroll-snap-align: start;" class="gui-ani-end-post" :height="940"
:width="671" :rules="[
{ name: 'wait', frame: 1, loop: 1, pauseAfter: true, duration: 33 },
{ name: 'p2', frame: 31, loop: 1, pauseAfter: true, duration: 33 },
{ name: 'p2', frame: 20, loop: 1, pauseAfter: true, duration: 33 },
]" />
</div>
</div>
<div class="dot" style="position: absolute;top: 29.3%;left: 37.2%;width: 57.3%; height: 38%; ">
<div class="dot-item" @click="scrollToPoster(0)" :class="{ active: currentPosterIndex === 0 }"></div>
<div class="dot-item" @click="scrollToPoster(1)" :class="{ active: currentPosterIndex === 1 }"></div>
<div class="dot-item" @click="scrollToPoster(0); resetAutoScroll();" :class="{ active: currentPosterIndex === 0 }"></div>
<div class="dot-item" @click="scrollToPoster(1); resetAutoScroll();" :class="{ active: currentPosterIndex === 1 }"></div>
</div>
<AniEle :url="assets.ani.线" ref="gui-ani-end" class="gui-ani-end" :height="2462" :width="1179" :rules="[
{ name: 'all', frame: 54, loop: 1, pauseAfter: false, duration: 16 },

View File

@ -164,6 +164,7 @@ const confirmState = ref<'none' | 'confirmed'>('none');
</div>
</div>
</div>
<div class="quiz-progress-text">答题进度 {{ qIndex + 1 }} / {{ total }}</div>
<div class="quiz-progress dot">
<div class="dot-item" v-for="(val, i) in Array.from({ length: total })" :key="i" @click="qIndex = i"
:class="{ active: i <= qIndex }"></div>
@ -396,6 +397,12 @@ const confirmState = ref<'none' | 'confirmed'>('none');
height: 2vw;
}
.quiz-progress-text{
position: absolute;
bottom: 11.5%;
font-size: 3.1vw;
}
.dot .dot-item {
background-color: #E2ECF9;