Hello. I am working on a school project. I am trying to control the radius value of 3 ellipses using the mousePressed function and the “dist()” thingy.
//references
float popDRed = dist(balloonRedX, balloonRedY, mouseX, mouseY);
float popDBlue = dist(balloonBlueX, balloonBlueY, mouseX, mouseY);
float popDGreen = dist(balloonGreenX, balloonGreenY, mouseX, mouseY);
//pop red balloon on click
void mousePressed() {
if ((mouseX-popDRed<balloonRadiusRed) && (mouseY-popDRed<balloonRadiusRed)) {
balloonRadiusRed = 0;
mouthAngleOne = 180; //changes to mouth shape
mouthAngleTwo = 360;
mouthYvalue = height/2-290;
mouthXvalue = width/2;
mouthWidth = 40;
mouthHeight = 10;
}
//pop blue balloon on click
void mousePressed() {
if ((mouseX-popDBlue<balloonRadiusBlue) && (mouseY-popDBlue<balloonRadiusBlue)) {
balloonRadiusBlue = 0;
mouthAngleOne = 180; //changes to mouth shape
mouthAngleTwo = 360;
mouthYvalue = height/2-290;
mouthXvalue = width/2;
mouthWidth = 40;
mouthHeight = 10;
}
//pop green balloon on click
void mousePressed() {
if ((mouseX-popDGreen<balloonRadiusGreen) && (mouseY-popDGreen<balloonRadiusGreen)) {
balloonRadiusGreen = 0;
mouthAngleOne = 180; //changes to mouth shape
mouthAngleTwo = 360;
mouthYvalue = height/2-290;
mouthXvalue = width/2;
mouthWidth = 40;
mouthHeight = 10;
}
//else {
// balloonRadiusRed = balloonRadius;
// mouthAngleOne = 0;
// mouthAngleTwo = 180;
// mouthYvalue = height/2-300;
// mouthXvalue = width/2;
// mouthWidth = 40;
// mouthHeight = 30;
//}
}
The full code can be found here in case anyone wants to try the code out:
Somewhat Working Version: v8 - Google Docs
Current Version: v10 - Google Docs
I am a total noob to Processing 3. I am a UX person doing a design course so I’m not familiar with platforms like CodePen. I have shared it via Google Docs.
I am trying to pop the balloons in the hands of the snowman individually on the click of a mouse.
Did I miss anything? Thanks in advance!