Phaser.Math.Pow2
Scope: static
Source: src/math/pow2/index.js#L7
Static functions
GetPowerOfTwo
<static> GetPowerOfTwo(value)
Description:
Returns the smallest power of 2 that is greater than or equal to the given value. For example, a value of 7 returns 8, a value of 8 returns 8, and a value of 9 returns 16.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| value | number | No | The value for which to find the next power of 2. Should be a positive number. |
Returns: number - The smallest power of 2 that is greater than or equal 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:
| name | type | optional | description |
|---|---|---|---|
| width | number | No | The width to check, in pixels. |
| height | number | No | The height to check, in pixels. |
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:
| name | type | optional | description |
|---|---|---|---|
| value | number | No | The 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