当前位置:首页 > 代码 > 正文

网页动态下雪特效的源代码(网站下雪代码)

admin 发布:2022-12-19 15:46 101


今天给各位分享网页动态下雪特效的源代码的知识,其中也会对网站下雪代码进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

FLASH8.0无影片剪辑下雪效果代码 求改坐标

这个代码,我不清楚你的size这个数组的具体参数,但应该是修改这里的数据,把这里的数据修改成[569.7,400],因为在这里你没提供这个数组,所以无法判断。

怎样使用html代码做下雪特效

记事本编写的html 然后IE预览-截屏-图像编辑软件-导出图片-右键设置为桌面。bactxxbactxx 的方法行!一切为了效果!

flash制作下雪效果的脚本怎么写?

第一针

A = 100;//定义雪花个数

B = 2;//初始值

_root.createEmptyMovieClip("bg", 0);/*创建空白影片剪辑创建一个黑的与场景大小一样的影片作为背景*/

with (_root.bg) {

this.beginFill(0x000000, 100);

this.moveTo(0, 0);

this.lineTo(0, 0);

this.lineTo(0, Stage.height);

this.lineTo(Stage.width, Stage.height);

this.lineTo(Stage.width, 0);

this.lineTo(0, 0);

this.endFill();

}//用画线来画背景

_root.createEmptyMovieClip("xue", 1);/*利用画线创建雪花,其实就是一个白色的园*/

with (_root.xue) {

beginFill(0xffffff, 100);

moveTo(5, 0);

curveTo(0, 0, 0, 5);

curveTo(0, 10, 5, 10);

tcurveTo(10, 10, 15, 10);

curveTo(15, 0, 5, 0);

endFill();

}

_root.xue._visible = false;//隐藏影片剪辑

for (var i = B; iA; i++) {//复制影片剪辑,随机颁布与场景中,并设置其属性

duplicateMovieClip("_root.xue", "xue"+i, i);

_root["xue"+i]._x = random(Stage.width);

_root["xue"+i]._y = random(Stage.height);

_root["xue"+i]._xscale = _root["xue"+i]._yscale=50+i*Math.abs(Math.sin(Math.random(50)+i))/4;

_root["xue"+i]._alpha = random(70)+30;

_root["su"+i] = Math.cos(Math.random()*A/2-A);

}//这个是主场景中第一桢的脚本

第二针

function go(k) {自定义函数,让雪花动起来

_root["xue"+k]._x += _root["su"+k]*2;//定义雪花的X轴运动方式

_root["xue"+k]._y += 3;//定义雪花Y轴的运动方式

if (_root["xue"+k]._xStage.width) {/*定义界限,当雪花超出场景时返回初始状态,这样可以使雪花不断出现*/

_root["xue"+k]._x = 0;

} else if (_root["xue"+k]._x0) {

_root["xue"+k]._x = Stage.width;

}

if (this["xue"+k]._yStage.height) {

this["xue"+k]._y = 0;

} else if (_root["xue"+k]._y0) {

_root["xue"+k]._x = Stage.height;

}

}

for (var k =B; kA; k++) {

go(k);

}//复重复执行自定义函数,让雪花漂起来

第三针

gotoAndPlay(2);

HTML下雪代码

html

head

/head

BODY bgcolor="#000000"

SCRIPT language=JavaScript1.2

var snowsrc="images/xuehua1.gif"

var no = 10;

var ns4up = (document.layers) ? 1 : 0; // browser sniffer

var ie4up = (document.all) ? 1 : 0;

var dx, xp, yp; // coordinate and position variables

var am, stx, sty; // amplitude and step variables

var i, doc_width = 800, doc_height =600;

if (ns4up) {

doc_width = self.innerWidth;

doc_height = self.innerHeight;

} else if (ie4up) {

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx = new Array();

xp = new Array();

yp = new Array();

am = new Array();

stx = new Array();

sty = new Array();

for (i = 0; i no; ++ i) {

dx[i] = 0; // set coordinate variables

xp[i] = Math.random()*(doc_width-50); // set position variables

yp[i] = Math.random()*doc_height;

am[i] = Math.random()*20; // set amplitude variables

stx[i] = 0.02 + Math.random()/10; // set step variables

sty[i] = 0.7 + Math.random(); // set step variables

if (ns4up) { // set layers

if (i == 0) {

document.write("layer name=\"dot"+ i +"\" left=\"50\" top=\"50\" visibility=\"show\"img src='"+snowsrc+"' border=\"0\"/a/layer");

} else {

document.write("layer name=\"dot"+ i +"\" left=\"50\" top=\"50\" visibility=\"show\"img src='"+snowsrc+"' border=\"0\"/layer");

}

} else if (ie4up) {

if (i == 0) {

document.write("div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"img src='"+snowsrc+"' border=\"0\"/a/div");

} else {

document.write("div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"img src='"+snowsrc+"' border=\"0\"/div");

}

}

}

function snowNS() { // Netscape main animation function

for (i = 0; i no; ++ i) { // iterate for every dot

yp[i] += sty[i];

if (yp[i] doc_height-50) {

xp[i] = Math.random()*(doc_width-am[i]-30);

yp[i] = 0;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

doc_width = self.innerWidth;

doc_height = self.innerHeight;

}

dx[i] += stx[i];

document.layers["dot"+i].top = yp[i];

document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);

}

setTimeout("snowNS()", 10);

}

function snowIE() { // IE main animation function

for (i = 0; i no; ++ i) { // iterate for every dot

yp[i] += sty[i];

if (yp[i] doc_height-50) {

xp[i] = Math.random()*(doc_width-am[i]-30);

yp[i] = 0;

stx[i] = 0.02 + Math.random()/10;

sty[i] = 0.7 + Math.random();

doc_width = document.body.clientWidth;

doc_height = document.body.clientHeight;

}

dx[i] += stx[i];

document.all["dot"+i].style.pixelTop = yp[i];

document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);

}

setTimeout("snowIE()", 10);

}

if (ns4up) {

snowNS();

} else if (ie4up) {

snowIE();

}

/SCRIPT

/body

/html

记得给我加分啊

var snowsrc="images/xuehua1.gif"这句是你雪花图片的地址

网页动态下雪特效的源代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于网站下雪代码、网页动态下雪特效的源代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/11040.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载