diff --git a/sketch_190219a/sketch_190219a.pde b/sketch_190219a/sketch_190219a.pde index 8d65c30..c0c07bf 100644 --- a/sketch_190219a/sketch_190219a.pde +++ b/sketch_190219a/sketch_190219a.pde @@ -1,42 +1,42 @@ void settings() { size(400, 800, P2D); } void setup() { - background(133, 97, 160); + background(255, 0, 0); noLoop(); } void draw() { plant(15, 0.4, 0.8); } void leaf() { beginShape(); vertex(100.0, -70.0); bezierVertex(90.0, -60.0, 40.0, -100.0, 0.0, 0.0); bezierVertex(0.0, 0.0, 100.0, 40.0, 100.0, -70.0); endShape(); } void plant(int numLeaves, float minLeafScale, float maxLeafScale) { line(width / 2, 0, width / 2, height); // the plant's stem int gap = height/numLeaves; // vertical spacing between leaves float angle = 0; for (int i = 0; i < numLeaves; i++) { int x = width / 2; int y = gap * i + (int)random(gap); float scale = random(minLeafScale, maxLeafScale); pushMatrix(); // Complete the code! translate(x,y); scale(scale); rotate(angle); leaf(); rotate(-angle); scale(1/scale); translate(-x,-y); popMatrix(); angle += PI; // alternate the side for each leaf } }