Namespace: Pow2

Phaser.Math. Pow2

Methods


<static> GetPowerOfTwo(value)

Returns the nearest power of 2 to the given value.

Parameters:
Name Type Description
value number

The value.

Since: 3.0.0
Source: src/math/pow2/GetPowerOfTwo.js (Line 7)
Returns:

The nearest power of 2 to value.

Type
integer

<static> IsSizePowerOfTwo(width, height)

Checks if the given width and height are a power of two. Useful for checking texture dimensions.

Parameters:
Name Type Description
width number

The width.

height number

The height.

Since: 3.0.0
Source: src/math/pow2/IsSizePowerOfTwo.js (Line 7)
Returns:

true if width and height are a power of two, otherwise false.

Type
boolean

<static> IsValuePowerOfTwo(value)

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

Parameters:
Name Type Description
value number

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

Since: 3.0.0
Source: src/math/pow2/IsValuePowerOfTwo.js (Line 7)
Returns:

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

Type
boolean