using 'cell' to describe shapes instead of raw object

This commit is contained in:
Gavin McDonald
2016-02-19 09:51:08 -05:00
parent c3e5995bf1
commit ccd9cdb111
6 changed files with 77 additions and 48 deletions

29
src/cell.js Normal file
View File

@@ -0,0 +1,29 @@
import {extend} from './utils.js';
import {random} from './utils.js';
export default class Cell {
constructor(settings) {
this.getColor = this.getColor.bind(this);
this.x = 0;
this.y = 0;
this.scale = 10;
this.pointyTop = false;
this.tile = 'circle';
this.style = 'filled';
this.width = 1;
this.red = 0;
this.green = 0;
this.blue = 0;
this.alpha = 0;
this.created = Date.now();
extend(this, settings);
}
getColor() {
return `rgba(${this.red},${this.green},${this.blue},${this.alpha})`;
}
}