欢迎光临
我们一直在努力

PHP+Javascript模拟Matrix画面-PHP教程,PHP应用

建站超值云服务器,限时71元/月

直接存为*.php文件运行即可。

<?

$color_back="#000000";

$number_w=8;

$number_h=6;

$space=1;

$font_size=20;

$speed=0;

?>

<html>

<head>

<title>the matrix</title>

<meta http-equiv="content-type" content="text/html; charset=gb2312">

<script language="javascript">

// *****************************************************************

// written by caocao

// caocao@eastday.com

// http://caocao.oso.com.cn

// *****************************************************************

number_h=<? echo $number_h;?>;

number_w=<? echo $number_w;?>;

step=5;

text=new array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");

grad=new array("#000000","#004000","#008000","#00c000","#00ff00");

function line()

{

this.start=100;

this.end=60;

this.restart=0;

}

function randchar()

{

return (text[math.round(math.random()*25)]);

}

function initial()

{

matrix=new array();

light=new array();

for (i=0;i<number_h;i++)

{

for (j=0;j<number_w;j++)

{

matrix[i*number_h+j]="<? echo $color_back;?>";

}

}

for (j=0;j<number_w;j++)

{

light[j]=new line();

}

}

function new_light()

{

for (j=0;j<number_w;j++)

{

if (light[j].restart==0)

{

light[j].start=0;

light[j].end=-10-math.round(math.random()*20);

light[j].restart=light[j].end-math.round(math.random()*20);

}

else

{

light[j].start++;

light[j].end++;

light[j].restart++;

}

}

}

function new_color(i,j)

{

if ((light[j].start-i)<5&&(light[j].start-i)>0)

{

return (light[j].start-i);

}

if ((i-light[j].end)<5&&(i-light[j].end)>0)

{

return (i-light[j].end);

}

if ((i-light[j].end)>4&&(light[j].start-i)>4)

{

return (4);

}

return (0);

}

function display()

{

for (i=0;i<number_h;i++)

{

for (j=0;j<number_w;j++)

{

eval("w"+i+"h"+j).innerhtml="<font color="+grad[new_color(i,j)]+">"+randchar()+"</font>";

}

}

}

function show()

{

new_light();

display();

settimeout("show()",<? echo $speed;?>);

}

</script>

<style type="text/css">

<!–

<?

echo ".size,tr,td { font-size: ".$font_size."pt; line-height: ".$font_size."pt ;color:#00ff00}n";

?>

–>

</style>

</head>

<?

echo "<body bgcolor=".$color_back.">";

echo "<table width=".($number_w*$font_size)." border=0 cellspacing=".$space." cellpadding=0>";

for ($i=0;$i<$number_h;$i++)

{

echo "<tr>";

for ($j=0;$j<$number_w;$j++)

{

echo "<td id=w".$i."h".$j.">m</td>";

}

echo "</tr>";

}

echo "</table>";

?>

<script language="javascript">

initial();

show();

</script>

</body>

</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » PHP+Javascript模拟Matrix画面-PHP教程,PHP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章