float counter = 0.0; float speed = 10; dot[] dotarray = new dot[500]; dot2[] dot2array = new dot2[500]; void setup() { size(1000,1000); background(0); noStroke(); colorMode (HSB); frameRate(15); for (int i = 0; i < dotarray.length; i++) { dotarray[i] = new dot(color( int(random(255)), int(100),int(220),255-int(random(150)) ),random(1000),random(1000),random(sin(2)),random(sin(2))); } for (int i = 0; i < dot2array.length; i++) { dot2array[i] = new dot2(color( int(random(255)), int(100),int(220),255-int(random(150)) ),random(1000),random(1000),random(sin(2)),random(sin(2))); } } void draw() { background(116,random(255),120); for (int i = 0; i < dotarray.length; i++) { dotarray[i].update(); dotarray[i].display(); } for (int i = 0; i < dot2array.length; i++) { dot2array[i].update(); dot2array[i].display(); } pushMatrix(); translate(250,250); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(750,250); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(250,750); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(750,750); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(500,500); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(500,0); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(500,1000); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(0,500); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); pushMatrix(); translate(1000,500); rotate(radians(counter)); scale(counter/80); fill(215,85,125); arc(0,0, 50, 50, 0, HALF_PI); popMatrix(); counter+=speed; if (counter > width || counter<0 ) { speed = -speed; } } class dot { color c; float xpos; float ypos; float xspeed; float yspeed; float xsize; float ysize; dot(color tempC, float tempXpos, float tempYpos, float tempXspeed, float tempYspeed) { c = tempC; xpos = tempXpos; ypos = tempYpos; xspeed = tempXspeed; yspeed = tempYspeed; xsize = 30; ysize = random(250); } void display() { fill(c); //rect(xpos,ypos,20,20); rect(xpos,ypos,20-xsize,20-ysize,10); } void update() { xpos = xpos + xspeed; ypos = ypos + yspeed; if (xpos > width) { xpos = 0; } if (xpos < 0) { xpos = width; } if (ypos > height) { ypos = 0; } if (ypos < 0) { ypos = height; } } void newranspeed() { xspeed = 50 - random(6); yspeed = 50 - random(6); } void origspeed() { xspeed = sin(2); yspeed = sin(2); } } class dot2 { color c; float xpos; float ypos; float xspeed; float yspeed; float xsize; float ysize; dot2(color tempC, float tempXpos, float tempYpos, float tempXspeed, float tempYspeed) { c = tempC; xpos = tempXpos; ypos = tempYpos; xspeed = tempXspeed; yspeed = tempYspeed; xsize = random(250); ysize = 30; } void display() { fill(c); //rect(xpos,ypos,20,20); rect(xpos,ypos,20-xsize,20-ysize,10); } void update() { xpos = xpos - xspeed; ypos = ypos - yspeed; if (xpos > width) { xpos = 0; } if (xpos < 0) { xpos = width; } if (ypos > height) { ypos = 0; } if (ypos < 0) { ypos = height; } } void newranspeed() { xspeed = 50 - random(6); yspeed = 50 - random(6); } void origspeed() { xspeed = sin(2); yspeed = sin(2); } } void mousePressed() { println("changing"); frameRate(60); for (int i = 0; i < dotarray.length; i++) { dotarray[i].newranspeed(); dot2array[i].newranspeed(); } } void mouseReleased() { println("changing again"); frameRate(15); for (int i = 0; i < dotarray.length; i++) { dotarray[i].origspeed(); dot2array[i].origspeed(); } }