O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required