Question: Modify your solution to Q1 such that the diameter of the circle grows and shrinks depending on the distance of the mouse pointer to the center of the circle. Hints: You’ll need the dist() function and the multiplication * operator for this one.
Code:
<
let growthDistance= 0 * 0
function setup() {
createCanvas(400,400);
}
function draw() {
background(220);
//Change growth of Ellipse by mouse pointer
ellipse(200,200,mouseX +50,mouseY+50);
growthDistance= dist(200,200,mouseX +50,mouseY +50)
}
Problem: I cannot figure out how to change the ellipse size with the mouse cursor without making the ellipse change size in both directions rather than just having the size change without it moving like crazy