Thursday, 17 March 2011

What has been wrong???

1-
  smooth();
  stroke(0);
  int y1,y2;
  for(y1=0; y1<=50; y1=y1+5){
    for(y2=50; y2>=0; y2=y2-5){
      line(0,y1,50,y2);
 }
}


VS.   

2-
   smooth();
   stroke(0);
   line(0,0,50,50);
   line(0,5,50,45);
   line(0,10,50,40);
   line(0,15,50,35);
   line(0,20,50,30);
   line(0,25,50,25);
   line(0,30,50,20);
   line(0,35,50,15);
   line(0,40,50,10);
   line(0,45,50,5);
   line(0,50,50,0);

I tried to re-write the #2 codes using variable and loop and the result was the #1 codes but somehow they didn't draw the same patterns when i pressed the play button. Maybe there are some problems in my variable and loop?? ( i have checked for syntax error and there was none )

I tried to figure out by myself but still cannot find the reason. Help me please!

No comments:

Post a Comment