ArrayUtils.rotateMatrix()

<static> rotateMatrix(matrix, direction) → {Array.<Array.<any>>}

Rotates the given matrix (array of arrays).

Based on the routine from http://jsfiddle.net/MrPolywhirl/NH42z/.

Parameters
Name Type Description
matrix Array.<Array.<any>>

The array to rotate; this matrix may be altered.

direction number | string

The amount to rotate: the rotation in degrees (90, -90, 270, -270, 180) or a string command ('rotateLeft', 'rotateRight' or 'rotate180').

Returns
Array.<Array.<any>> -

The rotated matrix. The source matrix should be discarded for the returned matrix.

Source code: utils/ArrayUtils.js (Line 132)
doc_phaser
2017-02-14 10:36:18
Comments
Leave a Comment

Please login to continue.