Static

Description

(>= 1.3.0) Change the positions of the array elements, the rotation matrix

Usage

Parameters

  • array {Array}

    The matrix in question

  • rotation {String} optional

    (optional) Rotation in degree : 90 or -90, 180 (90 by default)

Returns

Array

Example

var matrix = [
    [1, 0],
    [1, 1],
    [1, 0]
];

CE.rotateMatrix(matrix); 

// => [
        [1, 1, 1],
        [0, 1, 0]
    ]

CE.rotateMatrix(matrix, "-90"); 

// =>   [
            [0, 1, 0],
            [1, 1, 1]
        ]

CE.rotateMatrix(matrix, "180"); 

// =>   [
            [0, 1],
            [1, 1],
            [0, 1]
        ]

Discussion