Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Want to pause the rotation on a button click. Is there any solution?

$
0
0

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();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>