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 = e.source.backgroundImage; imageViewFace.visible = true; imageViewMe.visible = true; //create the first transform var transform1 = Ti.UI.create2DMatrix(); transform1 = transform1.rotate(-180); transform1 = transform1...