Subnavigation

Parallax sliding

Quite popular in 80's side-scrolling games, parallax scrolling is a simple trick which employed to give the illusion of depth. Back then, the graphics power of the computer was not advanced enough to have a technically corect 3-D effect. Parallax scrolling is cheap, and yet often it makes a big difference to the gameplay. The technique itself is a simple as it could be: have two or more layers that move at different speeds.

Parallax scrolling makes a comeback in the home screen of Android. Careful owners of T-Mobile G1 will spot the effect immediately once playing with the home screen. At Qt Developer Days in Redwood City a couple of days ago, I showed a simple GraphicsView-demo example that shows this parallax scrolling. As I promised it back then, and for those who attended Munich Developer Days (this demo did not exist yet at that time), here I showed it again as a Graphics Dojo example:

svn checkout svn://labs.trolltech.com/svn/graphics/dojo/parallaxslide
cd parallaxslide && qmake && make && ./parallaxslide

The obligatory screencast follows. You can also watch it on YouTube or blip.tv or get the 4.2 MB Ogg Theora video.

Minor update: I applied a patch from Enrico Ros that fixes "randomly invisible icons" problem.  Thanks, Enrico!


Blog Topics:

Comments