The above video demonstrates an experiment I did in an attempt to reproduce the illusionary 3D Parallax effect on a 2D plane using flat images. Its just for fun really. I saw the video of this effect for iOS7 and I was asking myself if I could reproduce it using only sprites.
I knew I had to work with the gyroscope, thus the need to implement the Core Motion framework from the iPhone SDK. Once I was able to read the live pitch/roll/yaw variables of the gyroscope, I used those variables to manipulator the position of my onscreen objects.
These objects(sprites) were each placed on a different layer, and as the gyro variables changes, I move the different layers at different speed (both positive and negative). Since I’m not good with calcu-frogking-lus, I create variables I can tweak to change the speed of each layer. After that I just tune those variables until the desired effect was achieved.
I’m sure with the right math, a more convincing result can be achieved, but hey, I did what I wanted to, time to move on.
Oh yes, this was done in cocos2d also.
-ed