Skip to content

Commit da2a023

Browse files
authored
Correct docs for Phaser.Math.GetSpeed()
Fixes phaserjs#4895
1 parent e98a639 commit da2a023

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/math/GetSpeed.js

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

77
/**
8-
* Calculate the speed required to cover a distance in the time given.
8+
* Calculate a per-ms speed from a distance and time (given in seconds).
99
*
1010
* @function Phaser.Math.GetSpeed
1111
* @since 3.0.0
1212
*
13-
* @param {number} distance - The distance to travel in pixels.
14-
* @param {integer} time - The time, in ms, to cover the distance in.
13+
* @param {number} distance - The distance.
14+
* @param {integer} time - The time, in seconds.
1515
*
16-
* @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given.
16+
* @return {number} The speed, in distance per ms.
17+
*
18+
* @example
19+
* // 400px over 1 second is 0.4 px/ms
20+
* Phaser.Math.GetSpeed(400, 1) // -> 0.4
1721
*/
1822
var GetSpeed = function (distance, time)
1923
{

0 commit comments

Comments
 (0)