improving module structure and naming

This commit is contained in:
Gavin McDonald
2016-02-19 14:28:15 -05:00
parent 42ca0b6e4b
commit a2479f2d2f
3 changed files with 35 additions and 33 deletions

View File

@@ -1,8 +1,8 @@
import {random} from './utils.js';
import Tessellate from './tessellate.js';
import {TileCircle, TileHexagon, TileSquare} from './tessellate.js';
import {utils} from './tessellate.js';
import {DrawCircle, DrawHexagon, DrawSquare} from './tessellate.js';
import {Cell} from './tessellate.js';
class Demo {
@@ -17,9 +17,9 @@ class Demo {
draw: this.draw
});
this.circle = new TileCircle();
this.square = new TileSquare();
this.hexagon = new TileHexagon();
this.circle = new DrawCircle();
this.square = new DrawSquare();
this.hexagon = new DrawHexagon();
this.tiles = ['circle', 'hexagon', 'square'];
this.styles = ['filled', 'outline'];
@@ -28,20 +28,19 @@ class Demo {
click(event) {
let x = event.pageX;
let y = event.pageY;
let scale = random(10, 50);
let scale = utils.random(10, 50);
this.map.push(new Cell({
tile: this.tiles[random(this.tiles.length-1)],
style: this.styles[random(this.styles.length-1)],
name: 'gavin',
tile: this.tiles[utils.random(this.tiles.length-1)],
style: this.styles[utils.random(this.styles.length-1)],
x,
y,
scale,
pointyTop: random(1) ? true : false,
red: random(255),
green: random(255),
blue: random(255),
alpha: random(25,75)/100
pointyTop: utils.random(1) ? true : false,
red: utils.random(255),
green: utils.random(255),
blue: utils.random(255),
alpha: utils.random(25,75)/100
}));
}