O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

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

Animating a view using 2D Matrix and 3D Matrix transformations

You may have noticed that each of our ImageViews in the previous recipe had a click event listener attached to them, calling an event handler named setChosenImage.

This doesn't exist, so you get an error if you click an image. Let's fix that. This event handler will handle setting our chosen funny face image to the imageViewFace component, before animating the four funny face ImageView selectors out of screen using a number of 2D and 3D Matrix transforms.

How to do it…

Replace the empty setChosenImage function at the bottom of the app.js file with the following code:

//this function sets the chosen image and removes the 4 //funny faces from the screen function setChosenImage(e) { imageViewFace.image ...

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