Advertisement
xeromino

hedgehog_inception

Mar 27th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. int slices = 40;
  2. float pie_slice = TWO_PI/slices;
  3.  
  4. float x, y, szX, szY, theta, theta2;
  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/3;
  15.   y = map(sin(theta), -1, 1, 100, 180);
  16.   float edge = height/10;
  17.   szY = y - edge ;
  18.   szX = 500;
  19.   for (int i=0; i<slices; i++) {
  20.     pushMatrix();
  21.     translate(width/2, height/2);
  22.     rotate(i*pie_slice);
  23.     arc(x, y, szX, szY*2, (PI*1.5)-(pie_slice/2), (PI*1.5)+(pie_slice/2));
  24.     popMatrix();
  25.   }  
  26.   theta += 0.0523;
  27.  
  28.   x = width/5;
  29.   y = map(sin(-theta*2), -1, 1, 100, 200);
  30.   edge = height/10;
  31.   szY = y - edge ;
  32.   szX = 500;
  33.   for (int i=0; i<slices; i++) {
  34.     pushMatrix();
  35.     translate(width/2, height/2);
  36.     rotate(i*pie_slice);
  37.     arc(x, y, szX, szY*2, (PI*1.5)-(pie_slice/2), (PI*1.5)+(pie_slice/2));
  38.     popMatrix();
  39.   }  
  40.   theta2 -= 0.0523;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement