Phaser API Documentation

  Version: 

Member of: Phaser.Math

<static> Percent(value, min, [max], [upperMax])

Description:

Work out what percentage value is of the range between min and max. If max isn't given then it will return the percentage of value to min.

You can optionally specify an upperMax value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again.

Parameters:

name type arguments description
value number

The value to determine the percentage of.

min number

The minimum value.

max number <optional>

The maximum value.

upperMax number <optional>

The mid-way point in the range that represents 100%.

Returns:
Description:

A value between 0 and 1 representing the percentage.

Type:
  • number
Since: 3.0.0
Source: src/math/Percent.js (Line 7)