fix: hide old video frame before crossfade when coming from image scene

This commit is contained in:
2026-06-08 21:24:28 +08:00
parent 972738572f
commit 5b40781d0a

View File

@@ -20,6 +20,7 @@ export class Engine {
private isInitialScene = true
private qteTriggered = false
private qteResolved = false
private justCameFromImage = false
constructor() {
this.sceneManager = new SceneManager()
@@ -61,6 +62,7 @@ export class Engine {
}
if (scene.type === 'image') {
this.justCameFromImage = true
this.isInitialScene = false
this.emit('sceneChange', scene)
const visible = this.getVisibleHotspots(scene)
@@ -88,6 +90,14 @@ export class Engine {
const activeEl = this.videoManager.getActiveVideoElement()
activeEl?.pause()
if (this.justCameFromImage) {
this.justCameFromImage = false
if (activeEl) {
activeEl.style.opacity = '0'
activeEl.style.transition = 'none'
}
}
if (this.isInitialScene) {
this.isInitialScene = false
this.videoManager.playInitial(scene.videoUrl, preloadUrls)