2018-11-18 18:04:50 +00:00
|
|
|
import factory from "./painting/factory.js";
|
|
|
|
import Canvas from "./painting/canvas.js";
|
2018-11-19 07:59:20 +00:00
|
|
|
import Shape from "./painting/shape.js";
|
2018-11-18 00:00:38 +00:00
|
|
|
|
2018-11-18 18:04:50 +00:00
|
|
|
document.body.innerHTML = "";
|
2018-11-18 10:07:36 +00:00
|
|
|
|
2018-11-19 07:59:20 +00:00
|
|
|
Shape.setBounding(window.innerWidth, window.innerHeight);
|
|
|
|
let canvas = new Canvas(window.innerWidth, window.innerHeight);
|
2018-11-18 18:04:50 +00:00
|
|
|
document.body.appendChild(canvas.element);
|
|
|
|
|
2018-11-19 07:59:20 +00:00
|
|
|
let amount = Math.floor(Math.random() * 100 + 50);
|
|
|
|
|
|
|
|
for (let i = 0; i < amount; ++i) {
|
|
|
|
let shape = factory.createRandomShape();
|
|
|
|
canvas.draw(shape);
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener("resize", function(e) {
|
|
|
|
Shape.setBounding(window.innerWidth, window.innerHeight);
|
|
|
|
canvas.resize(window.innerWidth, window.innerHeight);
|
|
|
|
}, false);
|