3D Coverflow for iPhone Using CSS-VFX

Charles Ying has created a  collection of components and code examples that illustrate the power of CSS visual effects on the iPhone. Officially named CSS-VFX, the project has yielded it’s first very cool little web app called Zflow.

Zflow uses Javascript and CSS transforms and animations to emulate the Apple’s native coverflow. It starts by loading each image from the an array, scales them to fit in a square region, and applying 3D CSS transforms to scale it in place. To add the reflections, Zflow creates a Canvas element that contains a gradient alpha mask for each image (using a “reflect” function to do this) and positions the canvas element in place. A TouchController object fields touch events from Mobile Safari and calculates the appropriate offset.

When you click on an image, Zflow zooms + rotates the focused image forward by setting a “CSS Transitioned” 3D transform on the focused image. Clicking again transitions the image back.

When sliding through the image set, Zflow achieves inertia by setting the “transition timing function” of the “tray” to an “ease-out” function, which slows things down. On the touch end event, the projected velocity is calculated and sets the tray’s target position to that location. CSS Transitions handles the decay in velocity as the transition timing function executes — slowing the tray down gradually.

It really is a beautiful piece of work. For those who are not browsing with an iPhone/iTouch, check out the video:

Check out a simple demo (iPhone/iTouch only) here

See Charles’ demo using the Flickr API (iPhone/iTouch only) here

Download the source here

Was this article helpful?
YesNo
About S. Santos

I am a tech columnist and blogger by trade, but I'm also an avid tennis player. In my spare time, I enjoy reviewing gadgets and gizmos from the world of tech.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.