Camera#fade()

fade(color, duration, force) → {boolean}

This creates a camera fade effect. It works by filling the game with the
color specified, over the duration given, ending with a solid fill.

You can use this for things such as transitioning to a new scene.

The game will be left 'filled' at the end of this effect, likely obscuring
everything. In order to reset it you can call Camera.resetFX and it will clear the
fade. Or you can call Camera.flash with the same color as the fade, and it will
reverse the process, bringing the game back into view again.

When the effect ends the signal Camera.onFadeComplete is dispatched.

Parameters
Name Type Argument Default Description
color numer <optional>
0x000000

The color the game will fade to. I.e. 0x000000 for black, 0xff0000 for red, etc.

duration number <optional>
500

The duration of the fade in milliseconds.

force boolean <optional>
false

If a camera flash or fade effect is already running and force is true it will replace the previous effect, resetting the duration.

Returns
boolean -

True if the effect was started, otherwise false.

Source code: core/Camera.js (Line 441)
doc_phaser
2017-02-14 10:40:46
Comments
Leave a Comment

Please login to continue.