Created
May 18, 2010 13:44
-
-
Save kellymredd/405012 to your computer and use it in GitHub Desktop.
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
// Create all animations | |
bookSlideOut = false; | |
infoSlideOut = false; | |
// home up/down | |
var homeUp = Titanium.UI.createAnimation(); | |
homeUp.bottom = 239; | |
homeUp.duration = 800; | |
var homeDown = Titanium.UI.createAnimation(); | |
homeDown.bottom = 119; | |
homeDown.duration = 800; | |
// info up/down | |
var infoUp = Titanium.UI.createAnimation(); | |
infoUp.bottom = 185; | |
infoUp.duration = 800; | |
var infoDown = Titanium.UI.createAnimation(); | |
infoDown.bottom = 65; | |
infoDown.duration = 800; | |
// info in/out | |
var infoOut = Titanium.UI.createAnimation(); | |
infoOut.left = 0; | |
infoOut.duration = 800; | |
var infoIn = Titanium.UI.createAnimation(); | |
infoIn.left = -345; | |
infoIn.duration = 800; | |
// pages in/out | |
var bookOut = Titanium.UI.createAnimation(); | |
bookOut.left = 0; | |
bookOut.duration = 800; | |
var bookIn = Titanium.UI.createAnimation(); | |
bookIn.left = -845; | |
bookIn.duration = 800; | |
// Create all listeners | |
bookBtn.addEventListener('click', function(e) | |
{ | |
bookBtn.zIndex = 1; | |
if (!bookSlideOut) | |
{ | |
homeBtn.animate(homeUp); | |
infoContainer.animate(infoUp); | |
homeUp.addEventListener('complete', function() | |
{ | |
bookContainer.animate(bookOut); | |
bookSlideOut = true; | |
}); | |
} | |
else | |
{ | |
bookContainer.animate(bookIn); | |
bookIn.addEventListener('complete', function() | |
{ | |
bookSlideOut = false; | |
homeBtn.animate(homeDown); | |
infoContainer.animate(infoDown); | |
}); | |
} | |
}); | |
infoBtn.addEventListener('click', function(e) | |
{ | |
infoBtn.zIndex = 10; | |
if (!infoSlideOut) | |
{ | |
homeBtn.animate(homeUp); | |
homeUp.addEventListener('complete', function() | |
{ | |
infoContainer.animate(infoOut); | |
infoSlideOut = true; | |
}); | |
} | |
else | |
{ | |
infoContainer.animate(infoIn); | |
infoIn.addEventListener('complete', function() | |
{ | |
infoSlideOut = false; | |
homeBtn.animate(homeDown); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment