Engine API Reference - v2.15.1
    Preparing search index...

    Function nextPowerOfTwo

    • Returns the next power of 2 for the specified value.

      Parameters

      • val: number

        The value for which to calculate the next power of 2.

      Returns number

      The next power of 2.

      pc.math.nextPowerOfTwo(17); // returns 32
      pc.math.nextPowerOfTwo(32); // returns 32