We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm brand new to processing and I'm stumped. I'm trying to make my program draw the image three times and then close the window without pressing anything on the keyboard or mouse. I've tried using loop() and noLoop() but I feel like I just don't understand the program enough to use them correctly. Any help would be greatly appreciated!
Answers
Loop and noLoop aren't for that.
I would use frameCount in a condition... Something like
If framecount % 120 < 60 then draw image
If framecount > 360 then exit
Check % in the reference to see how this works.
Post your attempt.
maybe you can tell a bit more what you want.
or show your code.
draw() runs 60 times per second. So when in this sense you want to show the image 3 times, it would be over soon... and you won't see a thing.
or do you mean an image that flashes 3 times?
Basically, I have three ellipses overlapping that are different colours. The ellipses gradually appear and once they reach full colour a crosshair appears in the centre, they vanish and start to reappear again. I'm trying to get them to appear three times and then the window closes on its own.
@emburke -- you should definitely share your code -- this will make it much easier to help you.
I've created a simplified version of my code as I can't seem to be able to post the original code here nicely. I hope this helps.
Edit post, highlight code, press Ctrl-o
Thanks
You should add a new variable that counts how many times you've reached the if(iAlpha>255) condition. Once this counter hits three, you can call exit() to quit your sketch
Lines of code you will need to add:
And:
And:
The window didn't close, and the code just kept running. Does counter++; go after the if statement?
Nevermind, I put it somewhere else and it worked! THANK YOU!!