Advertisement
xeromino

GIF_flaw

Feb 16th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. int sz, z=0, num=120;
  2. int[] col = new int[num];
  3. float[] offSet = new float[num];
  4. float theta, scal, inc;
  5. color[] palette = {#69D2E7, #A7DBD8, #E0E4CC, #F38630, #FA6900};
  6.  
  7. void setup() {
  8.   size(500, 500, P3D);
  9.   theta = PI;
  10.   for (int i=0; i<num; i++) {
  11.     //col[i]=(int) random(255);
  12.     inc += (TWO_PI/num);
  13.     offSet[i] = inc;
  14.     println(offSet[i]);
  15.   }
  16. }
  17.  
  18. void draw() {
  19.   background(20);
  20.   sz = 400;
  21.  
  22.   for (int i=0; i<num; i++) {
  23.     pushMatrix();
  24.     translate(width/2, height/2,z);
  25.     rotateX(offSet[i]+theta*0.1);
  26.     rotateY(offSet[i]+theta*0.125);
  27.     rotateZ(offSet[i]+theta*0.05);
  28.     sz -= 5;
  29.     scal = map(sin(offSet[i]*2+theta),-1,1,0.5,1);
  30.     noFill();
  31.     stroke(palette[i%5],200);
  32.     strokeWeight(2*scal);
  33.     ellipse(0, 0, sz*scal, sz*scal);
  34.     popMatrix();
  35.  
  36.   }
  37.   theta += 0.0523;
  38.  
  39.   if (frameCount%4==0 && frameCount<121) saveFrame("image-####.gif");
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement