forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinSub.js
More file actions
24 lines (22 loc) · 661 Bytes
/
Copy pathMinSub.js
File metadata and controls
24 lines (22 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Subtract an `amount` from `value`, limiting the minimum result to `min`.
*
* @function Phaser.Math.MinSub
* @since 3.0.0
*
* @param {number} value - The value to subtract from.
* @param {number} amount - The amount to subtract.
* @param {number} min - The minimum value to return.
*
* @return {number} The resulting value.
*/
var MinSub = function (value, amount, min)
{
return Math.max(value - amount, min);
};
module.exports = MinSub;