Life Processed

1.

Processing’s static mode follows a list of calls for an entered function and exits when complete. Active mode runs continuously, i.e. to draw something.

2. 

Changed i<20 to i<100
100 Ellipses:

100 Ellipses
size(400,400);
float x;
float y;
for (int i = 0; i < 100; i = i+1)
{
x = random(360);
y = random(360);
ellipse(x+20, y+20, 20,20);
}

Random Colors:

100 Random Colors
size(400,400);
float x;
float y;
fill(100, 100, 100, 50);
for (int i = 0; i < 100; i = i+1)
{
x = random(360);
y = random(360);
fill( random(255), random(255), random(255), random(255));
ellipse(x+20, y+20, 20,20);
}

3. Boxes

Boxes

final int CANVAS_WIDTH = 400; //fill in your desired width here
final int CANVAS_HEIGHT = 400; //fill in desired height here

//setup runs once at the beginning of the program run
void setup() {
size(CANVAS_WIDTH, CANVAS_HEIGHT);
smooth();
frameRate(.5); //Refreshes image every 2 seconds

//comment the following out if you want animation
//noLoop(); //this sets the draw function to only run once
}

int pos = 0;

//function runs many times per second until program ends
void draw()
{
pos++;
if (pos > width)
{
pos = 0;
}
int i = 1;
int j = 1;
drawingRectangles(i,j);
}

//name this helper function with a meaningful name for you
void drawingRectangles(float x, float y){
size(400,400);

fill(100, 100, 100, 50);
background(0, 100, 200);
for (int i = 0; i < 20; i = i+1)
{
x = random(300); // calls for random positions of boxes
y = random(300);
fill( random(100), random(255), random(255), random(255)); // random colors
rect(x+20, y+20, 25,45);
if (key == ‘s’) //to start capturing every refresh, press s.
{ //It will continue capturing till program is stopped
saveFrame(“line-####.jpeg”);
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s