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.
IndexProgramming Questions & HelpSyntax Questions › How to delete a shape
Page Index Toggle Pages: 1
How to delete a shape? (Read 833 times)
How to delete a shape?
Nov 27th, 2009, 6:57pm
 
I'm new to Processing and am curious as to how you delete a shape once you've created it...

For example, say I have this simple loop in draw():

for(i  = 0; i < 10; i ++) {
   ellipse(random(100), random(100), 50, 50);
}

How would I delete the ellipse after it's created so that I only see one on the canvas at any given time?

Thanks in advance.

T
Re: How to delete a shape?
Reply #1 - Nov 27th, 2009, 7:10pm
 
there is nothing like deleting... think of it as a canvas where you draw something. if you dont want it anymore. draw something above it...
but in this case it doesnt work because what you see on the screen is everything that happens during one draw loop. so if you draw some ellipses in a for loop you will always see all of them.
for what you want, move the ellipse outside the for loop and simply put it in your draw. call background at the beginning of draw to clear the screen.
Re: How to delete a shape?
Reply #2 - Nov 27th, 2009, 7:35pm
 
Thank you. This helps a lot.

T
Page Index Toggle Pages: 1