21 lines
664 B
JavaScript
21 lines
664 B
JavaScript
import factory from "./painting/factory.js";
|
|
import Canvas from "./painting/canvas.js";
|
|
import Shape from "./painting/shape.js";
|
|
|
|
document.body.innerHTML = "";
|
|
|
|
Shape.setBounding(window.innerWidth, window.innerHeight);
|
|
let canvas = new Canvas(window.innerWidth, window.innerHeight);
|
|
document.body.appendChild(canvas.element);
|
|
|
|
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); |