UNPKG

arcade-physics

Version:
29 lines 1.06 kB
"use strict"; /** * @author Richard Davey <rich@photonstorm.com> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Clamp_1 = __importDefault(require("./Clamp")); /** * Return a value based on the range between `min` and `max` and the percentage given. * * @function Phaser.Math.FromPercent * @since 3.0.0 * * @param {number} percent - A value between 0 and 1 representing the percentage. * @param {number} min - The minimum value. * @param {number} [max] - The maximum value. * * @return {number} The value that is `percent` percent between `min` and `max`. */ const FromPercent = (percent, min, max) => { percent = (0, Clamp_1.default)(percent, 0, 1); return (max - min) * percent + min; }; exports.default = FromPercent; //# sourceMappingURL=FromPercent.js.map