Advertisement
xeromino

teq

Feb 18th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. int num = 7;
  2. int rad = 30;
  3. float[] x = new float[num];
  4. float[] y = new float[num];
  5. float[] offSet = new float[num];
  6. float theta, angle;
  7.  
  8. void setup() {
  9.   size(500, 500);
  10.  
  11.   for (int i=0; i<num; i++) {
  12.     int radius = (int) random(100,200);
  13.     x[i] = sin(theta)*radius ;
  14.     y[i] = cos(theta)*radius ;
  15.     offSet[i] = random(TWO_PI);
  16.     theta += (TWO_PI/num);
  17.   }
  18. }
  19.  
  20. void draw() {
  21.  
  22.   background(255);
  23.  
  24.   translate(width/2, height/2);
  25.   beginShape();
  26.   for (int i=0; i<num; i++) {
  27.     fill(#074358);
  28.     float px = sin(angle+offSet[i])*rad*1.5;
  29.     float py = cos(angle+offSet[i])*rad*1.5;
  30.     vertex(x[i]+px, y[i]+py);
  31.   }
  32.   endShape(CLOSE);
  33.  
  34.     beginShape();
  35.   for (int i=0; i<num; i++) {
  36.     fill(255);
  37.     noStroke();
  38.     float px = sin(angle+offSet[i])*rad;
  39.     float py = cos(angle+offSet[i])*rad;
  40.     vertex(x[i]+px, y[i]+py);
  41.   }
  42.   endShape(CLOSE);
  43.  
  44.      beginShape();
  45.   for (int i=0; i<num; i++) {
  46.     fill(#074358);
  47.     noStroke();
  48.     float px = sin(angle+offSet[i])*rad*.75;
  49.     float py = cos(angle+offSet[i])*rad*.75;
  50.     vertex(x[i]+px, y[i]+py);
  51.   }
  52.   endShape(CLOSE);
  53.  
  54.      beginShape();
  55.   for (int i=0; i<num; i++) {
  56.     fill(255);
  57.     noStroke();
  58.     float px = sin(angle+offSet[i])*rad*.5;
  59.     float py = cos(angle+offSet[i])*rad*.5;
  60.     vertex(x[i]+px, y[i]+py);
  61.   }
  62.   endShape(CLOSE);
  63.  
  64.   angle += 0.0523;
  65.  
  66.   if (frameCount%4==0 && frameCount<121) saveFrame("image-###.gif");
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement