Scaling an image by applying animations

In the previous recipe, you learned how to apply a simple rotation transformation to rotate an image, but Safari Mobile allows us to create more sophisticated transformations and effects with a few lines of CSS and JavaScript. This recipe shows you how to create a simple animation for scaling a picture.

Our goal will be to display an image, as you have learned in previous recipes, then scaling using a 0.2x factor through an animation. Actually, the animation applies the transformation with a time delay for a visual effect. The animation will start when the user clicks on the picture.

Getting ready

Just for simplicity, we're going to use the iWebKit framework one more time. However, no specific framework is ...

Get iPhone JavaScript Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.