I am looking for the program to continously look for the variable and draw, however it keeps drawing over itself. How do I get the previous draw data/images to clear for each draw loop?
Code:
//Global Variables//
int Width=800;
int Height=800;
int I=80;
int J=100;
int K=200;
int Z=250;
void setup() {
size(Width, Height);
background(100,100, 100);
}
void draw() {
int I=mouseX;
int J=mouseY;
int Xone =Width/2;
int Yone = Height/2-I;
int Xtwo = (Width/2)-J;
int Ytwo = Height/2;
int Xthree =Width/2;
int Ythree = Height/2+K;
int Xfour = Width/2+Z;
int Yfour = Height/2;
{
ellipseMode(RADIUS);
noFill();
stroke(252,0,0);
ellipse(width/2, height/2, I, I);
stroke(0,252,0);
ellipse(width/2, height/2, J, J);
stroke(0,0,252);
ellipse(width/2, height/2, K, K);
stroke(0,0,0);
ellipse(width/2, height/2, Z, Z);
}
{
stroke(255,255,255);
beginShape();
curveVertex(Xone, Yone);
curveVertex(Xtwo, Ytwo);
curveVertex(Xthree, Ythree);
curveVertex(Xfour, Yfour);
curveVertex(Xone, Yone);
endShape();
beginShape();
curveVertex(Xtwo, Ytwo);
curveVertex(Xthree, Ythree);
curveVertex(Xfour, Yfour);
curveVertex(Xone, Yone);
curveVertex(Xtwo, Ytwo);
endShape();
beginShape();
curveVertex(Xthree, Ythree);
curveVertex(Xfour, Yfour);
curveVertex(Xone, Yone);
curveVertex(Xtwo, Ytwo);
curveVertex(Xthree, Ythree);
endShape();
}
{
noFill();
ellipseMode(CENTER);
stroke(252,0,0);
ellipse(Xone, Yone, 10,10);
stroke(0,252,0);
ellipse(Xtwo, Ytwo, 10,10);
stroke(0,0,252);
ellipse(Xthree, Ythree, 10,10);
stroke(0,0,0);
ellipse(Xfour, Yfour, 10,10);
}
delay(10);
fill(255,255,255);
ellipse(1000,1000,10,10);
}