Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num=60, framesAmount=120;
- float t, dx;
- float[] r = new float[num];
- float[] x = new float[num];
- void setup() {
- size(500, 500);
- background(0);
- for (int i=0; i<num; i++) {
- x[i]=0;
- r[i]=TWO_PI/num*i;
- dx=1.0/framesAmount;
- }
- }
- void draw() {
- fill(#322030, 30);
- noStroke();
- rect(0, 0, width, height);
- stroke(#FCFDEB, 100);
- strokeWeight(2);
- t+=dx;
- translate(width/2, height/2);
- for (int i=0; i<num; i++) {
- float offSet=TWO_PI/num*i;
- pushMatrix();
- rotate(offSet);
- float sz = 100;
- x[i] = ease(t, 1.0, 4.0)*(sqrt(sq(width/2)+sq(height/2)));
- pushMatrix();
- translate(x[i], 0);
- rotate(r[i]);
- line(0, sz/2, 0, -sz/2);
- popMatrix();
- popMatrix();
- r[i] += 0.1;
- }
- //if (frameCount%2==0 && frameCount>240 && frameCount<361) saveFrame("image-##.gif");
- if (frameCount%framesAmount==0) {
- t=0;
- for (int i=0; i<num; i++) x[i]=0; //noLoop();
- }
- }
- 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