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