Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var start_mode = "wait";
- var hovered_state = "hover";
- var fade_state = "out";
- var curr_alpha = 1;
- var curr_message = "2";
- var curr_mode = "right";
- var track_loop;
- var count_loop;
- var title_loop;
- var title_count = 0;
- var pos_x = -5;
- var track_speed = 10;
- var boundary_right;
- var boundary_left;
- var track_score;
- var box_alpha = 0;
- var box_mode = "in";
- var click_status = "none";
- // - moving title
- function moveTitle() {
- 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); ");
- title_loop = timedLoop(50, function() {
- title_count = title_count + 1;
- if (title_count == 2) {
- setText("movingTitle", "xonerate Aim Trainer");
- }
- if (title_count == 4) {
- setText("movingTitle", "onerate Aim Trainer");
- }
- if (title_count == 6) {
- setText("movingTitle", "nerate Aim Trainer");
- }
- if (title_count == 8) {
- setText("movingTitle", "erate Aim Trainer");
- }
- if (title_count == 10) {
- setText("movingTitle", "rate Aim Trainer");
- }
- if (title_count == 12) {
- setText("movingTitle", "ate Aim Trainer");
- }
- if (title_count == 14) {
- setText("movingTitle", "e Aim Trainer");
- }
- if (title_count == 16) {
- setText("movingTitle", " Aim Trainer");
- }
- if (title_count == 18) {
- setText("movingTitle", "Aim Trainer");
- }
- if (title_count == 20) {
- setText("movingTitle", "im Trainer E");
- }
- if (title_count == 22) {
- setText("movingTitle", "m Trainer Ex");
- }
- if (title_count == 24) {
- setText("movingTitle", " Trainer Exo");
- }
- if (title_count == 26) {
- setText("movingTitle", "Trainer Exon");
- }
- if (title_count == 28) {
- setText("movingTitle", "rainer Exone");
- }
- if (title_count == 30) {
- setText("movingTitle", "ainer Exoner");
- }
- if (title_count == 32) {
- setText("movingTitle", "iner Exonera");
- }
- if (title_count == 34) {
- setText("movingTitle", "ner Exonerat");
- }
- if (title_count == 36) {
- setText("movingTitle", "er Exonerate");
- }
- if (title_count == 38) {
- setText("movingTitle", "r Exonerate ");
- }
- if (title_count == 40) {
- setText("movingTitle", "Exonerate");
- }
- if (title_count == 42) {
- setText("movingTitle", "Exonerate A");
- }
- if (title_count == 44) {
- setText("movingTitle", "Exonerate Ai");
- }
- if (title_count == 46) {
- setText("movingTitle", "Exonerate Aim");
- }
- if (title_count == 48) {
- setText("movingTitle", "Exonerate Aim ");
- }
- if (title_count == 50) {
- setText("movingTitle", "Exonerate Aim T");
- }
- if (title_count == 52) {
- setText("movingTitle", "Exonerate Aim Tr");
- }
- if (title_count == 54) {
- setText("movingTitle", "Exonerate Aim Tra");
- }
- if (title_count == 56) {
- setText("movingTitle", "Exonerate Aim Trai");
- }
- if (title_count == 58) {
- setText("movingTitle", "Exonerate Aim Traine");
- }
- if (title_count == 60) {
- setText("movingTitle", "Exonerate Aim Trainer");
- }
- if (title_count == 62) {
- title_count = 0;
- }
- });
- }
- // - track mouse position and update hovered state
- onEvent("trackerSCRN", "mousemove", function() {
- if (hovered_state == "hover") {
- } else {
- stopTimedLoop(count_loop);
- hideElement("countLBL");
- stopTimedLoop(track_loop);
- showElement("messageBox");
- var fadeInLoop = timedLoop(100, function() {
- if (box_mode == "in") {
- if (box_alpha < 1) {
- box_alpha = box_alpha + 0.0125;
- setProperty("messageBox", "text-color", rgb(241, 130, 130, box_alpha));
- setProperty("messageBox", "background-color", rgb(71, 71, 71, box_alpha));
- setProperty("messageBox", "border-color", rgb(34, 33, 33, box_alpha));
- }
- if (box_alpha >= 0.8) {
- box_mode = "out";
- }
- }
- if (box_mode == "out") {
- if (box_alpha >= 0) {
- box_alpha = box_alpha - 0.0125;
- setProperty("messageBox", "text-color", rgb(241, 130, 130, box_alpha));
- setProperty("messageBox", "background-color", rgb(71, 71, 71, box_alpha));
- setProperty("messageBox", "border-color", rgb(34, 33, 33, box_alpha));
- }
- if (box_alpha <= 0) {
- hideElement("messageBox");
- stopTimedLoop(fadeInLoop);
- }
- }
- });
- click_status = "clicked";
- }
- });
- onEvent("crosshairPicture", "mouseout", function() {
- hovered_state = "out";
- });
- onEvent("crosshairPicture", "mousemove", function() {
- hovered_state = "hover";
- });
- // - start moving the crosshair and tracking the mouse position
- onEvent("crosshairPicture", "click", function() {
- if (click_status != "clicked") {
- startCountDown();
- startTracking();
- }
- click_status = "clicked";
- });
- function startTracking() {
- track_loop = timedLoop(100, function() {
- if (start_mode == "go" && curr_message == "go" && fade_state == "in") {
- track_score = track_score + 1;
- stopTimedLoop(count_loop);
- if (curr_mode == "right") {
- boundaryRight();
- }
- else if (curr_mode == "left") {
- boundaryLeft();
- }
- }
- });
- }
- function boundaryRight() {
- if (pos_x < 260) {
- pos_x = pos_x + track_speed;
- setProperty("crosshairPicture", "x", pos_x);
- }
- if (pos_x >= 260) {
- curr_mode = "left";
- }
- }
- function boundaryLeft() {
- if (pos_x > -5) {
- pos_x = pos_x - track_speed;
- setProperty("crosshairPicture", "x", pos_x);
- }
- if (pos_x <= -5) {
- curr_mode = "right";
- }
- }
- function startCountDown() {
- showElement("countLBL");
- count_loop = timedLoop(100, function() {
- if (fade_state == "out") {
- fadeOut(curr_message);
- }
- else if (fade_state == "in") {
- fadeIn(curr_message);
- }
- });
- }
- function fadeOut(Message) {
- if (curr_alpha > 0) {
- curr_alpha = curr_alpha - 0.125;
- setProperty("countLBL", "text-color", rgb(255, 255, 255, curr_alpha));
- }
- if (curr_alpha <= 0) {
- setText("countLBL", Message);
- fade_state = "in";
- }
- }
- function fadeIn(Message) {
- if (curr_alpha < 1) {
- curr_alpha = curr_alpha + 0.125;
- setProperty("countLBL", "text-color", rgb(255, 255, 255, curr_alpha));
- }
- if (curr_alpha >= 1) {
- if (Message == "3") {
- curr_message = "2";
- start_mode = "wait";
- }
- else if (Message == "2") {
- curr_message = "1";
- start_mode = "wait";
- }
- else if (Message == "1") {
- curr_message = "go";
- start_mode = "go";
- }
- fade_state = "out";
- }
- }
- // - settings stuff
- onEvent("crosshairSize", "input", function() {
- var val = getNumber("crosshairSize");
- setNumber("crosshairSizeLBL", getNumber("crosshairSize"));
- setProperty("crosshairPicture", "width", val);
- setProperty("crosshairPicture", "height", val);
- });
- onEvent("trackSpeed", "input", function() {
- var val = getNumber("trackSpeed");
- setNumber("trackSpeedLBL", val);
- track_speed = val;
- });
- onEvent("resetBTN", "click", function() {
- start_mode = "wait";
- hovered_state = "hover";
- fade_state = "out";
- curr_alpha = 1;
- curr_message = "2";
- curr_mode = "right";
- pos_x = -5;
- setProperty("crosshairPicture", "x", pos_x);
- setText("countLBL", "3");
- click_status = "none";
- box_mode = "in";
- });
- onEvent("trackBTN", "click", function() {
- setScreen("trackerSCRN");
- });
- onEvent("kovaaksBTN", "click", function() {
- setScreen("kovaaksScreen");
- });
- onEvent("backTrackerBTN", "click", function() {
- setScreen("startSCRN");
- });
- // slideIn1 x = -87
- // slideIn2 x = 165
- // slideIn1 = 265
- // slideIn 2 = 320
- var slide_mode = "in";
- var slidein1x = -265;
- var slidein2x = 320;
- function slideAnimation() {
- timedLoop(100, function() {
- if (slide_mode == "in") {
- if (slidein1x < -87) {
- slidein1x = slidein1x + 20;
- setProperty("slideIn1", "x", slidein1x);
- }
- if (slidein2x > 165) {
- slidein2x = slidein2x - 20;
- setProperty("slideIn2", "x", slidein2x);
- }
- if (slidein1x >= -87 && slidein2x <= 165) {
- slide_mode = "out";
- }
- }
- else if (slide_mode == "out") {
- if (slidein1x > -265) {
- slidein1x = slidein1x - 20;
- setProperty("slideIn1", "x", slidein1x);
- }
- if (slidein2x < 320) {
- slidein2x = slidein2x + 20;
- setProperty("slideIn2", "x", slidein2x);
- }
- if (slidein1x <= -265 && slidein2x >= 320) {
- slide_mode = "in";
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement