Merge pull request #4900 from samme/patch-1

Correct docs for Phaser.Math.GetSpeed()
This commit is contained in:
Richard Davey 2019-12-18 14:30:31 +00:00 committed by GitHub
commit 65efb6bcb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,15 +5,19 @@
*/
/**
* Calculate the speed required to cover a distance in the time given.
* Calculate a per-ms speed from a distance and time (given in seconds).
*
* @function Phaser.Math.GetSpeed
* @since 3.0.0
*
* @param {number} distance - The distance to travel in pixels.
* @param {integer} time - The time, in ms, to cover the distance in.
* @param {number} distance - The distance.
* @param {integer} time - The time, in seconds.
*
* @return {number} The amount you will need to increment the position by each step in order to cover the distance in the time given.
* @return {number} The speed, in distance per ms.
*
* @example
* // 400px over 1 second is 0.4 px/ms
* Phaser.Math.GetSpeed(400, 1) // -> 0.4
*/
var GetSpeed = function (distance, time)
{