Snow Stack is Here
Saturday, July 11th, 2009What is Snow Stack?
A new 3D CSS Visual Effects demo using pure HTML, WebKit’s 3D CSS Effects extensions and JavaScript.
You can now see Snow Stack’s live demo if you have Snow Leopard and Safari. On Leopard, you can use WebKit nightly build 45754 or later for a slightly slower experience.
Instructions
Click here to open the Snow Stack live demo. Arrow keys to move, “Space” to toggle magnify mode. Mouse click on an image to view on Flickr. You need to “right arrow” on the right wall to get more photos loaded in.
Many thanks to Simon Fraser for his help with performance profiling Snow Stack.
And yes, OS X Leopard with WebKit nightly will also do accelerated 3D transforms now, just like iPhone Safari.
Implementation Notes
- Larger images load in after 2 seconds for high quality zoomed images.
- State changes are handled via CSS.
- Reflections use CSS masks instead of a Canvas draw (standard box reflections don’t quite work yet).
- Reflections sit on a scaleY(-1.0) coordinate system and are tracked independently, which is surprisingly easy.
- This demo pushed a few performance limits and currently avoids drawing and animating a drop shadow and border.
- Animating transforms with a transform list must have only 1 function to animate in hardware.
- Snow Stack’s 3D transforms, transform and opacity animations all run on the GPU. Layout and networked image loading happens on the CPU.
- Key states are tracked manually (timers handle keyboard delay and repeats) so a smooth motion can be achieved when the keys are held down.
- Cell sizes are chosen at initial window load time and don’t change on window resize, although the origin does. It’s rather slow, however, so I may end up changing that.
- The computedStyle transform matrix is used to calculate how far away the dolly is from the target image, which is then used to assign a scaled rotation to the “camera”. Ideally, this might be done a different way, but the results are pretty good, and fast.
- To give you a sense of the effort involved, this demo was written over 3 days, a few hours each evening.
- Snow Stack’s source code is now available from the CSS-VFX project.
Other CSS Visual Effects Demos
Updates and iPhone Apps
- Snow Stack’s source code (with examples on how to use your own images) is now available from the CSS-VFX project.
- I also work on iPhone apps in my spare time, if you have a moment, please check out my iPhone app, iRhyme, a song writer’s rhyming dictionary.
- The song in the video (a surprisingly frequent question) is Ratatat – “Beat 1” from their demo album “9 Beats”
Technorati Tags: WebKit, Snow Leopard, Leopard, Mac OS X, graphics, 3D, CSS Effects, HTML, JavaScript