Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void drawParticle(float x, float y, float d, float theta)
- {
- stroke(0);
- strokeWeight(1);
- noFill();
- ellipse(x,y,d,d);
- fill(0);
- noStroke();
- ellipse(x + 0.5*d*cos(theta), y + 0.5*d*sin(theta), 6, 6);
- }
- float xpos, ypos, ang, diam;
- void setup()
- {
- size(500,500);
- }
- void draw()
- {
- background(255);
- for(int i=-1; i<21; i++)
- for(int j=-1; j<21; j++)
- {
- diam = 45;
- ang = TWO_PI*(i+j)/15 + TWO_PI*frameCount/50;
- xpos = map(i,0,19,5,width-5);
- ypos = map(j,0,19,5,height-5);
- drawParticle(xpos,ypos,diam,ang);
- }
- saveFrame("f##.png");
- if(frameCount==50)
- exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment