Due: Tuesday 10/01 10:00am
Submission name: w12_circles
Write A Processing Program:
This program should produce a row of circles that move across the screen. When the row would go past the edge of the screen, it should instead go back to the left side, and move down. Your program should have the following features:
- Global Variables
int cx, cy
: The coordinates for the first circle in the row.int csize
: The size of each circle.int circles
: The numbers of circles in the row.
setup
- Use the following:
void setup() { size(500, 500); frameRate(30); csize = 50; cx = csize/2; cy = csize/2; circles = 4; }//setup
- Use the following:
void circleRow(int startx, int starty, int numCircles, int d)
- Draws a single row of
numCircles
circles. - The center of the first circle should be (startx, starty).
- Each circle should have a diameter of
d
- Draws a single row of
draw
- Calls
circleRow
- Every second, update
cx
to move to the right size of a circle. - If the entire row of circles would go past the edge of the screen, reset
cx
to the left side, and updatecy
to move down one circle.
- Calls
Reference Image:
- If you get this working, try making a function called
circleGrid
, that draws a grid of circles instead of a single row.