-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcanvas.js
33 lines (28 loc) · 878 Bytes
/
canvas.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(function () {
if (typeof window.Pixels === 'undefined') {
window.Pixels = {};
}
Board = Pixels.Board = function (options) {
this.width = (Math.round(options.width / 10) * 10);
this.height = (Math.round(options.height / 10) * 10);
this.numOfCells = (this.width * this.height / 100);
this.cellBackgroundColor = options.cellBackgroundColor;
// this.borderColor = options.borderColor;
// this.borderThickness = options.borderThickness;
this.cells = [];
this.makeCells();
};
Cell = Pixels.Cell = function (color, idx) {
this.color = color;
this.idx = idx;
};
Cell.SIZE = 10;
Board.prototype.makeCells = function () {
var that = this;
for (var i = 0; i < that.numOfCells; i++) {
var newCell = new Cell(this.cellBackgroundColor, i);
that.cells.push(newCell);
}
return that.cells;
};
})();