Guest User

Untitled

a guest
May 25th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. // Create all animations
  2. bookSlideOut = false;
  3. infoSlideOut = false;
  4.  
  5. // home up/down
  6. var homeUp = Titanium.UI.createAnimation();
  7. homeUp.bottom = 239;
  8. homeUp.duration = 800;
  9.  
  10. var homeDown = Titanium.UI.createAnimation();
  11. homeDown.bottom = 119;
  12. homeDown.duration = 800;
  13.  
  14. // info up/down
  15. var infoUp = Titanium.UI.createAnimation();
  16. infoUp.bottom = 185;
  17. infoUp.duration = 800;
  18.  
  19. var infoDown = Titanium.UI.createAnimation();
  20. infoDown.bottom = 65;
  21. infoDown.duration = 800;
  22.  
  23. // info in/out
  24. var infoOut = Titanium.UI.createAnimation();
  25. infoOut.left = 0;
  26. infoOut.duration = 800;
  27.  
  28. var infoIn = Titanium.UI.createAnimation();
  29. infoIn.left = -345;
  30. infoIn.duration = 800;
  31.  
  32. // pages in/out
  33. var bookOut = Titanium.UI.createAnimation();
  34. bookOut.left = 0;
  35. bookOut.duration = 800;
  36.  
  37. var bookIn = Titanium.UI.createAnimation();
  38. bookIn.left = -845;
  39. bookIn.duration = 800;
  40.  
  41. // Create all listeners
  42. bookBtn.addEventListener('click', function(e)
  43. {
  44. bookBtn.zIndex = 1;
  45.  
  46. if (!bookSlideOut)
  47. {
  48. homeBtn.animate(homeUp);
  49. infoContainer.animate(infoUp);
  50. homeUp.addEventListener('complete', function()
  51. {
  52. bookContainer.animate(bookOut);
  53. bookSlideOut = true;
  54. });
  55. }
  56. else
  57. {
  58. bookContainer.animate(bookIn);
  59. bookIn.addEventListener('complete', function()
  60. {
  61. bookSlideOut = false;
  62. homeBtn.animate(homeDown);
  63. infoContainer.animate(infoDown);
  64. });
  65. }
  66. });
  67.  
  68. infoBtn.addEventListener('click', function(e)
  69. {
  70. infoBtn.zIndex = 10;
  71.  
  72. if (!infoSlideOut)
  73. {
  74. homeBtn.animate(homeUp);
  75. homeUp.addEventListener('complete', function()
  76. {
  77. infoContainer.animate(infoOut);
  78. infoSlideOut = true;
  79. });
  80. }
  81. else
  82. {
  83. infoContainer.animate(infoIn);
  84. infoIn.addEventListener('complete', function()
  85. {
  86. infoSlideOut = false;
  87. homeBtn.animate(homeDown);
  88. });
  89. }
  90. });
Add Comment
Please, Sign In to add comment