hide scene background when playing video

This commit is contained in:
2026-01-28 17:20:39 +02:00
parent 21010376a1
commit 9cb05babe9
3 changed files with 15 additions and 13 deletions
@@ -41,6 +41,9 @@ class VideoPlayer extends EventManager {
skipTransition: data.skipTransition skipTransition: data.skipTransition
}); });
} }
if (data.hideBackground || 1){
engine.showBackground(false);
}
} }
const onPause = ()=>{ const onPause = ()=>{
@@ -49,6 +52,9 @@ class VideoPlayer extends EventManager {
skipTransition: data.skipTransition skipTransition: data.skipTransition
}); });
} }
if (data.hideBackground || 1){
engine.showBackground(true);
}
} }
vi.addEventListener('play', onPlay); vi.addEventListener('play', onPlay);
+6 -10
View File
@@ -594,16 +594,12 @@ class GameEngine extends THREE.EventDispatcher{
this.ambientSound.play(); this.ambientSound.play();
} }
showBackground(show){ showBackground(show, t = 1){
if (show){ this.motionQueue.add({
this.motionQueue.add({ o: this.scene,
o: this.scene, a: { backgroundIntensity: show ? 1 : 0},
a: { backgroundIntensity: 1}, t
t: 15 })
})
}else{
this.scene.backgroundIntensity = 0;
}
} }
static textureLoader = new THREE.TextureLoader(); static textureLoader = new THREE.TextureLoader();
+2 -2
View File
@@ -143,7 +143,6 @@ export default {
let l = target.objects; let l = target.objects;
if (this.scene.data.$environment){ if (this.scene.data.$environment){
await gameEngine.loadPanorama(this.scene.data.$environment.asset.name); await gameEngine.loadPanorama(this.scene.data.$environment.asset.name);
gameEngine.showBackground(false);
} }
if (this.scene.data.$scene){ if (this.scene.data.$scene){
let env = await gameEngine.load(this.scene.data.$scene.asset.name); let env = await gameEngine.load(this.scene.data.$scene.asset.name);
@@ -225,7 +224,8 @@ export default {
intro = await new VideoPlayer(gameEngine, { intro = await new VideoPlayer(gameEngine, {
$go: this.scene.data.$intro, $go: this.scene.data.$intro,
skipTransition: true, skipTransition: true,
playInHud: true playInHud: true,
hideBackground: true
}); });
gameEngine.activeObjects.add(intro.object); gameEngine.activeObjects.add(intro.object);
intro.video.addEventListener('pause',()=>{ intro.video.addEventListener('pause',()=>{