2 Replies - 18766 Views - Last Post: 29 June 2016 - 08:21 PM

#1 vip3r4lif3  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 30-July 06

Flying Text

Posted 04 August 2006 - 10:54 AM

Description: Copy the code, than put it under the body tag, but put it under anythiny in the body tag where you want it to show up, than replaec TEXT-HERE with we you want to fly down into that spot.A group of Words or Letters flying down from the top of your brower into the postion of where the page maker put it.
<h2 id="fly">TEXT-HERE</h2>

<script type="text/javascript">

//Flying Letters script- by Matthias ([email protected]avascripts.f2s.com)
// Modified by Twey for efficiency and compatibility
//For this script and more, visit Dynamic Drive: http://www.dynamicdrive.com

//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 += "
";
     }
     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>


Is This A Good Question/Topic? 0
  • +

Replies To: Flying Text

#2 kindlychung  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 20-June 12

Re: Flying Text

Posted 19 June 2012 - 11:18 PM

Hi. What if I want to make the text fly over and over again?
Was This Post Helpful? 0
  • +
  • -

#3 daret5893  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 29-June 16

Re: Flying Text

Posted 29 June 2016 - 08:21 PM

thank for sharing :gun_bandana:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1