My blog has been moved to ariya.ofilabs.com.

Monday, November 03, 2008

Android-like parallax sliding

At Redwood City Qt Developer Days (also where, BTW, a bunch of KDE geeks made a funny group photo), I started a tradition: throw an idea for a demo and I will implement it for the talk. The challenge for my graphics talk was the subtle effect in the Android's home screen. We saw T-Mobile G1 the night before and recalled again the good old games in the eighties. So the next morning I waked up earlier both to rehearse my talk (again) and to implement this parallax sliding. It turned out to be almost trivial to implement (200 lines of code) so just check it out!

For the lazy, do enjoy the screen capture below, or see also the screencast on YouTube or blip.tv or just grab the Ogg Theora video (4.2 MB).

Happy parallaxing!

4 comments:

Janne said...

THis reminds me of something I suggested 3.5 years ago :). Well, apaprently "Mr. Fantastic" was also involved:

http://markmail.org/message/vy5sjbyfuocsrdqg

Unknown said...
This comment has been removed by the author.
Unknown said...

Very cool. I happened to see your post on this a while ago (my company just started porting several products to Qt).

I got interested and used this as an excuse to play with proce55ing. My implementation is much less polished... :)

Anonymous said...

Hi Ariya,

Cool feature. Qt rocks.
I used your code in Qtopia and was able to do it except 1 issue. I used a jpg image of (720X320) and set the sizeof the Graphics view as
240X320 (as in your code). And then called the Graphics from the MainWidget and showed it as:

ParallaxSlide* slide = new ParallaxSlide;
slide->show();

The image is scaled down to less than 240X320. That is, it fills only 3/4th of the screen. In Qt, it comes properly. What am i missing?