UNPKG

arcade-physics

Version:
25 lines 724 B
"use strict"; /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ Object.defineProperty(exports, "__esModule", { value: true }); /** * Wrap the given `value` between `min` and `max. * * @function Phaser.Math.Wrap * @since 3.0.0 * * @param {number} value - The value to wrap. * @param {number} min - The minimum value. * @param {number} max - The maximum value. * * @return {number} The wrapped value. */ const Wrap = (value, min, max) => { const range = max - min; return min + ((((value - min) % range) + range) % range); }; exports.default = Wrap; //# sourceMappingURL=Wrap.js.map