Camera FadeIn

I have processing I need to do in my create function and while that’s happening I want my scene to be black. After the processing is complete I want to use the fadeIn camera effect to reveal my scene. I’m having a hard time figuring out how to black out my scene with the camera effects. It appears the fade functions start the effect immediately without any way of making it wait until my scene is ready.

Easy solution would be to create a black graphics object and overlay that on top of my scene, however that is a last resort.

Is there anyway to black out my scene using the camera functions so that I can delay the fadeIn effect?

Hi @Sturb,
You can start with the scene hidden and when your process is complete call the fadein function with using some event or callback. Here the fadein waits for the pointerdown event:

function create() {
  this.scene.setVisible(false);
  this.add.text(160,120,'FADE IN CAMERA EFFECT').setOrigin(0.5);
  this.input.once('pointerdown',function(){
    this.scene.setVisible(true);
    this.cameras.main.fadeIn(2000);
  }, this);
}

Regards.

1 Like

This works for my situation. Thanks!

thanks this work for me, maybe add some flag for dont execute any update before that fade is completed

    this.cameras.main.fadeIn(2000);