~1 min read

Scene transition

Fade between two scenes using the camera fade-out / fade-in API.

Scene transition Phaser 4 · sandboxed

Notes

  • The scene: array registers multiple scenes; the first runs by default.
  • cameras.main.fadeOut(duration, r, g, b) darkens the camera; fadeIn is the inverse.
  • The completion is signalled by the camerafadeoutcomplete event — perfect place to swap scenes.
  • scene.start(key) replaces the current scene (vs. scene.launch which runs in parallel — useful for HUDs and pause menus).
  • See Scenes for the rest of the lifecycle.