Link to my project: https://editor.p5js.org/rl4800/sketches/hB99jWwZa
I decided to make a tree with different random leaves to apply what we learned this week about random variables and conditional drawing.
Every time people click the run button, the system generates a canvas with a random color. Then leaves with similar colors start to grow on the branches.
I set different variables to set random positions and colors for leaves. There are basically 6 branches of leaves growing every time people click the button, and the random leaves stop generating once they go beyond the restriction I set.
The main code of my sketch is a repetition of this part:
if (x1 > 20 && x1 < 520 && y1 > 70 && y1 < 430) {
circle(x1, y1, random(30));
x1 -= random(-L, L);
y1 -= random(-L, L);
And to generate a similar bright background, I learned to use HSB color mode this time and it worked pretty well.