Inside the technology behind iOS 7's parallax effect

When iOS 7 arrives this fall, there will be plenty of new features coming our way. From a completely reimagined (if somewhat controversial) look to a new paradigm of user experience, it seems that Apple has gone all out in its attempt to reinvent the mobile operating system for the next decade.

Among these, the “parallax effect” is destined to change the way we physically interact with our mobile electronics. Through a bit of clever programming, it turns the screen into something more: a pane of glass behind which users can see a three-dimensional world that shifts and tilts alongside the device itself.

Perspective and parallax

The basic principle that makes parallax possible is a quirk in the way the human perception of size works. Because the eye works by forcing light through a single point, the brain has learned to measure the size of objects based on the apparent angle between their extremities, as measured from our pupils. As a result, objects that are nearer tend to appear larger, while things that are farther away seem smaller.

This is the basis for our perception of perspective, and parallax is simply the apparent motion that objects take when you move around them. For example, when you travel on a fast car or train, objects that are closer to you appear to move much more quickly than those that are farther away, even though it stands to reason that, in reality, everything is changing place at the same speed.

Alongside a few additional physical tricks, perspective and parallax play a very important role in the way that we understand the world around us, making it possible for us to sort out and make sense of the various visual cues that our eyes register (as well as providing photographers with the opportunity for endless fun).

The concepts of perspective and parallax are closely related: Objects that are closer tend to occupy a larger portion of our eyes' visual angle, and therefore appear to be larger and move faster than those farther away.

From rockets to phones

On iOS, the parallax effect is, of course, entirely simulated by the operating system’s software, with a little help from a technology that was originally conceived for rocket guidance.

Buried among the hardware that makes up most of Apple’s modern mobile devices is a component called a MEMS gyroscope; it contains an extremely small mechanism capable of vibrating at a known rate when subjected to an electrical charge.

When you rotate the device around any of the three angles of motion, this little marvel of human technology—smaller than a human hair—tends to resist the change in orientation because of Newton’s First Law of Motion. This allows the hardware to measure the speed and direction in which the phone or tablet is being rotated.

Working in concert with a few additional sensors called accelerometers, the gyroscope allows the device to understand the changes in its relative position with a reasonably good level of accuracy.

Starting with a good estimate of a fixed initial position, which is given by the fact that most people will tend to raise the phone to eye level when they use it, iOS can use these inputs to determine the angle between the surface of the screen and our visual plane as they move relative to each other.

Tiny sensors inside the iPhone's hardware allow iOS to tell when you rotate and move the device in any direction. Coupled with an educated guess about where you tend to keep your phone during use, this makes the parallax illusion possible.

Parallax for all

From there, the math required to provide the illusion of depth is fairly straightforward; all the software has to do is to organize its content in an arbitrary set of planes, and then move them relative to each other, based on their apparent distance from the eye. That results in a realistic depth-perception effect.

If you caught the WWDC 2013 keynote, you saw how this approach allows the home screen’s icons to appear as if they are above the background, and makes it possible for, say, Safari’s tab navigator to display a subtle three-dimensional look that shifts as you move your device.

Although the exact details of iOS 7 are still under wraps, it’s clear that Apple intends for parallax display to become pervasive throughout its operating system (which may explain why the iPhone 3GS and first-generation iPad, neither of which has built-in gyroscopes, didn’t make the OS’s compatibility list). As such, we should expect that the company will extend its availability to third-party developers as well, particularly if it has figured out a way to make it work without consuming too much battery power.

iOS 7 creates the illusion of parallax by organizing its content in multiple layers, and then animating them in response to the inputs from the device's physical sensors.

Genius or gimmick?

While many visual effects are immediately comprehensible, iOS 7’s parallax feature is one that may require a hands-on approach to truly appreciate. The various photos and videos that Apple has shown so far don’t do it justice, with the result that it seems more like a gimmick than anything else.

Once in your hands, however, the effect will give iOS’s user interface a whole new dimension—if you will—that’s difficult to describe in words: The screen goes from being a canvas on which your apps are painted to a window into a physical world, where the faux-realism of today’s mobile apps is replaced by visuals that can feel both more synthetic and more realistic at the same time.

It’s entirely possible that, once third-party developers start taking advantage of the feature, the parallax effect will start to suffer from oversaturation, as everyone tries to figure out how to make good use of it. That situation is likely to eventually stabilize, however, and—just as we have seen with previous incarnations of iOS—a whole new generation of apps will arise that use this capability to deliver a great experience in ways that we can only imagine today.