CSC103 Homework 5 Solution 2012

From dftwiki3
Revision as of 17:02, 7 March 2012 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- <code><pre> void setup() { size( 500, 500 ); smooth(); } void draw() { background( 200 ); for ( int x=0; x < 500; x = x+20 ) { fill( x/2, 255-x, ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 17:02, 7 March 2012 (EST)


void setup() {
  size( 500, 500 );
  smooth(); 
}

void draw() {
   background( 200 );
   
   for ( int x=0; x < 500; x = x+20 ) {
     fill( x/2, 255-x, 0 );
     rect( 0, x, 500, 20 ); 
     fill( 250, 200, 8 );
     if ( mouseY < x ) {
       ellipse( 20, x+10, 20, 20 );
     }
     else {
       ellipse( 500-20, x+10, 20, 20 );
     }
   }
}