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 › constraining pixel locations
Page Index Toggle Pages: 1
constraining pixel locations (Read 422 times)
constraining pixel locations
Feb 26th, 2010, 10:02am
 
This is a continuation from my last post (http://processing.org/discourse/yabb2/num_1267071604_.html And I was wondering, if there is any way that when the program is run, if I could constrain the location of the pixels to say just the bottom of the screen to kind of make it so that the pixels rise from the bottom of the screen and form an image, as opposed to just coming in from all the space around you I've been able to make it so it's constrained at the bottom of the screen, like constrain(y, height/2, height); but i don't want it to cut off the image, I just wanted all the 'particles' at the bottom of the screen then have the image be put together in the center of the screen still. thanks for any help~
Re: constraining pixel locations
Reply #1 - Feb 26th, 2010, 10:27am
 
Hey, here is a functioning version of the link, for those interested:
http://processing.org/discourse/yabb2/num_1267071604.html

Also, you can reply to your original post, and the thread will pop to the top of the queue -- a good way to keep relevant threads together and keep clutter down.

As far as how to make the image rise from the bottom, I would create a random scattering of points with a Y value greater than the height of the applet, but keep the X values correct, and track each point, probably in a 2D array[][] of PVectors or similar class of your own construction.  Then, you can easily move each point upward until it's in the right Y position.
Re: constraining pixel locations
Reply #2 - Feb 26th, 2010, 11:01am
 
Oh, i see what you mean. Ok, i'll try that now and see if i can get it to work; but hwy is it that the y value would be greater than the height of the window i'm using? (640x480)
Re: constraining pixel locations
Reply #3 - Feb 26th, 2010, 12:08pm
 
Actually I take it back about the 2D array, that isn't necessary ... an array would be fine...

If you render offscreen, say, "rect(6000,6000,50,50);" it'll perform the task -- you just won't see anything.
Page Index Toggle Pages: 1