Tips dan Trik Java Script “Matrix”

Pernah gak nonton film matrik??

pasti enggak kan??

saya juga enggak..

ehm… kali ini kita akan membuat sebuah animasi di page kita yang menyerupai tulisan yang turun dari atas kaya filem toe…

okeh ini scrip nya:

<html>
<head>
</head>
<body bgcolor=”#000000″>
<STYLE type=text/css>#supertext {
LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px
}
</STYLE>

<SCRIPT language=JavaScript1.2>

//Configure the below three variables

//1) Set message to display (HTML accepted)
var thecontent='<h2><font face=”Courier New” font size=”5″ color=”#00FF00″>ilmuwebsite.com – Webmaster Resource</font></h2>’
//2) Set delay after which message should be hidden, in miliseconds (” makes it incessantly visible on the screen)
var hidetimer=”;
//3) Set speed of animation (1-50), where larger is faster
var BallSpeed = 20;

///NO NEED TO EDIT BELOW THIS LINE///////////

var contentWidth;
var contentHeight;
var maxBallSpeed = 50;

var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = ‘right’;
var yDir = ‘down’;
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;

function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all(“supertext”).style.visibility = “visible”;
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight
}
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers[“supertext”].visibility = “show”;
}
setTimeout(‘moveBall()’,400);
if (hidetimer!=”)
setTimeout(“hidetext()”,hidetimer)
}

function moveBall() {
if (superballRunning == true) {
calculatePosition();
if (document.all) {
document.all(“supertext”).style.left = xPos + document.body.scrollLeft;
document.all(“supertext”).style.top = yPos + document.body.scrollTop;
}
else if (document.layers) {
document.layers[“supertext”].left = xPos + pageXOffset;
document.layers[“supertext”].top = yPos + pageYOffset;
}
animatetext=setTimeout(‘moveBall()’,20);
}
}

function calculatePosition() {
if (xDir == “right”) {
if (xPos > (xMax – contentWidth – BallSpeed)) {
xDir = “left”;
}
}
else if (xDir == “left”) {
if (xPos < (0 + BallSpeed)) {
xDir = “right”;
}
}
if (yDir == “down”) {
if (yPos > (yMax – contentHeight – BallSpeed)) {
yDir = “up”;
}
}
else if (yDir == “up”) {
if (yPos < (0 + BallSpeed)) {
yDir = “down”;
}
}
if (xDir == “right”) {
xPos = xPos + BallSpeed;
}
else if (xDir == “left”) {
xPos = xPos – BallSpeed;
}
else {
xPos = xPos;
}
if (yDir == “down”) {
yPos = yPos + BallSpeed;
}
else if (yDir == “up”) {
yPos = yPos – BallSpeed;
}
else {
yPos = yPos;
}
}

function hidetext(){
if (document.all)
supertext.style.visibility=”hidden”
else if (document.layers)
document.supertext.visibility=”hide”
clearTimeout(animatetext)
}

if (document.all||document.layers){
document.write(‘<span id=”supertext”><nobr>’+thecontent+'</nobr></span>’)
window.onload = initializeBall;
window.onresize = new Function(“window.location.reload()”);
}

</SCRIPT>

<SCRIPT language=JavaScript>

if (document.all){

Cols=22;

Cl=18; //Peþpeþe geliþ mesafeleri!

Cs=110; //Sayfaya enine yayýlýþ mesafeleri!

Ts=12; //Rakamlarýn büyüklükleri!

Tc=’#00FF00′;//Renk

Tc1=’#00FF00′;//Renk1

MnS=22; //Akýþ hýzlarý!

MxS=50; //Akýþ hýzlarý!

I=Cs;

Sp=new Array();S=new Array();Y=new Array();

C=new Array();M=new Array();B=new Array();

RC=new Array();E=new Array();Tcc=new Array(0,1,7,9,3,2);

document.write(“<div id=’Container’ style=’position:absolute;top:0;left:-“+Cs+”‘>”);

document.write(“<div style=’position:relative’>”);

for(i=0; i < Cols; i++){

S[i]=I+=Cs;

document.write(“<div id=’A’ style=’position:absolute;top:0;font-family:Arial;font-size:”

+Ts+”px;left:”+S[i]+”;width:”+Ts+”px;height:0px;color:”+Tc+”;visibility:hidden’></div>”);

}

document.write(“</div></div>”);

for(j=0; j < Cols; j++){

RC[j]=1+Math.round(Math.random()*Cl);

Y[j]=0;

Sp[j]=Math.round(MnS+Math.random()*MxS);

for(i=0; i < RC[j]; i++){

B[i]=”;

C[i]=Math.round(Math.random()*1)+’ ‘;

M[j]=B[0]+=C[i];

}

}

function Cycle(){

Container.style.top=window.document.body.scrollTop;

for (i=0; i < Cols; i++){

var r = Math.floor(Math.random()*Tcc.length);

E[i] = ‘<font color=’+Tc1+’>’+Tcc[r]+'</font>’;

Y[i]+=Sp[i];

if (Y[i] > window.document.body.clientHeight){

for(i2=0; i2 < Cols; i2++){

RC[i2]=1+Math.round(Math.random()*Cl);

for(i3=0; i3 < RC[i2]; i3++){

B[i3]=”;

C[i3]=Math.round(Math.random()*1)+’ ‘;

C[Math.floor(Math.random()*i2)]=’ ‘+’ ‘;

M[i]=B[0]+=C[i3];

Y[i]=-Ts*M[i].length/1.5;

A[i].style.visibility=’visible’;

}

Sp[i]=Math.round(MnS+Math.random()*MxS);

}

}

A[i].style.top=Y[i];

A[i].innerHTML=M[i]+’ ‘+E[i]+’ ‘;

}

setTimeout(‘Cycle()’,20)

}

Cycle();

}

</SCRIPT>
</body>
</html>

7 thoughts on “Tips dan Trik Java Script “Matrix””

  1. Heh ko ga jalan sih,,,,
    klo mau ngasih tau script yg bener donk jgn asal cetak😛

  2. Iya, saya mau ko🙂
    Komputer situ jelek kale…..

  3. saya baru nieh saya pengen bisa sekali tolong itu di copy dmn ya? bales ke fb saya
    tom_alcore@yahoo.com

    • oh ya mas kopy aja scripnya trus masukin di Dreamweaver atau applikasi editing lainnya. ya saya juga masih belajar..

      ini file HTML yang di isi java script , gak pake video atau make editing video seperti after efect.

      makasih uda coment..

  4. apakah pake after efect?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s