Phaser API Documentation


Member of: Phaser.Math

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


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.


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%.


A value between 0 and 1 representing the percentage.

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