1. 播放器歌词效果
This commit is contained in:
@@ -162,7 +162,7 @@
|
||||
</a-form-item>
|
||||
<a-form-item label="九宫格入场动画">
|
||||
<a-switch v-model:checked="cfg.nineGridAnimate" />
|
||||
<div class="text-[11px] text-[#8A8680] mt-1">关闭:提前预加载、进入窗口即展示且不暂停滚动(推荐 iOS);开启:轻量淡入并短暂停滚。</div>
|
||||
<div class="text-[11px] text-[#8A8680] mt-1">开启:进入视口后暂停滚动,每 300ms 入场一格(方向动效);全部完成后再继续。关闭:直接展示,更稳(推荐 iOS)。</div>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
|
||||
@@ -778,9 +778,8 @@ let nineGridRevealTimer = null
|
||||
const nineGridDone = new Set()
|
||||
const BOTTOM_RETURN_DELAY = 30000
|
||||
const FREE_SCROLL_BASE_STEP = 1.2
|
||||
/** 开启动画时,入场结束后短暂停一下再继续自动滚 */
|
||||
const NINE_GRID_REVEAL_HOLD_ANIM_MS = 520
|
||||
const NINE_GRID_FULL_RATIO = 0.9
|
||||
/** ready 后极短缓冲再恢复滚动(串行等待已在 PhotoGallery 内完成) */
|
||||
const NINE_GRID_RESUME_DELAY_MS = 200
|
||||
|
||||
const freeInterval = computed(() => {
|
||||
const v = Number(data.value.freeScrollInterval)
|
||||
@@ -993,22 +992,17 @@ const canAutoAdvance = () =>
|
||||
const beginNineGridGate = (pIdx) => {
|
||||
if (nineGridDone.has(pIdx)) return
|
||||
nineGridDone.add(pIdx)
|
||||
// 仅开启动画时暂停自动滚动;关闭动画不挡滚动
|
||||
if (data.value.nineGridAnimate) nineGridHold.value = true
|
||||
nineGridHold.value = true
|
||||
nineGridActivate[pIdx] = true
|
||||
}
|
||||
|
||||
const onNineGridReady = (pIdx) => {
|
||||
if (!nineGridDone.has(pIdx)) return
|
||||
if (!data.value.nineGridAnimate) {
|
||||
nineGridHold.value = false
|
||||
return
|
||||
}
|
||||
clearTimeout(nineGridRevealTimer)
|
||||
nineGridRevealTimer = setTimeout(() => {
|
||||
nineGridHold.value = false
|
||||
nineGridRevealTimer = null
|
||||
}, NINE_GRID_REVEAL_HOLD_ANIM_MS)
|
||||
}, NINE_GRID_RESUME_DELAY_MS)
|
||||
}
|
||||
|
||||
const bindNineGridObserver = () => {
|
||||
@@ -1017,13 +1011,11 @@ const bindNineGridObserver = () => {
|
||||
if (typeof IntersectionObserver === 'undefined') return
|
||||
const nodes = scrollContainerRef.value?.querySelectorAll('[data-nine-grid]')
|
||||
if (!nodes?.length) return
|
||||
const animate = !!data.value.nineGridAnimate
|
||||
// 进入窗口即 activate;期间 nineGridHold 暂停自动滚
|
||||
nineGridObserver = new IntersectionObserver(
|
||||
(entries) => {
|
||||
for (const entry of entries) {
|
||||
if (!entry.isIntersecting) continue
|
||||
// 开启动画:等几乎整页入屏;关闭:进入窗口即展示
|
||||
if (animate && entry.intersectionRatio < NINE_GRID_FULL_RATIO) continue
|
||||
const raw = entry.target.getAttribute('data-nine-grid')
|
||||
if (raw == null) continue
|
||||
const pIdx = Number(raw)
|
||||
@@ -1031,9 +1023,7 @@ const bindNineGridObserver = () => {
|
||||
beginNineGridGate(pIdx)
|
||||
}
|
||||
},
|
||||
animate
|
||||
? { threshold: [0, 0.85, 1] }
|
||||
: { threshold: [0, 0.08, 0.2], rootMargin: '120px 0px' }
|
||||
{ threshold: [0, 0.08, 0.2], rootMargin: '120px 0px' }
|
||||
)
|
||||
nodes.forEach((el) => nineGridObserver.observe(el))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user