Draw Something Cool in 2D using Processing and for-loops


This page was last updated: July 6, 2019


Requirements

  1. OK, you've drawn a scene by hand. Now automate the drawing using variables and for-loops. It must be of your own creation.
  2. By using a for-loop, you must draw a scene with at least 50 objects in it. Within the for-loop, you must change:
    1. The object's location
    2. The object's size
    3. The object's color
  3. You can use the Processing map( ) function to interpolate values, if you want. This is especially handy for this type of automated data geberation.

    As a reminder, this function takes an input value, the range of values it lives between, and the range of output values. It returns the output value that corresponds to the input value. So, for example, if we wanted to turn an x value into a red color, we might say:

    int red = int( map( x, 0, width - 1, 0, 255 ) );

  4. You can use multiple for-loops if you want to create distinctly different patterns. The total number of objects between the for-loops must be 50 or more.