my method is not applicable for my arguments?
in
Programming Questions
•
2 years ago
I am trying to build a square that collapses in on itself. I have used beginShape as the means of building a square that when a mouse is pressed will fold its corners down to the center, that is the goal.
I have a button created that when pressed is supposed to create a number of iterators in the draw loop which pull the corners in slowly right now.
i am getting an error that my arguments are not applicable to my method and i could use some clarity as to how to build this function so that when the mouse is pressed the corners converge ... i will take care of stopping them at the center later but if you could help me bring the corners in i would appreciate it.
float x1 = 25;
float x2 = 250;
float x3 = 475;
float x4 = 475;
float x5 = 475;
float x6 = 250;
float x7 = 25;
float x8 = 25;
float y1 = 25;
float y2 = 25;
float y3 = 25;
float y4 = 250;
float y5 = 475;
float y6 = 475;
float y7 = 475;
float y8 = 250;
boolean square = true;
void setup() {
size(500,500);
}
void draw() {
mousePressed();
squareText();
verticeSquare();
}
void squareText(float x1, float y1,float x2, float y2,float x3, float y3,float x4, float y4, float x5, float y5,float x6, float y6,float x7, float y7,float x8, float y8){
if (square) {
float x1 = 25;
float x2 = 250;
float x3 = 475;
float x4 = 475;
float x5 = 475;
float x6 = 250;
float x7 = 25;
float x8 = 25;
float y1 = 25;
float y2 = 25;
float y3 = 25;
float y4 = 250;
float y5 = 475;
float y6 = 475;
float y7 = 475;
float y8 = 250;
} else {
float x1 = x1 + 1;
float x2 = 250;
float x3 = x3 - 1;
float x4 = 475;
float x5 = x5 - 1;
float x6 = 250;
float x7 = x7 + 1;
float x8 = 25;
float y1 = y1 + 1;
float y2 = 25;
float y3 = y3 + 1;
float y4 = 250;
float y5 = y5 - 1;
float y6 = 475;
float y7 = y7 - 1;
float y8 = 250;
}
}
void verticeSquare() {
fill(0);
beginShape();
vertex(x1,y1);
vertex(x2,y2);
vertex(x3,y3);
vertex(x4,y4);
vertex(x5,y5);
vertex(x6,y6);
vertex(x7,y7);
vertex(x8,y8);
endShape(CLOSE);
}
void mousePressed() {
if (mouseX > x1 && mouseX < x3 && mouseY > y1 && mouseY < y4) {
square = !square;
}
}
I have a button created that when pressed is supposed to create a number of iterators in the draw loop which pull the corners in slowly right now.
i am getting an error that my arguments are not applicable to my method and i could use some clarity as to how to build this function so that when the mouse is pressed the corners converge ... i will take care of stopping them at the center later but if you could help me bring the corners in i would appreciate it.
float x1 = 25;
float x2 = 250;
float x3 = 475;
float x4 = 475;
float x5 = 475;
float x6 = 250;
float x7 = 25;
float x8 = 25;
float y1 = 25;
float y2 = 25;
float y3 = 25;
float y4 = 250;
float y5 = 475;
float y6 = 475;
float y7 = 475;
float y8 = 250;
boolean square = true;
void setup() {
size(500,500);
}
void draw() {
mousePressed();
squareText();
verticeSquare();
}
void squareText(float x1, float y1,float x2, float y2,float x3, float y3,float x4, float y4, float x5, float y5,float x6, float y6,float x7, float y7,float x8, float y8){
if (square) {
float x1 = 25;
float x2 = 250;
float x3 = 475;
float x4 = 475;
float x5 = 475;
float x6 = 250;
float x7 = 25;
float x8 = 25;
float y1 = 25;
float y2 = 25;
float y3 = 25;
float y4 = 250;
float y5 = 475;
float y6 = 475;
float y7 = 475;
float y8 = 250;
} else {
float x1 = x1 + 1;
float x2 = 250;
float x3 = x3 - 1;
float x4 = 475;
float x5 = x5 - 1;
float x6 = 250;
float x7 = x7 + 1;
float x8 = 25;
float y1 = y1 + 1;
float y2 = 25;
float y3 = y3 + 1;
float y4 = 250;
float y5 = y5 - 1;
float y6 = 475;
float y7 = y7 - 1;
float y8 = 250;
}
}
void verticeSquare() {
fill(0);
beginShape();
vertex(x1,y1);
vertex(x2,y2);
vertex(x3,y3);
vertex(x4,y4);
vertex(x5,y5);
vertex(x6,y6);
vertex(x7,y7);
vertex(x8,y8);
endShape(CLOSE);
}
void mousePressed() {
if (mouseX > x1 && mouseX < x3 && mouseY > y1 && mouseY < y4) {
square = !square;
}
}
1