Math#wrap()

wrap(value, min, max) → {number}

Ensures that the value always stays between min and max, by wrapping the value around.

If max is not larger than min the result is 0.

Parameters
Name Type Description
value number

The value to wrap.

min number

The minimum the value is allowed to be.

max number

The maximum the value is allowed to be, should be larger than min.

Returns
number -

The wrapped value.

Source code: math/Math.js (Line 521)
doc_phaser
2017-02-14 10:55:06
Comments
Leave a Comment

Please login to continue.