Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- size(600, 600);
- noStroke();
- // noSmooth();
- }
- float t;
- color a = #FA003F;
- int frames = 600;
- float radius = 70;
- int size = 200;
- color back = #2D3339;
- int num = 13;
- float ss = ((2 * PI * size) / num) * 0.9;
- float theta = 0;
- void draw() {
- t = (frameCount%frames)/(float)frames;
- // VERY CRUDE HERE
- if ((frameCount%frames)==0) {
- fill(random(255), random(255), random(255));
- }
- background(back);
- translate((int)width/2, (int)height/2);
- pushMatrix();
- rotate(theta);
- program();
- popMatrix();
- }
- void a() {
- fill(a);
- }
- void program() {
- if ( t < 0.5) {
- float tt = map(t, 0, 0.5, 0, 1);
- // FIRST QUARTER
- if (tt < 0.5) {
- for (int i = 0; i < num; i++) {
- pushMatrix();
- float r = map(tt, 0, 0.5, ss, 0);
- float move = map(i, 0, num, 0, TWO_PI);
- rotate(move);
- translate(size, 0);
- rotate(PI/2);
- arc(0, 0, ss, r, 0, PI);
- arc(0, 0, ss, ss, PI, TWO_PI); //doesn't move
- popMatrix();
- }
- }
- // SECOND QUARTER
- else {
- for (int i = 0; i < num; i++) {
- pushMatrix();
- float move = map(i, 0, num, 0, TWO_PI);
- rotate(move);
- translate(size, 0);
- rotate(PI/2);
- float r = map(tt, 0.5, 1, 0, ss);
- arc(0, 0, ss, ss, PI, TWO_PI); // doesn't move
- fill(back);
- arc(0, 0, ss, r, PI, TWO_PI);
- fill(255);
- popMatrix();
- }
- }
- }
- // HALF TWO
- else {
- float tt = map(t, 0.5, 1, 0, 1);
- if (tt < 0.5) {
- for (int i = 0; i<num; i++) {
- pushMatrix();
- float move = map(i, 0, num, 0, TWO_PI);
- rotate(move);
- translate(size, 0);
- rotate(PI/2);
- float r = map(tt, 0, 0.5, ss, 0);
- fill(255);
- arc(0, 0, ss, ss, PI, TWO_PI);
- fill(back);
- arc(0, 0, ss, r, PI, TWO_PI);
- popMatrix();
- }
- } else {
- for (int i=0; i<num; i++) {
- pushMatrix();
- float move = map(i, 0, num, 0, TWO_PI);
- rotate(move);
- translate(size, 0);
- rotate(PI/2);
- float r = map(tt, 0.5, 1, 0, ss);
- fill(255);
- arc(0, 0, ss, ss, PI, TWO_PI);
- arc(0, 0, ss, r, 0, PI);
- fill(255);
- popMatrix();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement