UNPKG

arcade-physics

Version:
39 lines 1.34 kB
"use strict"; /** * @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 const_1 = __importDefault(require("../const")); /** * Takes an angle in Phasers default clockwise format and converts it so that * 0 is North, 90 is West, 180 is South and 270 is East, * therefore running counter-clockwise instead of clockwise. * * You can pass in the angle from a Game Object using: * * ```javascript * var converted = CounterClockwise(gameobject.rotation); * ``` * * All values for this function are in radians. * * @function Phaser.Math.Angle.CounterClockwise * @since 3.16.0 * * @param {number} angle - The angle to convert, in radians. * * @return {number} The converted angle, in radians. */ const CounterClockwise = angle => { if (angle > Math.PI) { angle -= const_1.default.PI2; } return Math.abs((((angle + const_1.default.TAU) % const_1.default.PI2) - const_1.default.PI2) % const_1.default.PI2); }; exports.default = CounterClockwise; //# sourceMappingURL=CounterClockwise.js.map