phaser/v3/src/math/Wrap.js

21 lines
270 B
JavaScript
Raw Normal View History

var Wrap = function (value, min, max)
{
var range = max - min;
if (range <= 0)
{
return 0;
}
var result = (value - min) % range;
if (result < 0)
{
result += range;
}
return result + min;
};
module.exports = Wrap;