Advertisement
xeromino

hedgehog

Mar 27th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. int slices = 40;
  2. float pie_slice = TWO_PI/slices;
  3.  
  4. float x, y, szX, szY, theta;
  5.  
  6. void setup() {
  7.   size(500, 500);
  8.   noStroke();
  9. }
  10.  
  11. void draw() {
  12.   background(240);
  13.   fill(20,150);
  14.   x = width/2;
  15.   y = map(sin(theta),-1,1, 100, 200);
  16.   float edge = height/10;
  17.   szY = y - edge ;
  18.   szX = 500;
  19.   for (int i=0; i<slices; i++) {
  20.     if (i%4==0) {
  21.     fill(#621515,150);  
  22.     } else {
  23.     fill(#202020,150);
  24.     }
  25.     pushMatrix();
  26.     translate(width/2,height/2);
  27.     rotate(i*pie_slice);
  28.     arc(75, y, szX, szY*2, (PI*1.5)-(pie_slice/2), (PI*1.5)+(pie_slice/2));
  29.     popMatrix();
  30.   }  
  31.   theta += 0.0523;
  32.  
  33.    //if (frameCount%4==0 && frameCount<121) saveFrame("image-###.gif");
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement