Advertisement
xeromino

wetDog

Jun 3rd, 2015
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. int frames=120, num=80;
  2. float theta, rotAngle;
  3.  
  4. void setup() {
  5.   size(540, 540) ;
  6.   //smooth(8);
  7.   noFill();
  8.   stroke(255);
  9. }
  10.  
  11. void draw() {
  12.   background(0);
  13.   int rad = 50;
  14.   float t = (frameCount%frames)/float(frames);
  15.   rotAngle = map(t, 0, 1, 0, TWO_PI*2)* ease(t, 2, 3);
  16.   for (int i=0; i<num; i++) {
  17.     float offSet = TWO_PI/num*i;
  18.     pushMatrix();
  19.     translate(width/2,height/2);
  20.     rotate(TWO_PI/num*i);
  21.     float x = map(sin(theta+rotAngle+offSet),-1,1,30,200);
  22.     arc(x,0,100,100,PI-radians(rad), PI-radians(-rad));
  23.     popMatrix();
  24.   }
  25.   theta += TWO_PI/frames;
  26.   if (frameCount<=frames) saveFrame("image-##.gif");
  27. }
  28.  
  29. float ease(float t, float e) {
  30.   return t < 0.5 ? 0.5 * pow(2*t, e) : 1 - 0.5 * pow(2*(1 - t), e);
  31. }
  32.  
  33. float ease(float t, float in, float out) {
  34.   return (1-t)*ease(t, in) + t*ease(t, out);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement