We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
redrawn? (Read 650 times)
redrawn?
Nov 22nd, 2009, 4:22pm
 
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);

}
Re: redrawn?
Reply #1 - Nov 22nd, 2009, 4:24pm
 
call background also at the beginning of draw to clear the screen

interesting, what is it ?
Re: redrawn?
Reply #2 - Nov 22nd, 2009, 4:34pm
 
doh! Thank you so much!!

Its the beginnings of an interactive art piece. For a part of it there will be 4 distance sensors measuring spectators distances to the piece (on the +/-x and +/- y plane) What you are looking at in the above code would be the birds-eye view of that.

Part of the piece will include a television showing just the "amorphous" shape created by the curveVertex functions.

Hope this helps. The piece is due in 3 weeks so I'll post something to the exhibition in a few days.

Thanks again... sorry for such a stupid question.
Re: redrawn?
Reply #3 - Nov 22nd, 2009, 5:47pm
 
nevermind Smiley looking forward to see some documentation soon
Page Index Toggle Pages: 1