xxxxxxxxxx
// mouse click
// sin, cos, ellipse, circle, boolean, random, PI
float incr;
boolean isCW;
Circle c1, c2, c3, c4;
color col1, col2, col3, col4;
void setup() {
size(500, 500);
noFill();
colorMode(HSB, 360, 100, 100, 100);
isCW = true;
setCircles();
}
void draw() {
background(350);
translate(width/2, height/2);
c1.drawCircle();
c2.drawCircle();
c3.drawCircle();
c4.drawCircle();
if (isCW) incr += .006;
else incr -= .006;
}
void setCircles() {
float h = random(360);
c1 = new Circle(random(250, 300), random(PI), random(1, 25), color(h, random(50, 100), random(50, 100)));
c2 = new Circle(random(250, 300), random(PI), random(1, 15), color(h, random(50, 100), random(50, 100)));
c3 = new Circle(random(250, 300), random(PI), random(1, 10), color(h, random(50, 100), random(50, 100)));
c4 = new Circle(random(250, 300), random(PI), random(1, 5), color(h, random(50, 100), random(50, 100)));
}
void mousePressed() {
isCW = !isCW;
setCircles();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
class Circle {
float sze, x, y, ang, strkwt;
color col;
Circle(float s, float a, float sw, color c) {
sze = s;
ang = a;
strkwt = sw;
col = c;
};
void drawCircle() {
rotate(ang);
x = cos(incr) * 50 ;
y = sin(incr) * 20 ;
strokeWeight(strkwt* 1.5);
stroke(col, 25);
ellipse(x, y, sze, sze);
strokeWeight(strkwt);
stroke(col);
ellipse(x, y, sze, sze);
};
}