We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d279e77 commit f751d40Copy full SHA for f751d40
1 file changed
v3/src/math/FromPercent.js
@@ -0,0 +1,22 @@
1
+var Clamp = require('./Clamp');
2
+
3
+/**
4
+ * Return a value based on the range between `min` and `max` and the percentage given.
5
+ *
6
+ * @function Phaser.Math.FromPercent
7
+ * @since 3.0.0
8
9
+ * @param {float} percent - A value between 0 and 1 representing the percentage.
10
+ * @param {number} min - [description]
11
+ * @param {number} [max] - [description]
12
13
+ * @return {number} [description]
14
+ */
15
+var FromPercent = function (percent, min, max)
16
+{
17
+ percent = Clamp(percent, 0, 1);
18
19
+ return (max - min) * percent;
20
+};
21
22
+module.exports = FromPercent;
0 commit comments