p5(sketch => {
const colorSheme = {
bkg: invert ? 0 : 255,
petals: invert ? 255 : 0
};
sketch.setup = function() {
sketch.createCanvas(width, 400);
sketch.frameRate(5);
};
sketch.draw = function() {
};
function drawFlower(x, y, nPetals) {
sketch.translate(x, y);
sketch.noStroke();
sketch.circle(0, 0, 10);
for (let i = 0; i < nPetals; i++) {
sketch.fill(colorSheme.petals, 100);
sketch.noStroke();
sketch.ellipse(0, 20, 10, 30);
sketch.rotate((sketch.PI * 2) / nPetals);
}
}
})