Code
background(255); size(300,300); smooth(); float V = 100; //red ellipse noStroke(); fill (200,0,0); ellipse(V,50,50,50); //blue ellipse fill(0,30,200); ellipse(2*V,50,50,50); //green ellipse fill(0,200,0); ellipse(V+50,100,50,50); //yellow ellipse fill(250,250,0); ellipse(width-V,150,50,50); //purple ellipse, height determined by two V's subtracted from the height fill(200,0,150); ellipse(height-2*V,100,50,50); //orange ellipse, V is a float variable with value of 100.0, here it is //used by to determine the location and size parameters of the ellipse fill(250,150,0); ellipse(V/2+50,300-V,V,V);
0101 - Arithmetic and Position: Shifting and Scaling
Statement:
Request a canvas of size 300x300 pixels. Declare a float variable V. Assign this variable to have some value, say, 100.
Use V to govern the horizontal location (not the size) of a small circle (perhaps 50x50 pixels) on the canvas. In other words, incorporate V into the syntactic slot for the x-coordinate of the ellipse function. Draw a circle there which is filled with a red color.
Now draw a similar circle, filled with a blue color, located at V times 2.
Now draw a similar circle, filled with a green color, located at V plus 50.
Now draw another circle, filled with a yellow color, located at width minus V.
Experiment with different multiplicative factors, and different additive factors. In comments in your code, describe the visual effect of multiplication and addition on a variable used to govern position. What happens when the variable V is subtracted from another number?