phaser4-rex-plugins
Version:
23 lines (20 loc) • 590 B
JavaScript
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2019 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Calculates the width/height ratio of a rectangle.
*
* @function Phaser.Geom.Rectangle.GetAspectRatio
* @since 3.0.0
*
* @param {Phaser.Geom.Rectangle} rect - The rectangle.
*
* @return {number} The width/height ratio of the rectangle.
*/
var GetAspectRatio = function (rect)
{
return (rect.height === 0) ? NaN : rect.width / rect.height;
};
export default GetAspectRatio;