Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Pow2
Phaser.Math.Pow2
Source: src/math/pow2/index.js (Line 7)

Methods

<static> GetNext(value)
Focus
Focus

Description:

Returns the nearest power of 2 to the given value.

Parameters:

name type description
value number

The value.

Returns:
Description:

The nearest power of 2 to value.

Type:
  • number
Examples:
Since: 3.0.0
Focus
Focus
<static> IsSize(width, height)
Focus
Focus

Description:

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.

Returns:
Description:

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

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
<static> IsValue(value)
Focus
Focus

Description:

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.

Returns:
Description:

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

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus