Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the "let me google that for you" site make an animated mouse?

How can I make an animated mouse move across the screen and click a button?

It would be good for demonstration purposes!

Ideally, it would be in javascript and/or jQuery.

EDIT: there is a gigantic javascript file that the page calls, and that would take me a long time to parse and understand. That is why i am asking

like image 859
chris Avatar asked Dec 03 '22 07:12

chris


1 Answers

 function googleItForThem() {
    if ($.getQueryString({ id: "fwd" })) redirect();

    $("body").css("cursor", "wait");
    fakeMouse.show();
    instruct("play.step_1");

    fakeMouse.animate({
      top:  (inputField.position().top  + 15).px(),
      left: (inputField.position().left + 10).px()
    }, 1500, 'swing', function(){
      inputField.focus();
      fakeMouse.animate({ top: "+=18px", left: "+=10px" }, 'fast', function() { fixSafariRenderGlitch(); });
      type(searchString, 0);
    });

    function type(string, index){
      var val = string.substr(0, index + 1);
      inputField.attr('value', val);
      if (index < string.length) {
        setTimeout(function(){ type(string, index + 1); }, Math.random() * 240);
      }
      else {
        doneTyping();
      }
    }
like image 183
Stefan Kendall Avatar answered Dec 04 '22 20:12

Stefan Kendall