Rectangle coding help

Hello,

Your program is executing exactly the way you coded it. After the the first draw() loop (which has rectangles) the next loop falls through the while loop (10 is not < 10) and the canvas is cleared for each draw() cycle that follows.

I added a noLoop() to end of setup() so draw() only loops once and you can see output.
I also added some println() statements.

First cycle (frame) of draw():


After that background() clears canvas and it is grey.

Try initializing variables at start of draw before the while loop.

:)

1 Like