Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float r, theta, angle;
- int num = 8, units = 16, frames = 1200, d=120;
- color col1=#2537b5, col2=#ff3804;
- void setup() {
- size(350, 350, P2D);
- noFill();
- stroke(255,200);
- strokeWeight(2);
- frameRate(20);
- }
- void draw() {
- background(0);
- for (int i=0; i<num; i++) {
- drawCircle(i+1, 40-i*5);
- }
- theta += TWO_PI/frames;
- if (frameCount<=(frames/units)) saveFrame("image-###.gif");
- }
- void drawCircle(int speed, float sz) {
- pushMatrix();
- translate(width/2, height/2);
- rotate(theta*speed);
- if (speed == 2) {
- fill(col2);
- } else {
- fill(col1);
- }
- for (int i=0; i<units; i++) {
- float x = cos(angle)*d;
- float y = sin(angle)*d;
- ellipse(x, y, sz, sz);
- angle=TWO_PI/units*i;
- }
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement