Moving the cursor up and down can change the rotation direction of the white “flower”. Moving the cursor left and right can change the canvas color and the size of the circles. If the cursor is inside the circle, the corresponding circle will change color.
sketch
var w = 20;
var x1 = 150;
var y1 = 150;
var w1 = 220;
var x2 = 400;
var y2 = 300;
var w2 = 260;
var x3 = 500;
var y3 = 75;
var w3 = 130;
var r = 30;
var g = 144;
var b = 255;
var lineY = 1000;
var angle = 10;
var dia = 15;
function setup() {
createCanvas(600, 450);
}
function draw() {
background(r, g, b);
noStroke();
r1 = 100;
g1 = 149;
b1 = 237;
fill(r1, g1, b1);
ellipse(x1, y1, w1, w1);
r2 = 100+20;
g2 = 149+20;
b2 = 237+10;
fill(r2, g2, b2);
ellipse(x2, y2, w2, w2);
r3 = 100-20;
g3 = 149-20;
b3 = 237-10;
fill(r3, g3, b3);
ellipse(x3, y3, w3, w3);
if (mouseX < width/2) {
w1 = constrain(w1-5, 150, 400); w2 = constrain(w2+5, 200, 450); w3 = constrain(w3-5, 80, 280); r = constrain(r + 0.5, 30, 60);
g = constrain(g + 0.5, 144, 174);
b = constrain(b + 0.5, 255, 275); }
if (mouseX > width/2){
w1 = constrain(w1+5, 150, 400); w2 = constrain(w2-5, 200, 450); w3 = constrain(w3+5, 80, 280); r = constrain(r - 0.5, 5, 30);
g = constrain(g - 0.5, 114, 144);
b = constrain(b - 0.5, 225, 255); }
if (dist(mouseX, mouseY, x1, y1)<w1/2){
r1 = 195;
g1 = 177;
b1 = 225;
fill(r1, g1, b1);
ellipse(x1, y1, w1, w1);
}
if (dist(mouseX, mouseY, x2, y2)<w2/2){
r2 = 189;
g2 = 181;
b2 = 213;
fill(r2, g2, b2);
ellipse(x2, y2, w2, w2);
}
if (dist(mouseX, mouseY, x3, y3)<w3/2){
r3 = 204;
g3 = 204;
b3 = 255;
fill(r3, g3, b3);
ellipse(x3, y3, w3, w3);
}
stroke(255);
noFill();
strokeWeight(1.2);
ellipse(mouseX, mouseY, w+10, w+10);
translate(mouseX, mouseY); line(0, 0, 0, lineY); ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle)); line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle)); line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 40, dia); ellipse(0, 100, dia+10);
rotate(radians(angle));
line(0, 0, 0, lineY);
ellipse(0, 60, dia); ellipse(0, 130, dia+20);ellipse(0, 200, dia+40);
if (mouseY < height/2) {
angle = constrain(angle + 0.5, -10, 20);
}
if (mouseY > height/2){
angle = constrain(angle - 0.5, -10, 20);
}
}