Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.94 KB | None | 0 0
  1. var start_mode = "wait";
  2. var hovered_state = "hover";
  3. var fade_state = "out";
  4. var curr_alpha = 1;
  5. var curr_message = "2";
  6. var curr_mode = "right";
  7. var track_loop;
  8. var count_loop;
  9. var title_loop;
  10. var title_count = 0;
  11. var pos_x = -5;
  12. var track_speed = 10;
  13. var boundary_right;
  14. var boundary_left;
  15. var track_score;
  16. var box_alpha = 0;
  17. var box_mode = "in";
  18. var click_status = "none";
  19.  
  20. // - moving title
  21. function moveTitle() {
  22. setStyle("movingTitle", "text-shadow: 0 1px 0 hsl(175, 5%, 80%), 0 2px 0 hsl(174, 5%, 75%), 0 3px 0 hsl(174, 5%, 70%), 0 4px 0 hsl(174, 5%, 66%), 0 5px 0 hsl(174, 5%, 64%), 0 6px 0 hsl(174, 5%, 62%), 0 7px 0 hsl(174, 5%, 61%), 0 8px 0 hsl(174, 5%, 60%), 0 0 5px rgba(0 ,0, 0, .5), 0 1px 3px rgba(0, 0, 0, .5), 0 3px 5px rgba(0, 0, 0, .5), 0 5px 10px rgba(0, 0, 0, .5), 0 10px 10px rgba(0 , 0, 0, .5), 0 20px 20px rgba(0 , 0, 0, 0.8); ");
  23. title_loop = timedLoop(50, function() {
  24. title_count = title_count + 1;
  25. if (title_count == 2) {
  26. setText("movingTitle", "xonerate Aim Trainer");
  27. }
  28. if (title_count == 4) {
  29. setText("movingTitle", "onerate Aim Trainer");
  30. }
  31. if (title_count == 6) {
  32. setText("movingTitle", "nerate Aim Trainer");
  33. }
  34. if (title_count == 8) {
  35. setText("movingTitle", "erate Aim Trainer");
  36. }
  37. if (title_count == 10) {
  38. setText("movingTitle", "rate Aim Trainer");
  39. }
  40. if (title_count == 12) {
  41. setText("movingTitle", "ate Aim Trainer");
  42. }
  43. if (title_count == 14) {
  44. setText("movingTitle", "e Aim Trainer");
  45. }
  46. if (title_count == 16) {
  47. setText("movingTitle", " Aim Trainer");
  48. }
  49. if (title_count == 18) {
  50. setText("movingTitle", "Aim Trainer");
  51. }
  52. if (title_count == 20) {
  53. setText("movingTitle", "im Trainer E");
  54. }
  55. if (title_count == 22) {
  56. setText("movingTitle", "m Trainer Ex");
  57. }
  58. if (title_count == 24) {
  59. setText("movingTitle", " Trainer Exo");
  60. }
  61. if (title_count == 26) {
  62. setText("movingTitle", "Trainer Exon");
  63. }
  64. if (title_count == 28) {
  65. setText("movingTitle", "rainer Exone");
  66. }
  67. if (title_count == 30) {
  68. setText("movingTitle", "ainer Exoner");
  69. }
  70. if (title_count == 32) {
  71. setText("movingTitle", "iner Exonera");
  72. }
  73. if (title_count == 34) {
  74. setText("movingTitle", "ner Exonerat");
  75. }
  76. if (title_count == 36) {
  77. setText("movingTitle", "er Exonerate");
  78. }
  79. if (title_count == 38) {
  80. setText("movingTitle", "r Exonerate ");
  81. }
  82. if (title_count == 40) {
  83. setText("movingTitle", "Exonerate");
  84. }
  85. if (title_count == 42) {
  86. setText("movingTitle", "Exonerate A");
  87. }
  88. if (title_count == 44) {
  89. setText("movingTitle", "Exonerate Ai");
  90. }
  91. if (title_count == 46) {
  92. setText("movingTitle", "Exonerate Aim");
  93. }
  94. if (title_count == 48) {
  95. setText("movingTitle", "Exonerate Aim ");
  96. }
  97. if (title_count == 50) {
  98. setText("movingTitle", "Exonerate Aim T");
  99. }
  100. if (title_count == 52) {
  101. setText("movingTitle", "Exonerate Aim Tr");
  102. }
  103. if (title_count == 54) {
  104. setText("movingTitle", "Exonerate Aim Tra");
  105. }
  106. if (title_count == 56) {
  107. setText("movingTitle", "Exonerate Aim Trai");
  108. }
  109. if (title_count == 58) {
  110. setText("movingTitle", "Exonerate Aim Traine");
  111. }
  112. if (title_count == 60) {
  113. setText("movingTitle", "Exonerate Aim Trainer");
  114. }
  115. if (title_count == 62) {
  116. title_count = 0;
  117. }
  118.  
  119. });
  120. }
  121.  
  122. // - track mouse position and update hovered state
  123. onEvent("trackerSCRN", "mousemove", function() {
  124. if (hovered_state == "hover") {
  125.  
  126. } else {
  127. stopTimedLoop(count_loop);
  128. hideElement("countLBL");
  129. stopTimedLoop(track_loop);
  130. showElement("messageBox");
  131. var fadeInLoop = timedLoop(100, function() {
  132. if (box_mode == "in") {
  133. if (box_alpha < 1) {
  134. box_alpha = box_alpha + 0.0125;
  135. setProperty("messageBox", "text-color", rgb(241, 130, 130, box_alpha));
  136. setProperty("messageBox", "background-color", rgb(71, 71, 71, box_alpha));
  137. setProperty("messageBox", "border-color", rgb(34, 33, 33, box_alpha));
  138. }
  139. if (box_alpha >= 0.8) {
  140. box_mode = "out";
  141. }
  142.  
  143. }
  144. if (box_mode == "out") {
  145. if (box_alpha >= 0) {
  146. box_alpha = box_alpha - 0.0125;
  147. setProperty("messageBox", "text-color", rgb(241, 130, 130, box_alpha));
  148. setProperty("messageBox", "background-color", rgb(71, 71, 71, box_alpha));
  149. setProperty("messageBox", "border-color", rgb(34, 33, 33, box_alpha));
  150. }
  151. if (box_alpha <= 0) {
  152. hideElement("messageBox");
  153. stopTimedLoop(fadeInLoop);
  154. }
  155. }
  156. });
  157. click_status = "clicked";
  158. }
  159. });
  160. onEvent("crosshairPicture", "mouseout", function() {
  161. hovered_state = "out";
  162. });
  163. onEvent("crosshairPicture", "mousemove", function() {
  164. hovered_state = "hover";
  165. });
  166.  
  167. // - start moving the crosshair and tracking the mouse position
  168. onEvent("crosshairPicture", "click", function() {
  169. if (click_status != "clicked") {
  170. startCountDown();
  171. startTracking();
  172. }
  173. click_status = "clicked";
  174.  
  175. });
  176. function startTracking() {
  177. track_loop = timedLoop(100, function() {
  178. if (start_mode == "go" && curr_message == "go" && fade_state == "in") {
  179. track_score = track_score + 1;
  180. stopTimedLoop(count_loop);
  181. if (curr_mode == "right") {
  182. boundaryRight();
  183. }
  184. else if (curr_mode == "left") {
  185. boundaryLeft();
  186. }
  187. }
  188. });
  189. }
  190. function boundaryRight() {
  191. if (pos_x < 260) {
  192. pos_x = pos_x + track_speed;
  193. setProperty("crosshairPicture", "x", pos_x);
  194. }
  195. if (pos_x >= 260) {
  196. curr_mode = "left";
  197. }
  198. }
  199. function boundaryLeft() {
  200. if (pos_x > -5) {
  201. pos_x = pos_x - track_speed;
  202. setProperty("crosshairPicture", "x", pos_x);
  203. }
  204. if (pos_x <= -5) {
  205. curr_mode = "right";
  206. }
  207. }
  208. function startCountDown() {
  209. showElement("countLBL");
  210. count_loop = timedLoop(100, function() {
  211. if (fade_state == "out") {
  212. fadeOut(curr_message);
  213. }
  214. else if (fade_state == "in") {
  215. fadeIn(curr_message);
  216. }
  217. });
  218. }
  219. function fadeOut(Message) {
  220. if (curr_alpha > 0) {
  221. curr_alpha = curr_alpha - 0.125;
  222. setProperty("countLBL", "text-color", rgb(255, 255, 255, curr_alpha));
  223. }
  224. if (curr_alpha <= 0) {
  225. setText("countLBL", Message);
  226. fade_state = "in";
  227. }
  228. }
  229. function fadeIn(Message) {
  230. if (curr_alpha < 1) {
  231. curr_alpha = curr_alpha + 0.125;
  232. setProperty("countLBL", "text-color", rgb(255, 255, 255, curr_alpha));
  233. }
  234. if (curr_alpha >= 1) {
  235. if (Message == "3") {
  236. curr_message = "2";
  237. start_mode = "wait";
  238. }
  239. else if (Message == "2") {
  240. curr_message = "1";
  241. start_mode = "wait";
  242. }
  243. else if (Message == "1") {
  244. curr_message = "go";
  245. start_mode = "go";
  246. }
  247. fade_state = "out";
  248. }
  249. }
  250.  
  251. // - settings stuff
  252. onEvent("crosshairSize", "input", function() {
  253. var val = getNumber("crosshairSize");
  254. setNumber("crosshairSizeLBL", getNumber("crosshairSize"));
  255. setProperty("crosshairPicture", "width", val);
  256. setProperty("crosshairPicture", "height", val);
  257. });
  258. onEvent("trackSpeed", "input", function() {
  259. var val = getNumber("trackSpeed");
  260. setNumber("trackSpeedLBL", val);
  261. track_speed = val;
  262. });
  263. onEvent("resetBTN", "click", function() {
  264. start_mode = "wait";
  265. hovered_state = "hover";
  266. fade_state = "out";
  267. curr_alpha = 1;
  268. curr_message = "2";
  269. curr_mode = "right";
  270. pos_x = -5;
  271. setProperty("crosshairPicture", "x", pos_x);
  272. setText("countLBL", "3");
  273. click_status = "none";
  274. box_mode = "in";
  275. });
  276.  
  277.  
  278. onEvent("trackBTN", "click", function() {
  279. setScreen("trackerSCRN");
  280. });
  281. onEvent("kovaaksBTN", "click", function() {
  282. setScreen("kovaaksScreen");
  283. });
  284. onEvent("backTrackerBTN", "click", function() {
  285. setScreen("startSCRN");
  286. });
  287.  
  288.  
  289. // slideIn1 x = -87
  290. // slideIn2 x = 165
  291.  
  292.  
  293. // slideIn1 = 265
  294. // slideIn 2 = 320
  295. var slide_mode = "in";
  296. var slidein1x = -265;
  297. var slidein2x = 320;
  298. function slideAnimation() {
  299. timedLoop(100, function() {
  300. if (slide_mode == "in") {
  301. if (slidein1x < -87) {
  302. slidein1x = slidein1x + 20;
  303. setProperty("slideIn1", "x", slidein1x);
  304. }
  305. if (slidein2x > 165) {
  306. slidein2x = slidein2x - 20;
  307. setProperty("slideIn2", "x", slidein2x);
  308. }
  309. if (slidein1x >= -87 && slidein2x <= 165) {
  310. slide_mode = "out";
  311. }
  312. }
  313. else if (slide_mode == "out") {
  314. if (slidein1x > -265) {
  315. slidein1x = slidein1x - 20;
  316. setProperty("slideIn1", "x", slidein1x);
  317. }
  318. if (slidein2x < 320) {
  319. slidein2x = slidein2x + 20;
  320. setProperty("slideIn2", "x", slidein2x);
  321. }
  322. if (slidein1x <= -265 && slidein2x >= 320) {
  323. slide_mode = "in";
  324. }
  325. }
  326. });
  327. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement