Class 9: Working with arrays and loops • Built with Processing
Source code Source code Source code
Example 1: Applet draws five rectangles in random spots and with random heights along the top of the window. Example 2: Applet draws 20 squares measuring 5x5 pixels in random positons in the window. Example 3: Applet draws 3 squares that have an intital position and velocity. The squares bounce off the right and left sides of the stage. The speed does not change, just the direction.
Click for sample array code + handout