Error message

  • Notice: Undefined index: meta_name in metatags_quick_field_formatter_view() (line 374 of /var/www/
  • Notice: Undefined index: metatags_quick in metatags_quick_field_formatter_view() (line 375 of /var/www/

Parallax Effect

A parallax effect is, as Wikipedia describes, a displacement or difference in the apparent position of an object viewed along two different lines of sight.  Checkout some cool samples!

For a project I'm working on, I needed such an effect for their iPad app.  As I normally do, I tried looking for available components, though the only references I found were pointing towards Cocos2D (OpenGL) which seemed a bit overkill just to have the parallax effect.

So I made my own implementation, based on a few UIScrollViews. Nothing extraordinary, but nevertheless a nice effect. This is the general idea:

  • disable all but 1 UIScrollView (main)
  • define the scrollratio of the other UIScrollViews (slaves)
  • implement the main UIScrollView delegate (especially scrollViewDidScroll) and adapt the slaves' UIScrollView contentPosition's as a factor of the main's contentPosition.

You can grab a copy of my sample project to see how I implemented it.