window bounding, resizing with window resizing, new shape: circle, margins removed, random amount of objects to be painted
This commit is contained in:
parent
2f21b26c64
commit
c1bea776b2
8 changed files with 75 additions and 25 deletions
17
main.js
17
main.js
|
@ -1,10 +1,21 @@
|
|||
import factory from "./painting/factory.js";
|
||||
import Canvas from "./painting/canvas.js";
|
||||
import Shape from "./painting/shape.js";
|
||||
|
||||
document.body.innerHTML = "";
|
||||
|
||||
let canvas = new Canvas();
|
||||
Shape.setBounding(window.innerWidth, window.innerHeight);
|
||||
let canvas = new Canvas(window.innerWidth, window.innerHeight);
|
||||
document.body.appendChild(canvas.element);
|
||||
|
||||
let shape = factory.createRandomShape();
|
||||
canvas.draw(shape);
|
||||
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);
|
Loading…
Add table
Add a link
Reference in a new issue