var window = Titanium.UI.createWindow({ backgroundColor:'#47a', exitOnClose: true }); var image = Titanium.UI.createImageView({ image:'google_contacts.png', backgroundColor:'transparent', height:'auto', width:'auto', top:40 }); // Spin animation for image var t = Ti.UI.create2DMatrix(); var spin = Titanium.UI.createAnimation(); t = t.rotate(180); spin.transform = t; //-- Rotate Button var rotateBtn = Ti.UI.createButton({ title:'Rotate', width:100, height:35, top:15 , backgroundColor:'white', color:'black' }); //-- Rotate Button var pauseBtn = Ti.UI.createButton({ title:'Pause', width:100, height:35, bottom:15 , backgroundColor:'white', color:'black' }); rotateBtn.addEventListener('click',function(e){ image.animate(spin); }); rotateBtn.addEventListener('click',function(e){ image.animate(spin); }); window.add(image); window.add(rotateBtn); window.add(pauseBtn); window.open();
↧
Want to pause the rotation on a button click. Is there any solution?
↧