Guest User

Untitled

a guest
Jun 28th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. void drawParticle(float x, float y, float d, float theta)
  2. {
  3.   stroke(0);
  4.   strokeWeight(1);
  5.   noFill();
  6.  
  7.   ellipse(x,y,d,d);
  8.  
  9.   fill(0);
  10.   noStroke();
  11.  
  12.   ellipse(x + 0.5*d*cos(theta), y + 0.5*d*sin(theta), 6, 6);
  13. }
  14.  
  15. float xpos, ypos, ang, diam;
  16.  
  17. void setup()
  18. {
  19.   size(500,500);
  20. }
  21.  
  22. void draw()
  23. {
  24.   background(255);
  25.   for(int i=-1; i<21; i++)
  26.     for(int j=-1; j<21; j++)
  27.     {
  28.       diam = 45;
  29.       ang = TWO_PI*(i+j)/15 + TWO_PI*frameCount/50;
  30.       xpos = map(i,0,19,5,width-5);
  31.       ypos = map(j,0,19,5,height-5);
  32.       drawParticle(xpos,ypos,diam,ang);
  33.     }
  34.    
  35.   saveFrame("f##.png");
  36.  
  37.   if(frameCount==50)
  38.     exit();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment