Aylinux-Gunes.script 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. win_width = Window.GetWidth ();
  2. win_height = Window.GetHeight ();
  3. // win_width = Window.GetWidth ();
  4. // win_height = Window.GetHeight ();
  5. ww_half = win_width / 2;
  6. wh_half = win_height / 2;
  7. offset = 0; // win_height / -4;
  8. // Planet Aura
  9. planet_aura.image = Image ("planet_aura.png");
  10. planet_aura.size_ratio = planet_aura.image.GetWidth() / win_width;
  11. planet_aura.new_height = planet_aura.image.GetHeight() / planet_aura.size_ratio;
  12. planet_aura.scaled_image = planet_aura.image.Scale (win_width, planet_aura.new_height);
  13. planet_aura.sprite = Sprite (planet_aura.scaled_image);
  14. planet_aura.start = 0;
  15. planet_aura.end = 1;
  16. planet_aura.sprite.SetY ((win_height - planet_aura.new_height));
  17. planet_aura.sprite.SetOpacity (1);
  18. // To do: Retrofit this to suit all
  19. size_ratio = planet_aura.image.GetWidth() / win_width; // planet_aura.size_ratio
  20. // Sun Glow
  21. sun_glow.image = Image ("sun_glow.png");
  22. sun_glow.new_width = sun_glow.image.GetWidth() / size_ratio;
  23. sun_glow.new_height = sun_glow.image.GetHeight() / size_ratio;
  24. sun_glow.scaled_image = sun_glow.image.Scale (sun_glow.new_width, sun_glow.new_height);
  25. sun_glow.x = ww_half - (sun_glow.new_width / 2);
  26. sun_glow.y = ((wh_half / 2) - (sun_glow.new_height / 2));
  27. sun_glow.sprite = Sprite (sun_glow.scaled_image);
  28. sun_glow.start = 0.2;
  29. sun_glow.end = 1.0; // 0.4 - Doesn't Like Decimal
  30. sun_glow.anim_start = 0.2;
  31. sun_glow.anim_end = 0.8; // 0.8 - Doesn't like Decimal
  32. sun_glow.start_pos = (wh_half - (sun_glow.new_height / 4)) + offset;
  33. sun_glow.end_pos = (wh_half / 2) - (sun_glow.new_height / 2);
  34. //distro_logo.x = ww_half - (distro_logo.width / 2);
  35. //distro_logo.y = (wh_half / 2) - (distro_logo.new_height / 2);
  36. sun_glow.sprite.SetX (sun_glow.x);
  37. sun_glow.sprite.SetY (sun_glow.y);
  38. //sun_glow.sprite.SetX (ww_half - (new_height / 2));
  39. //sun_glow.sprite.SetY (wh_half + offset);
  40. sun_glow.sprite.SetOpacity (0); // 0.4 / 0
  41. // Planet Black
  42. planet_black.image = Image ("planet_black.png");
  43. planet_black.size_ratio = planet_black.image.GetWidth() / win_width;
  44. planet_black.new_height = planet_black.image.GetHeight() / planet_black.size_ratio;
  45. planet_black.scaled_image = planet_black.image.Scale (win_width, planet_black.new_height);
  46. planet_black.sprite = Sprite (planet_black.scaled_image);
  47. ///planet_black.sprite.SetY (wh_half + offset);
  48. planet_black.sprite.SetY ((win_height - planet_black.new_height));
  49. planet_black.sprite.SetOpacity (1); // 1
  50. // Planet Shine
  51. planet_shine.image = Image ("planet_shine.png");
  52. planet_black.size_ratio = planet_shine.image.GetWidth() / win_width;
  53. planet_shine.new_height = planet_shine.image.GetHeight() / planet_shine.size_ratio;
  54. planet_shine.scaled_image = planet_shine.image.Scale (win_width, planet_shine.new_height);
  55. planet_shine.sprite = Sprite (planet_shine.scaled_image);
  56. planet_shine.start = 0.2;
  57. planet_shine.end = 1; // 0.6 - Doesn't Like Decimal
  58. // planet_shine.sprite.SetY ((wh_half + offset) - 2);
  59. planet_shine.sprite.SetY ((win_height - planet_shine.new_height));
  60. planet_shine.sprite.SetOpacity (0); // 0.6 / 0
  61. // Distro Logo
  62. distro_logo.image = Image ("distro_logo.png");
  63. distro_logo.width = distro_logo.image.GetWidth() / size_ratio;
  64. distro_logo.height = distro_logo.image.GetHeight() / size_ratio;
  65. distro_logo.image = distro_logo.image.Scale (distro_logo.width, distro_logo.height);
  66. distro_logo.x = ww_half - (distro_logo.width / 2);
  67. distro_logo.y = (wh_half / 2) - (distro_logo.height / 2);
  68. distro_logo.sprite = Sprite (distro_logo.image);
  69. distro_logo.start = 0;
  70. distro_logo.end = 1;
  71. distro_logo.sprite.SetX (distro_logo.x);
  72. distro_logo.sprite.SetY (distro_logo.y);
  73. distro_logo.sprite.SetOpacity (1);
  74. // Distro Name
  75. distro_name.image = Image ("distro_name.png");
  76. distro_name.width = distro_name.image.GetWidth() / size_ratio;
  77. distro_name.height = distro_name.image.GetHeight() / size_ratio;
  78. distro_name.image = distro_name.image.Scale (distro_name.width, distro_name.height);
  79. distro_name.x = ww_half - (distro_name.width / 2);
  80. distro_name.y = win_height - (distro_name.height * 2);
  81. distro_name.sprite = Sprite (distro_name.image);
  82. distro_name.start = 0.8;
  83. distro_name.end = 1;
  84. distro_name.sprite.SetX (distro_name.x);
  85. distro_name.sprite.SetY (distro_name.y);
  86. distro_name.sprite.SetOpacity (0); // 0
  87. // Function for Animation and Opacity Steps?
  88. fun remap (val, imin, imax, omin, omax) {
  89. return (((val - imin) / (imax - imin)) * (omax - omin)) + omin;
  90. }
  91. // Callback Function
  92. fun progress_callback (d, p) {
  93. p = (p * 100.0) / 15.0;
  94. // Planet Aura Opacity
  95. if (p >= planet_aura.start && p <= planet_aura.end) {
  96. a = remap (p, planet_aura.start, planet_aura.end, 0, 1);
  97. planet_aura.sprite.SetOpacity (a);
  98. }
  99. // Sun Aura Opacity
  100. if (p >= sun_glow.start && p <= sun_glow.end) {
  101. a = remap (p, sun_glow.start, sun_glow.end, 0, 1);
  102. sun_glow.sprite.SetOpacity (a);
  103. }
  104. // Sun Glow Animation Y
  105. if (p >= sun_glow.anim_start && p <= sun_glow.anim_end) {
  106. a = remap (p, sun_glow.anim_start, sun_glow.anim_end, 0, 1);
  107. b = sun_glow.start_pos - ((sun_glow.start_pos - sun_glow.end_pos) * a);
  108. sun_glow.sprite.SetY (b);
  109. }
  110. // Planet Shine Opacity
  111. if (p >= planet_shine.start && p <= planet_shine.end) {
  112. a = remap (p, planet_shine.start, planet_shine.end, 0, 1);
  113. planet_shine.sprite.SetOpacity (a);
  114. }
  115. // Distro Logo Rotate?
  116. //if (p >= distro_logo.start && p <= distro_logo.end) {
  117. // a = remap (p, distro_logo.start, distro_logo.end, 0.5, 1);
  118. // b = Math.Pi * a;
  119. // distro_logo.sprite.SetImage (distro_logo.image.Rotate(b));
  120. //}
  121. // Distro Logo Opacity
  122. if (p >= distro_logo.start && p <= distro_logo.end) {
  123. a = remap (p, distro_logo.start, distro_logo.end, 0, 1);
  124. distro_logo.sprite.SetOpacity (a);
  125. }
  126. // Distro Name Opacity
  127. if (p >= distro_name.start && p <= distro_name.end) {
  128. a = remap (p, distro_name.start, distro_name.end, 0, 1);
  129. distro_name.sprite.SetOpacity (a);
  130. }
  131. }
  132. // Let's Begin
  133. Plymouth.SetBootProgressFunction(progress_callback);