Basics > Arrays
Array


To view this content, you need to install Java from java.com
Note
 
Codice
  1. size(360, 360);
  2.  
  3. int maxX  =width;
  4. int maxY  =height;
  5. int maxX_2=maxX/2;
  6. int maxY_2=maxY/2;
  7.  
  8. float[] seno    = new float[maxX];
  9. float[] lineare = new float[maxX];
  10.  
  11. for(int i=0; i < maxX; i++)
  12. {
  13.     float delta = 1.0*i/maxX;
  14.     lineare[i]=delta;  
  15.     seno[i] = sin(delta*PI);
  16. }
  17.  
  18. for(int i=0; i < maxX; i++)
  19. {
  20.     stroke(255*seno[i]);
  21.     line(i, 0, i, maxY_2);
  22. }
  23.  
  24. for(int i=0; i < maxX_2; i++)
  25. {
  26.     stroke(2*255*lineare[i]);
  27.     line(i, maxY_2, i, maxY);
  28. }
  29. for(int i=maxX_2; i < maxX; i++)
  30. {
  31.     stroke(2*255*(1-lineare[i]));
  32.     line(i, maxY_2, i, maxY);
  33. }
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki