Effetto macchina da scrivere

« Older   Newer »
 
  Share  
.
  1.     +1   -1
     
    .
    Avatar

    Advanced Member

    Group
    In Memories
    Posts
    7,733
    Reputation
    +100

    Status
    Anonymous
    Non è utilissimo ma è molto carino : : :3: :

    Inserite nei CSS questo:

    CODICE
    <h2 id="fly">Thanks for visiting $Pubblicizza Forum!</h2>

    <script type="text/javascript">

    //Flying Letters script- by Matthias (info@freejavascripts.f2s.com)
    // Modified by Twey for efficiency and compatibility
    //For this script and more, visit Pubblicizza Forum: http://www.pubblicizzaforum.forumfree.net

    //Configure message to display. Use "$" for linebreak
    //By default, set to just grab the text from element with ID="fly"
    message = document.getElementById("fly").innerHTML; // $ = taking a new line
    distance = 50; // pixel(s)
    speed = 200; // milliseconds

    var txt="",
          num=0,
          num4=0,
          flyofle="",
          flyofwi="",
          flyofto="",
          fly=document.getElementById("fly");


    function stfly() {
          for(i=0;i != message.length;i++) {
                  if(message.charAt(i) != "$")
                          txt += "<span style='position:relative;visibility:hidden;' id='n"+i+"'>"+message.charAt(i)+"<\/span>";
                  else
                          txt += "<br>";
          }
          fly.innerHTML = txt;
          txt = "";
          flyofle = fly.offsetLeft;
          flyofwi = fly.offsetWidth;
          flyofto = fly.offsetTop;
          fly2b();
    }

    function fly2b() {
          if(num4 != message.length) {
                  if(message.charAt(num4) != "$") {
                          var then = document.getElementById("n" + num4);
                          then.style.left = flyofle - then.offsetLeft + flyofwi / 2;
                          then.style.top = flyofto - then.offsetTop + distance;
                          fly3(then.id, parseInt(then.style.left), parseInt(then.style.left) / 5, parseInt(then.style.top), parseInt(then.style.top) / 5);
                  }
                  num4++;
                  setTimeout("fly2b()", speed);
          }
    }

    function fly3(target,lef2,num2,top2,num3) {
          if((Math.floor(top2) != 0 && Math.floor(top2) != -1) || (Math.floor(lef2) != 0 && Math.floor(lef2) != -1)) {
                  if(lef2 >= 0)
                          lef2 -= num2;
                  else
                          lef2 += num2 * -1;
                  if(Math.floor(lef2) != -1) {
                          document.getElementById(target).style.visibility = "visible";
                          document.getElementById(target).style.left = Math.floor(lef2);
                  } else {
                          document.getElementById(target).style.visibility = "visible";
                          document.getElementById(target).style.left = Math.floor(lef2 + 1);
                  }
                  if(lef2 >= 0)
                          top2 -= num3
                  else
                          top2 += num3 * -1;
                  if(Math.floor(top2) != -1)
                          document.getElementById(target).style.top = Math.floor(top2);
                  else
                          document.getElementById(target).style.top = Math.floor(top2 + 1);
                  setTimeout("fly3('"+target+"',"+lef2+","+num2+","+top2+","+num3+")",50)
          }
    }

    stfly()

    </script>


    Per andare a capo nella scritta dovete utilizzare questo simbolo: $
     
    Top
    .
  2. .:Milla:.
        +1   -1
     
    .

    User deleted


    posso vedere un esempio? :v
     
    Top
    .
  3.     +1   -1
     
    .
    Avatar

    Advanced Member

    Group
    In Memories
    Posts
    7,733
    Reputation
    +100

    Status
    Anonymous
    Provalo xD
     
    Top
    .
  4. .:Milla:.
        +1   +1   -1
     
    .

    User deleted


    si, e scombino tutto il forum XD
     
    Top
    .
3 replies since 7/2/2014, 18:43   33 views
  Share  
.
Top