Phaser API Documentation

  Version: 
getBounds([padding], [advance], [delta], [output])

Description:

Returns a bounds Rectangle calculated from the bounds of all currently active Particles in this Emitter. If this Emitter has only just been created and not yet rendered, then calling this method will return a Rectangle with a max safe integer for dimensions. Use the advance parameter to avoid this.

Typically it takes a few seconds for a flow Emitter to 'warm up'. You can use the advance and delta parameters to force the Emitter to 'fast forward' in time to try and allow the bounds to be more accurate, as it will calculate the bounds based on the particle bounds across all timesteps, giving a better result.

You can also use the padding parameter to increase the size of the bounds. Emitters with a lot of randomness in terms of direction or lifespan can often return a bounds smaller than their possible maximum. By using the padding (and advance if needed) you can help limit this.

Parameters:

name type arguments description
padding number <optional>

The amount of padding, in pixels, to add to the bounds Rectangle.

advance number <optional>

The number of ms to advance the Particle Emitter by. Defaults to 0, i.e. not used.

delta number <optional>

The amount of delta to use for each step. Defaults to 1000 / 60.

output Phaser.Geom.Rectangle <optional>

The Rectangle to store the results in. If not given a new one will be created.

Returns:
Description:

A Rectangle containing the calculated bounds of this Emitter.

Since: 3.60.0