Skip to content

Commit dca9f11

Browse files
committed
Started documenting top-level Phaser.Math functions and classes.
1 parent 5f3767f commit dca9f11

21 files changed

Lines changed: 100 additions & 92 deletions

src/math/Average.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66

77
/**
8-
* [description]
8+
* Calculate the mean average of the given values.
99
*
1010
* @function Phaser.Math.Average
1111
* @since 3.0.0
1212
*
13-
* @param {number[]} values - [description]
13+
* @param {number[]} values - The values to average.
1414
*
15-
* @return {number} [description]
15+
* @return {number} The average value.
1616
*/
1717
var Average = function (values)
1818
{

src/math/Between.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*/
66

77
/**
8-
* [description]
8+
* Compute a random integer between the `min` and `max` values, inclusive.
99
*
1010
* @function Phaser.Math.Between
1111
* @since 3.0.0
1212
*
13-
* @param {integer} min - [description]
14-
* @param {integer} max - [description]
13+
* @param {integer} min - The minimum value.
14+
* @param {integer} max - The maximum value.
1515
*
16-
* @return {integer} [description]
16+
* @return {integer} The random integer.
1717
*/
1818
var Between = function (min, max)
1919
{

src/math/FromPercent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ var Clamp = require('./Clamp');
1313
* @since 3.0.0
1414
*
1515
* @param {float} percent - A value between 0 and 1 representing the percentage.
16-
* @param {number} min - [description]
17-
* @param {number} [max] - [description]
16+
* @param {number} min - The minimum value.
17+
* @param {number} [max] - The maximum value.
1818
*
19-
* @return {number} [description]
19+
* @return {number} The value that is `percent` percent between `min` and `max`.
2020
*/
2121
var FromPercent = function (percent, min, max)
2222
{

src/math/GetSpeed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
/**
8-
* [description]
8+
* Calculate the speed required to cover a distance in the time given.
99
*
1010
* @function Phaser.Math.GetSpeed
1111
* @since 3.0.0

src/math/IsEvenStrict.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66

77
/**
8-
* [description]
8+
* Check if a given value is an even number using a strict type check.
99
*
1010
* @function Phaser.Math.IsEvenStrict
1111
* @since 3.0.0
1212
*
13-
* @param {number} value - [description]
13+
* @param {number} value - The number to perform the check with.
1414
*
15-
* @return {boolean} [description]
15+
* @return {boolean} Whether the number is even or not.
1616
*/
1717
var IsEvenStrict = function (value)
1818
{

src/math/Linear.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
* @function Phaser.Math.Linear
1111
* @since 3.0.0
1212
*
13-
* @param {number} p0 - The first point
14-
* @param {number} p1 - The second point
15-
* @param {float} t -The percentage between p0 and p1 to return represented as a number between 0 and 1.
13+
* @param {number} p0 - The first point.
14+
* @param {number} p1 - The second point.
15+
* @param {float} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1.
1616
*
17-
* @return {number} The step t% of the way between p0 and p1
17+
* @return {number} The step t% of the way between p0 and p1.
1818
*/
1919
var Linear = function (p0, p1, t)
2020
{

src/math/MaxAdd.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
*/
66

77
/**
8-
* [description]
8+
* Add an `amount` to a `value`, limiting the maximum result to `max`.
99
*
1010
* @function Phaser.Math.MaxAdd
1111
* @since 3.0.0
1212
*
13-
* @param {number} value - [description]
14-
* @param {number} amount - [description]
15-
* @param {number} max - [description]
13+
* @param {number} value - The value to add to.
14+
* @param {number} amount - The amount to add.
15+
* @param {number} max - The maximum value to return.
1616
*
17-
* @return {number} [description]
17+
* @return {number} The resulting value.
1818
*/
1919
var MaxAdd = function (value, amount, max)
2020
{

src/math/MinSub.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
*/
66

77
/**
8-
* [description]
8+
* Subtract an `amount` from `value`, limiting the minimum result to `min`.
99
*
1010
* @function Phaser.Math.MinSub
1111
* @since 3.0.0
1212
*
13-
* @param {number} value - [description]
14-
* @param {number} amount - [description]
15-
* @param {number} min - [description]
13+
* @param {number} value - The value to subtract from.
14+
* @param {number} amount - The amount to subtract.
15+
* @param {number} min - The minimum value to return.
1616
*
17-
* @return {number} [description]
17+
* @return {number} The resulting value.
1818
*/
1919
var MinSub = function (value, amount, min)
2020
{

src/math/Percent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
* @function Phaser.Math.Percent
1414
* @since 3.0.0
1515
*
16-
* @param {number} value - [description]
17-
* @param {number} min - [description]
18-
* @param {number} [max] - [description]
19-
* @param {number} [upperMax] - [description]
16+
* @param {number} value - The value to determine the percentage of.
17+
* @param {number} min - The minimum value.
18+
* @param {number} [max] - The maximum value.
19+
* @param {number} [upperMax] - The mid-way point in the range that represents 100%.
2020
*
2121
* @return {float} A value between 0 and 1 representing the percentage.
2222
*/

src/math/RandomXY.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
*/
66

77
/**
8-
* [description]
8+
* Compute a random unit vector.
9+
*
10+
* Computes random values for the given vector between -1 and 1 that can be used to represent a direction.
11+
*
12+
* Optionally accepts a scale value to scale the resulting vector by.
913
*
1014
* @function Phaser.Math.RandomXY
1115
* @since 3.0.0
1216
*
13-
* @param {Phaser.Math.Vector2} vector - [description]
14-
* @param {float} scale - [description]
17+
* @param {Phaser.Math.Vector2} vector - The Vector to compute random values for.
18+
* @param {float} [scale=1] - The scale of the random values.
1519
*
16-
* @return {Phaser.Math.Vector2} [description]
20+
* @return {Phaser.Math.Vector2} The given Vector.
1721
*/
1822
var RandomXY = function (vector, scale)
1923
{

0 commit comments

Comments
 (0)