topical media & game development

talk show tell print

graphic-processing-algorithm-Ch02-p50a-p50a.pde / pde



  size(360,180);
  for(int x = 0; x<360; x++){
    for(int y = 0; y<360; y++){
      int red = (int)(255. * cos(PI/180. * x) );
      int green = (int)(255. * sin(PI/180. * y));
      int blue = red * green;
      red = abs(red) % 255;
      green = abs(green) % 255;
      blue = abs(blue) % 255;
      if(blue < 128)
        red = green = blue = 0;
      stroke(red, green, blue);
      rect(y, x,1,1);
    }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.