Created
June 28, 2013 22:15
-
-
Save jabubuck/5888575 to your computer and use it in GitHub Desktop.
Small snippet that will rotate through a selection of colors. For titanium iOS and Android
This file contains 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