arcade-physics
Version:
Use Arcade Physics without Phaser.
33 lines • 1.02 kB
JavaScript
;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RotateLeft = void 0;
/**
* Moves the element at the start of the array to the end, shifting all items in the process.
* The "rotation" happens to the left.
*
* @function Phaser.Utils.Array.RotateLeft
* @since 3.0.0
*
* @param {array} array - The array to shift to the left. This array is modified in place.
* @param {number} [total=1] - The number of times to shift the array.
*
* @return {*} The most recently shifted element.
*/
const RotateLeft = (array, total) => {
if (total === undefined) {
total = 1;
}
let element = null;
for (let i = 0; i < total; i++) {
element = array.shift();
array.push(element);
}
return element;
};
exports.RotateLeft = RotateLeft;
//# sourceMappingURL=RotateLeft.js.map