phaser
Version:
A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.
30 lines (26 loc) • 771 B
JavaScript
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2025 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Nudges (translates) the top left corner of a Rectangle by a given offset.
*
* @function Phaser.Geom.Rectangle.Offset
* @since 3.0.0
*
* @generic {Phaser.Geom.Rectangle} O - [rect,$return]
*
* @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust.
* @param {number} x - The distance to move the Rectangle horizontally.
* @param {number} y - The distance to move the Rectangle vertically.
*
* @return {Phaser.Geom.Rectangle} The adjusted Rectangle.
*/
var Offset = function (rect, x, y)
{
rect.x += x;
rect.y += y;
return rect;
};
module.exports = Offset;