Advertisement
xeromino

chrom

Mar 27th, 2015
1,494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. int num=50, d=100, frames=120;
  2. float theta;
  3.  
  4. void setup() {
  5.   size(540, 540, P2D);
  6.   blendMode(SCREEN);
  7.   stroke(255);
  8.   noStroke();
  9.   fill(255);
  10.   //noFill();
  11. }
  12.  
  13. void draw() {
  14.   background(0);
  15.   for (int j=0; j<3; j++) {
  16.     if (j==0) fill(255,0,0);
  17.     if (j==1) fill(0,255,0);
  18.     if (j==2) fill(0,0,255);
  19.     for (int i=0; i<num; i++) {
  20.       float angle = TWO_PI/num*i;
  21.       float x = width/2 + j*5 + cos(angle)*d;
  22.       float y = height/2 + sin(angle)*d;
  23.       pushMatrix();
  24.       translate(x, y);
  25.       rotate(theta+angle);
  26.       float d2=d*1.5;
  27.       arc(0, 0, d2, d2, 0, radians(5));
  28.       popMatrix();
  29.     }
  30.   }
  31.   theta += TWO_PI/frames;
  32.   //if (frameCount<=frames) saveFrame("image-###.gif");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement