Apple has created a series of specifications for performing two-dimensional transforms via CSS, as well as animating those transforms over time. The Safari 4 beta highlights some of these CSS-based transforms, along with Safari’s support for HTML 5’s video and audio tags, in the “welcome page” that’s loaded on Safari 4 beta’s first launch. But flying much lower under the radar is an addition to Apple’s CSS Transforms that gives web app developers some powerful 3D graphics capabilities—so long as that web app is made for an iPhone.
The WebKit team added CSS Transforms to nightly builds of WebKit back in October 2007, transforms that included scaling, rotation, skewing, and translation in 2D space. As the specification matured, 3D and animation capabilities were added. Eventually, the 3D transforms were broken out into a specification of their own. Though WebKit has had these 3D transform capabilities for some time, only Mobile Safari on the iPhone and iPod touch has them enabled. Currently, neither Safari 3.2, Safari 4 beta, nor WebKit nightly builds can take advantage of these advanced 3D transforms.
The 3D transforms, it should be noted, only apply to 2D elements. However, the transforms allow a web developer to translate, scale, rotate, skew, and change the perspective of almost any DOM element in 3D space, resulting in some rather spectacular effects. Below are two examples—provided by Apple on the Mobile section of its Safari Dev Center site—loaded in iPhone Simulator.
Though many of the 2D transforms and animations are possible to replicate with JavaScript, and Mozilla is experimenting with some JavaScript-based 3D effects, WebKit’s CSS transforms offer a serious performance advantage.

Loading comments...