fantasy/painting/factory.js

17 lines
338 B
JavaScript
Raw Normal View History

2018-11-18 18:04:50 +00:00
import Rectangle from "./rectangle.js";
const options = [
Rectangle
]
export default {
createRandomShape: function() {
let Shape = options[Math.floor(Math.random() * options.length)];
let opts = Shape.randomOptions();
let shape = Shape.fromOptions(opts);
2018-11-18 18:17:26 +00:00
return shape;
2018-11-18 18:04:50 +00:00
}
};