Skip to main content
Version: Phaser v4.0.0-rc.6

Phaser.Math.Pow2

Scope: static

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

Static functions

GetNext

<static> GetNext(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

<static> IsSize(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

<static> IsValue(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