Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num = 6, frames = 150;
- float angle, theta, d, d2;
- void setup() {
- size(540, 540,P2D);
- colorMode(HSB,360,100,100);
- noStroke();
- }
- void draw() {
- background(#000000);
- beginShape();
- for (int i=0; i<num; i++) {
- float offSet=TWO_PI/num*i;
- d = 150;
- d2 = 50;
- float x = width/2 + sin(angle)*d;
- float y = height/2 + cos(angle)*d;
- float x2 = x + sin(theta+offSet)*d2;
- float y2 = y + cos(theta+offSet*2)*d2;
- if (i%3==0) fill(360.0/num*i,90,90);
- vertex(x2, y2);
- angle = offSet;
- }
- endShape(CLOSE);
- theta += TWO_PI/frames;
- if (frameCount>10 && frameCount<=(frames+10)) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement