Wednesday, June 30, 2010

Free Range

// just type here
// and click "save" when your done



float a = 0.0; //incremental value
int box_space = 12; //space between the grid of eggs and the frame
int margin = 2; //space between the eggs

void setup() {
size(500, 500); //size of window
 background(100); 
}


void draw() {
frameRate(15);

smooth();
a = (a + 8)%(width/2+box_space); 

for(int i = margin; i < 200-margin; i += box_space){ //controls the horizontal "production" of eggs
  for(int j = margin; j <200 - margin; j+= box_space){ //controls the vertical "production" of eggs
    fill(255, a+70, a+100,255-(a/1.5)); //colour of the eggs, notice that the alpha channel is also affected by a, making it opaque
    ellipse(j+12+a,i+12+a, 10, 12); // each new grid of eggs is affected by a as well, making it go down
    }
  }
}// end of draw

info info

submitted by: ric_lmc
views: 30


Tags:

comments comment

loading loading...

 

Add a comment: