优化了一下老师的旋转方法
var rotateData = [
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]
];
for (var i = 0; i < this.data.length; i++) {
for (var j = 0; j < this.data[0].length; j++) {
rotateData[i][j] = this.data[this.data.length - j - 1][i];
}
}
this.data = rotateData; //rotateData就是旋转后的数组
var rotateData = [
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]
];
for (var i = 0; i < this.data.length; i++) {
for (var j = 0; j < this.data[0].length; j++) {
rotateData[i][j] = this.data[this.data.length - j - 1][i];
}
}
this.data = rotateData; //rotateData就是旋转后的数组
2017-09-06