hide scene background when playing video
This commit is contained in:
@@ -41,6 +41,9 @@ class VideoPlayer extends EventManager {
|
||||
skipTransition: data.skipTransition
|
||||
});
|
||||
}
|
||||
if (data.hideBackground || 1){
|
||||
engine.showBackground(false);
|
||||
}
|
||||
}
|
||||
|
||||
const onPause = ()=>{
|
||||
@@ -49,8 +52,11 @@ class VideoPlayer extends EventManager {
|
||||
skipTransition: data.skipTransition
|
||||
});
|
||||
}
|
||||
if (data.hideBackground || 1){
|
||||
engine.showBackground(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vi.addEventListener('play', onPlay);
|
||||
vi.addEventListener('pause', onPause);
|
||||
|
||||
|
||||
+6
-10
@@ -594,16 +594,12 @@ class GameEngine extends THREE.EventDispatcher{
|
||||
this.ambientSound.play();
|
||||
}
|
||||
|
||||
showBackground(show){
|
||||
if (show){
|
||||
this.motionQueue.add({
|
||||
o: this.scene,
|
||||
a: { backgroundIntensity: 1},
|
||||
t: 15
|
||||
})
|
||||
}else{
|
||||
this.scene.backgroundIntensity = 0;
|
||||
}
|
||||
showBackground(show, t = 1){
|
||||
this.motionQueue.add({
|
||||
o: this.scene,
|
||||
a: { backgroundIntensity: show ? 1 : 0},
|
||||
t
|
||||
})
|
||||
}
|
||||
|
||||
static textureLoader = new THREE.TextureLoader();
|
||||
|
||||
@@ -143,7 +143,6 @@ export default {
|
||||
let l = target.objects;
|
||||
if (this.scene.data.$environment){
|
||||
await gameEngine.loadPanorama(this.scene.data.$environment.asset.name);
|
||||
gameEngine.showBackground(false);
|
||||
}
|
||||
if (this.scene.data.$scene){
|
||||
let env = await gameEngine.load(this.scene.data.$scene.asset.name);
|
||||
@@ -225,7 +224,8 @@ export default {
|
||||
intro = await new VideoPlayer(gameEngine, {
|
||||
$go: this.scene.data.$intro,
|
||||
skipTransition: true,
|
||||
playInHud: true
|
||||
playInHud: true,
|
||||
hideBackground: true
|
||||
});
|
||||
gameEngine.activeObjects.add(intro.object);
|
||||
intro.video.addEventListener('pause',()=>{
|
||||
|
||||
Reference in New Issue
Block a user