You’re reading the docs for Phaser v3.90.0. The latest is Phaser v4.1.0.

Phaser.Math.Pow2

Scope: static

Source: src/math/pow2/index.js#L7

Static functions

GetNext

staticGetNext(value)

Description:

Returns the nearest power of 2 to the given value.

Parameters:

nametypeoptionaldescription
valuenumberNoThe value.

Returns: number - The nearest power of 2 to value.

Source: src/math/pow2/GetPowerOfTwo.js#L7
Since: 3.0.0


IsSize

staticIsSize(width, height)

Description:

Checks if the given width and height are a power of two.

Useful for checking texture dimensions.

Parameters:

nametypeoptionaldescription
widthnumberNoThe width.
heightnumberNoThe height.

Returns: boolean - true if width and height are a power of two, otherwise false.

Source: src/math/pow2/IsSizePowerOfTwo.js#L7
Since: 3.0.0


IsValue

staticIsValue(value)

Description:

Tests the value and returns true if it is a power of two.

Parameters:

nametypeoptionaldescription
valuenumberNoThe value to check if it's a power of two.

Returns: boolean - Returns true if value is a power of two, otherwise false.

Source: src/math/pow2/IsValuePowerOfTwo.js#L7
Since: 3.0.0