FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   A clear function?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: A clear function?  (Read 329 times)
mdipi


A clear function?
« on: Nov 18th, 2003, 12:07am »

here is my code:
 
void setup()
{
size(300,300);
}
void loop()
{
fill(205,205,0);
ellipseMode(CENTER_DIAMETER);
ellipse(mouseX,30,30,30);
}
 
 
now this works great and all but it 'lags' in otherwords it leaves a trail of the previous circle there, is there a way thati can clear that circle so that its only the one cirlce moving?
 
Thanks!
Mike
 

proce55ing
flight404

WWW Email
Re: A clear function?
« Reply #1 on: Nov 18th, 2003, 1:02am »

Check out the 'background()' method.  Think that is what you need.
 
r
 
mdipi


Re: A clear function?
« Reply #2 on: Nov 18th, 2003, 1:49am »

Sweet. Yeah i just threw that in the loop and works like a charm
 

proce55ing
Jerronimo

WWW
Re: A clear function?
« Reply #3 on: Nov 18th, 2003, 4:02pm »

and if you want the older stuff to fade out, try drawing a rectangle with a very low alpha value like such:
 
Code:
  fill( 0 );
  noStroke();
  rect( 0, 0, width, height, 10 );
 
flight404

WWW Email
Re: A clear function?
« Reply #4 on: Nov 19th, 2003, 8:25pm »

I think you meant to put the '10' in the fill method.
 
rect() takes four parameters, I think, unless this is an undocumented way to fill a rect.
 
fill(0, 10);  will set the fill to black with an opacity of 10
 
 
Jerronimo

WWW
Re: A clear function?
« Reply #5 on: Nov 19th, 2003, 8:36pm »

crap.  yeah.  that's what i meant to do.
 
Man... 0 for 2 so far.  
 
I suck.
 
fry


WWW
Re: A clear function?
« Reply #6 on: Nov 20th, 2003, 4:32am »

hm, i wonder if we oughta change background() to clear() now that it has to be called explicitly.. though clear(BImage image) is a little weird..
 
mKoser

WWW Email
Re: A clear function?
« Reply #7 on: Nov 24th, 2003, 11:39am »

naa.... i like background, i think it makes sense.
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
Pages: 1 

« Previous topic | Next topic »