fantasy/painting/factory.js

16 lines
316 B
JavaScript
Raw Normal View History

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