arcade-physics
Version:
Use Arcade Physics without Phaser.
31 lines • 1.05 kB
JavaScript
;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const RotateAroundXY_1 = __importDefault(require("./RotateAroundXY"));
/**
* Rotate a line around its midpoint by the given angle in radians.
*
* @function Phaser.Geom.Line.Rotate
* @since 3.0.0
*
* @generic {Phaser.Geom.Line} O - [line,$return]
*
* @param {Phaser.Geom.Line} line - The line to rotate.
* @param {number} angle - The angle of rotation in radians.
*
* @return {Phaser.Geom.Line} The rotated line.
*/
const Rotate = (line, angle) => {
const x = (line.x1 + line.x2) / 2;
const y = (line.y1 + line.y2) / 2;
return (0, RotateAroundXY_1.default)(line, x, y, angle);
};
exports.default = Rotate;
//# sourceMappingURL=Rotate.js.map