五常信息网(五常论坛)

 找回密码
 立即注册
搜索
查看: 1390|回复: 1
打印 上一主题 下一主题

全屏雪景效果,超级经典!

[复制链接]

1763

主题

1万

帖子

46万

积分

系统管理员

Rank: 10Rank: 10Rank: 10

积分
462646
金钱
157396
威望
182736
经验值
99357
魅力
2079
精华
13
QQ
跳转到指定楼层
楼主
发表于 2008-3-23 20:47:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示:请下载源代码,将雪花图片保存到自己的空间,以确保图片网址永不失效。

演示网址:http://www.kunde58.com/best/web/24snow.htm

『源代码下载』

代码如下:

<script language="javascript">
<!--

Amount=20; //Smoothness! depends on image file size, the smaller the size the more you can use!

//Pre-load your image below!
Image0=new Image();
Image0.src="http://www.kunde58.com/best/web/photo/flake1.gif";
Image1=new Image();
Image1.src="http://www.kunde58.com/best/web/photo/flake2.gif";
Image2=new Image();
Image2.src="http://www.kunde58.com/best/web/photo/flake3.gif";
Image3=new Image();
Image3.src="http://www.kunde58.com/best/web/photo/flake4.gif";
Image4=new Image();
Image4.src="http://www.kunde58.com/best/web/photo/flake5.gif";

grphcs=new Array(5)
grphcs[0]="http://www.kunde58.com/best/web/photo/flake1.gif"
grphcs[1]="http://www.kunde58.com/best/web/photo/flake2.gif"
grphcs[2]="http://www.kunde58.com/best/web/photo/flake3.gif"
grphcs[3]="http://www.kunde58.com/best/web/photo/flake4.gif"
grphcs[4]="http://www.kunde58.com/best/web/photo/flake5.gif"

Ypos=new Array();
Xpos=new Array();
Speed=new Array();
Step=new Array();
Cstep=new Array();
ns=(document.layers)?1:0;
if (ns){
for (i = 0; i < Amount; i++){
var P=Math.floor(Math.random()*grphcs.length);
rndPic=grphcs[P];
document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+rndPic+"></LAYER>");
}
}
else{
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < Amount; i++){
var P=Math.floor(Math.random()*grphcs.length);
rndPic=grphcs[P];
document.write('<img id="si" src="'+rndPic+'" style="position:absolute;top:0px;left:0px">');
}
document.write('</div></div>');
}
WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
for (i=0; i < Amount; i++){                                                               
 Ypos = Math.round(Math.random()*WinHeight);
 Xpos = Math.round(Math.random()*WinWidth);
 Speed= Math.random()*3+2;
 Cstep=0;
 Step=Math.random()*0.1+0.05;
}
function fall(){
var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;
var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;
var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i < Amount; i++){
sy = Speed*Math.sin(90*Math.PI/180);
sx = Speed*Math.cos(Cstep);
Ypos+=sy;
Xpos+=sx;
if (Ypos > WinHeight){
Ypos=-60;
Xpos=Math.round(Math.random()*WinWidth);
Speed=Math.random()*5+2;
}
if (ns){
document.layers['sn'+i].left=Xpos;
document.layers['sn'+i].top=Ypos+hscrll;
}
else{
si.style.pixelLeft=Xpos;
si.style.pixelTop=Ypos+hscrll;
}
Cstep+=Step;
}
setTimeout('fall()',10);
}
//-->
</script>

五常论坛是您快乐的网上家园,是您温馨的休闲港湾!

141

主题

1467

帖子

18万

积分

版主

Rank: 8Rank: 8

积分
180712
金钱
154699
威望
15632
经验值
7441
魅力
0
精华
3
沙发
发表于 2008-3-27 15:20:05 | 只看该作者
都打不开呀。
回复 支持 反对

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

QQ|手机版|小黑屋|Archiver|五常信息网(五常论坛) ( 黑ICP备06006344号

GMT+8, 2024-5-4 15:50 , Processed in 0.062730 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表