Created
April 16, 2015 13:18
-
-
Save rajubd49/b42598fe38ad141cb1a9 to your computer and use it in GitHub Desktop.
Image Slideshow - 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(); | |
var loaderImage = Ti.UI.createImageView({ | |
width:150, | |
height:150 | |
}); | |
// set the length of the images you have in your sequence | |
var loaderArrayLength=3; | |
// initialize the index to 1 | |
var loaderIndex=1; | |
// this function will be called by the setInterval | |
function loadingAnimation(){ | |
// set the image property of the imageview by constructing the path with the loaderIndex variable | |
loaderImage.image = "/gallery" + loaderIndex + ".jpg"; | |
//increment the index so that next time it loads the next image in the sequence | |
loaderIndex++; | |
// if you have reached the end of the sequence, reset it to 1 | |
if(loaderIndex===4)loaderIndex=1; | |
} | |
// start the setInverval -- adjust the time to make a smooth animation | |
var loaderAnimate = setInterval(loadingAnimation,1600); | |
win.add(loaderImage); | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment