xxxxxxxxxx
int status = 1; //mouse press
int x = 1; //frames
float h = 120; //hue
float r = 1; //radius
void setup() {
size(800, 600);
frameRate(30);
colorMode(HSB, 360, 100, 100, 100);
noStroke();
r = height/2; //adjust radius
}
void draw() {
x++;
if (mousePressed== true) {
status = 0;
} else {
status = 1;
}
if (status==1) {
background(0, 0, 95);
h = h + 0.5; //cycling colors
if (h > 360) {
h = 1;
}
fill(h, 40, abs((30*mouseY/height)-90)); //brightness control
ellipse(width/2, height/2, r+(sin(x/15)-0.5)*8, r-(sin(x/15)-0.5)*8);
} else {
if (x % 5 == 1) {
background(0, 0, 100, 20);
fill(0, 0, 0);
ellipse(width/2, height/2, r, r);
} else {
background(0, 0, 0);
fill(random(0, 360), 100, 100);
ellipse(width/2 + random(-width/15, width/15), height/2 + random(-height/15, height/15), r, r);
fill(0, 0, 100);
ellipse(width/2, height/2, r, r);
}
}
}