优化了一下老师的旋转方法
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
三篇课程的代码都在这了~
https://github.com/shinytang6/BookDemo/tree/master/Imooc/Rush%20Russia%20Based%20On%20WebSocket
希望喜欢的能follow/star下~
https://github.com/shinytang6/BookDemo/tree/master/Imooc/Rush%20Russia%20Based%20On%20WebSocket
希望喜欢的能follow/star下~
2017-09-01