Created
          April 16, 2015 13:03 
        
      - 
      
 - 
        
Save rajubd49/e6f9aff28099e12a1d40 to your computer and use it in GitHub Desktop.  
    How to rotate through a selection of colors - Appcelerator Titanium
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var win = Ti.UI.createWindow({ | |
| fullscreen: true, | |
| backgroundColor: 'blue', | |
| }); | |
| setInterval(function(){ | |
| var backColor = win.backgroundColor; | |
| if(backColor == 'blue'){ | |
| win.animate({backgroundColor: 'purple', duration: 1500}); | |
| win.backgroundColor = 'purple'; | |
| }; | |
| if(backColor == 'purple'){ | |
| win.animate({backgroundColor: 'red', duration: 1500}); | |
| win.backgroundColor = 'red'; | |
| }; | |
| if(backColor == 'red'){ | |
| win.animate({backgroundColor: 'orange', duration: 1500}); | |
| win.backgroundColor = 'orange'; | |
| }; | |
| if(backColor == 'orange'){ | |
| win.animate({backgroundColor: 'yellow', duration: 1500}); | |
| win.backgroundColor = 'yellow'; | |
| }; | |
| if(backColor == 'yellow'){ | |
| win.animate({backgroundColor: 'green', duration: 1500}); | |
| win.backgroundColor = 'green'; | |
| }; | |
| if(backColor == 'green'){ | |
| win.animate({backgroundColor: 'blue', duration: 1500}); | |
| win.backgroundColor = 'blue'; | |
| }; | |
| backColor = win.backgroundColor; | |
| }, 2000); | |
| win.open(); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment