Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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);
- });
- }
- });
Add Comment
Please, Sign In to add comment