sketch
var nPoints = 100;
function setup() {
createCanvas(400, 400);
frameRate(60);
}
function draw() {
background(0);
translate(width / 2, height / 2);
var a = 150; //for function
var b = 25;
var h = 25;
fill(256, 256, 0);
push();
beginShape();
for (var i = 0; i < nPoints; i++) { //draw the curves
var t = map(i, 0, nPoints, 0, TWO_PI);
var x = (a - b) * cos(t) + h * cos(t * (a - b) / b); //use these functions
var y = (a - b) * sin(t) - h * sin(t * (a - b) / b);
vertex(x + random(-1, 1), y + random(-1, 1)); //wiggle
if (mouseX > width / 2 & mouseY > height / 2) { //2nd quadrant
fill(256, 0, 256)
b = 50;
h = 50;
}
if (mouseX < width / 2 & mouseY < height / 2) { //3rd quadrant
fill(256)
b = 10;
h = 10;
}
if (mouseX > width / 2 & mouseY < height / 2) { //4th quadrant
fill(0, 256, 256)
b = 15;
h = 15;
}
}
endShape(CLOSE);
pop();
}