Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int frames=240, num=16;
- float theta, rotAngle;
- void setup() {
- size(540, 540);
- noFill();
- stroke(255);
- }
- void draw() {
- background(0);
- float t = (frameCount%frames)/float(frames);
- rotAngle = map(t, 0, 1, 0, TWO_PI*3)* ease(t, 1, 3);
- for (int i=0; i<num; i++) {
- pushMatrix();
- translate(width/2,height/2);
- rotate(TWO_PI/num*i);
- float x = map(sin(theta+rotAngle),-1,1,30,200);
- ellipse(x,0,30,30);
- popMatrix();
- }
- theta += TWO_PI/frames;
- }
- 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