Rotate an image for a specific angle in iPhone app using Titanium.
|
We can rotate any image for a specific angle using titanium. Let say we have an image and I need to rotate it to 180. So here is the code to do that described below.
|
Code Block : //Define the current window var myWin = Ti.UI.currentWindow; //Define the Image var myImg = Ti.UI.createImageView({ width : 50, //Describes the width height : 50 //Describes the height }); //Set the image for the image view myImg.backgroundImage = "Test_Image_Path"; //Add the image to the current window myWin.add(myImg); //Create the transformation var imgTransform = Ti.UI.create2DMatrix().rotate(180); //Defines the Animation var myAnimation = Ti.UI.createAnimation({ transform : imgTransform, //Transform property to change during animation duration : 800 //Duration for the animation in millisecond }); //Show the animation effect. myImg.animate(myAnimation);