void setup()
{
size (400,400);
noStroke();
rectMode(CENTER);
for (int i = 0; i < 10; i = i+1) {
int posx = int(random(400));
int posy = int(random(400));
int size = int(random(100))+30;
myFourSquares (posx, posy, size);;
}
}
void myFourSquares (int x, int y, int size)
{
int myRed = int(random(255));
int myGreen = int(random(255));
int myBlue = int(random(255));
fill (myRed, myGreen, myBlue, 128);
rect (x, y, size, size);
rect (200 + (200 - x), y, size, size);
rect (x, 200 + (200-y), size, size);
rect (200 + (200 - x), 200 + (200-y), size, size);
}
I walked students through a number of Processing programs and explained in detail how they work. The main concept I wanted to get across this week was functions and how they can be used to abstract out code that can be reused. I also wanted students to get to grips with parameters.
I gave out printed copies of the code afterwards and I had uploaded a recording of the class to Blackboard.
I asked students to write some simple programs but with circles and lines.
No comments:
Post a Comment