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 › scrolling a background image...
Page Index Toggle Pages: 1
scrolling a background image... (Read 504 times)
scrolling a background image...
Mar 9th, 2006, 9:10am
 
Hi all,
I'm completely new to processing and programming in general. What I need to do is scroll a background image, left and right, depending on mouse movement. The background image would need to tile seamlessly, so once a column of pixels leaves the left hand side of the screen it appears on the right, and vice versa.
I'm not too sure what the best approach is, i.e should I even been attempting to translate an background image? Is it better to use PImage?
If someone can get me started in the right direction I'd be grateful.
Thanks, Jeppe
Re: scrolling a background image...
Reply #1 - Mar 9th, 2006, 11:39am
 
You can use PImage.

First, draw the image on your screen. Next, draw the image again to the right of the image. So now there are two of the exact same images side by side (the other one might be completely off the screen).

Next, you do a few tests. If the your screen translation engulfs the other image (the other image is no longer visible, since it drops off the screen), the place the image of the one that fell off the screen to the opposite side, so as to "catch up" with the screen.

I'm not sure if that's clear enough. I kinda botched the wording. Tired, and all :]
Re: scrolling a background image...
Reply #2 - Mar 9th, 2006, 8:58pm
 
Thanks for your reply... I took a similar approach and its working now.
Page Index Toggle Pages: 1