Advanced Search

Results 1 to 5 of 5

Thread: Matrix effect code

  1. #1
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Matrix effect code

    Hi, let me know what you think. Be sure to change the URL to you home page in the reLoc(); function

    Code:
    <html>
    <head>
    <title>MATRIX TEXT!</title>
    <script language="javascript">
    function addC()
    {
    	string = string.replace(/<([^<])*>/, ""); // Prevents HTML tags from effecting the page
    
    	if(x < string.length)
    	{
    		textBuffer += string.charAt(x);
    		
    		dot = string.charAt(x);	  //Sets variable dot for checking
    		
    		if (dot == ".")           //Check for full stops in text
    		{			  //If there is a full stop it 	  
    			textBuffer='';    //starts a clean page		
    		}
    		
    		txt.innerHTML = textBuffer;
    		x++;
    		setTimeout('addC()', pause);
    	}
    	
    	if (x == string.length)
    	{
    		setTimeout('reLoc()', (pause * 4)) // Send viewer to home page with pause to read text.
    	}
    
    }
    
    function reLoc()
    {
    	window.location = "http://www.dynamicdrive.com";  // Send viewer to home page
    }
    
    
    </script>
    
    </head>
    
    <body bgcolor=#000000>
    
    
    <font color="green">
    <span id="text">This Script was created by      .Alias      .Do Not Remove commenting   . 
    
    c[dot]alias[dot]s@hotmail[dot]co[dot]uk</span>
    </font>
    
    <script language="javascript">
    
    /****************************
    *THIS MUST NOT ME DELETED
    *(c) .Alias.
    *Contact c.alias.s@hotmail.co.uk
    ****************************/
    
    /****************************
    *Controls time between each Char.
    *Change To Suit You
    ****************************/
    pause = 150;
    
    if (document.getElementById)
    {
    	
    	txt = document.getElementById("text");
    	
    	if(txt.innerHTML)
    	{
    		textBuffer = " "; // Stops the loss of Spaces
    		
    		x = 0;
    		string = txt.innerHTML;
    		txt.innerHTML = " ";
    		addC();
    	}
    }
    
    </script>

  2. #2
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ive made some changes to it so if you wanna see them let me know.

    1) You chose delay bewtween each letter
    2) You chose location to load at end or to not load and reapeat the test
    3) You chose which ID i changes

    also i can upload a working demo if you want

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I think we have one already :-\
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OW i was beaten to it well any way her is my newest code

    matrix.js
    Code:
    function addC()
    {
    	string = string.replace(/<([^<])*>/, ""); // Prevents HTML tags from effecting the page
    
    	if(x < string.length)
    	{
    		textBuffer += string.charAt(x);
    		
    		dot = string.charAt(x);	  //Sets variable dot for checking
    		
    		if (dot == ".")           //Check for full stops in text
    		{			  //If there is a full stop it 	  
    			textBuffer='';    //starts a clean page		
    		}
    		
    		txt.innerHTML = textBuffer;
    		x++;
    		setTimeout('addC()', pause);
    	}
    	
    	if (x == string.length)
    	{
    		if (home == "")
    		{
    			x=0;
    			textBuffer = "";
    		}
    		else
    		{
    		setTimeout('reLoc()', (pause * 4)) // Send viewer to home page with pause to read text.
    		}
    	}
    
    }
    
    function reLoc()
    {
    	window.location = home;  // Send viewer to home page
    }
    
    function beginTxt(wanted, site, delay)
    {
    if (document.getElementById)
    {
    	home = site;
    	pause = delay;
    	txt = document.getElementById(wanted);
    	
    	if(txt.innerHTML)
    	{
    		textBuffer = " "; // Stops the loss of Spaces
    		x = 0;
    		string = txt.innerHTML;
    		txt.innerHTML = " ";
    		addC();
    	}
    }
    }
    Your HTML document
    in head
    Code:
    <script src="matrix.js"></script>
    in body (text to have effect done to it)
    id can be changed
    Code:
    <span id="blah">Example text           . You text goes here Full stops cause screen to clear then carry on typeing</span>
    at end of your body
    Code:
    <script language="javascript">
    
    /****************************
    *THIS MUST NOT BE DELETED
    *(c) .Alias.
    *Contact c.alias.s@hotmail.co.uk
    ****************************/
    
    /****************************
    *Controls time between each Char.
    *Change To Suit You
    ****************************/
    
    beginTxt("blah", "", 100);
    // "blah" is the ID of <span>
    // "" is URL to load after finished if left blank loops text
    // 100 is pause between each letter
    </script>

    enjoy

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    OW i was beaten to it
    So long as yours is better, don't worry
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •