using 'cell' to describe shapes instead of raw object
This commit is contained in:
29
src/cell.js
Normal file
29
src/cell.js
Normal 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})`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user