Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int frames=120, num=80;
- float theta, rotAngle;
- void setup() {
- size(540, 540) ;
- //smooth(8);
- noFill();
- stroke(255);
- }
- void draw() {
- background(0);
- int rad = 50;
- float t = (frameCount%frames)/float(frames);
- rotAngle = map(t, 0, 1, 0, TWO_PI*2)* ease(t, 2, 3);
- for (int i=0; i<num; i++) {
- float offSet = TWO_PI/num*i;
- pushMatrix();
- translate(width/2,height/2);
- rotate(TWO_PI/num*i);
- float x = map(sin(theta+rotAngle+offSet),-1,1,30,200);
- arc(x,0,100,100,PI-radians(rad), PI-radians(-rad));
- popMatrix();
- }
- theta += TWO_PI/frames;
- if (frameCount<=frames) saveFrame("image-##.gif");
- }
- float ease(float t, float e) {
- return t < 0.5 ? 0.5 * pow(2*t, e) : 1 - 0.5 * pow(2*(1 - t), e);
- }
- float ease(float t, float in, float out) {
- return (1-t)*ease(t, in) + t*ease(t, out);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement