Phaser API Documentation

  Version: 

Member of: Phaser.Math

<static> GetSpeed(distance, time)

Description:

Calculate a per-ms speed from a distance and time (given in seconds).

Parameters:

name type description
distance number

The distance.

time number

The time, in seconds.

Returns:
Description:

The speed, in distance per ms.

Type:
  • number
Examples:
// 400px over 1 second is 0.4 px/ms
Phaser.Math.GetSpeed(400, 1) // -> 0.4
Since: 3.0.0
Source: src/math/GetSpeed.js (Line 7)