Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 1st, 2012  |  syntax: Java  |  size: 0.79 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void setup () {
  2.   size(1024,1024 + 512);
  3.   fill (0,0,0,0);
  4.   background (255);
  5. }
  6. float buffer =  32;
  7.  
  8. int xStartingPos = 512;
  9. int yStartingPos =(512 + 1024)/2;
  10.  
  11. float x1 = xStartingPos;// + buffer;
  12. float y1 = yStartingPos;// + buffer;
  13.  
  14. float x2 = xStartingPos;// - buffer;
  15. float y2 = yStartingPos;// - buffer;
  16.  
  17. float x3 = xStartingPos;// - buffer;
  18. float y3 = yStartingPos;// - buffer;
  19.  
  20. int i = 0;
  21.  
  22.  
  23. void draw () {
  24.   triangle (x1,y1,x2,y2,x3,y3);
  25.  
  26.   float xConversion = 8 * cos ( i * PI / 128);
  27.  
  28.   float yConversion = 8 * sin ( i * PI / 128);
  29.   x1 += xConversion;
  30.   //y1 += yConversion;
  31.  
  32.   x2 -= xConversion;
  33.   y2 -= yConversion;
  34.  
  35.   x3 += xConversion;
  36.   y3 += yConversion;
  37.   i++;
  38.   //noLoop();
  39.   if ( i > 256){
  40.     saveFrame ("output.png");
  41.     noLoop();
  42.   }
  43. }