| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 532 人关注过本帖
标题:【爆裂代码】
只看楼主 加入收藏
bestlife
Rank: 1
等 级:新手上路
帖 子:484
专家分:0
注 册:2005-7-8
收藏
 问题点数:0 回复次数:1 
【爆裂代码】

<code>
<script>
//爆裂代码
var x_step=new Array();
var y_step=new Array();
var x_randompos=new Array();
var y_randompos=new Array();
var x_startpos=0;
var y_startpos=0;
var x_slices=8;
var y_slices=3;
var width_slice=0;
var height_slice=0;
var spancounter=0;
var pause=10;
var max_loop=20;
var i_loop=0;

function explode_init(f)
{
spancounter=0;
if (f.all) {
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
f.write("<span id='span"+spancounter+"' style='POSITION: absolute;display: ;'></span>");
spancounter++
}
}
spancounter=0;
}
}

function explode_start(obj)
{
var f=wog_view.document;
var img = f.getElementById(obj);//eval("parent.wog_view.document."+obj);

width_slice=Math.floor(img.width/x_slices);
height_slice=Math.floor(img.height/y_slices);

if(img.style.left.search("%")==-1)
{
x_startpos = img.style.posLeft;
}
else
{
x_startpos = (f.body.offsetWidth-20) * (img.style.posLeft)/100;
}

if(img.style.top.search("%")==-1)
{
y_startpos = img.style.posTop;
}
else
{
y_startpos = (f.body.offsetHeight - 5) * img.style.posTop/100;
}

cliptop=0;
clipbottom=height_slice;
clipleft=0;
clipright=width_slice;
i_loop=0;

spancounter=0;
for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
x_randompos[spancounter] = Math.ceil(f.body.offsetWidth*Math.random());
y_randompos[spancounter] = Math.ceil(f.body.offsetHeight*Math.random());
var thisinnerspan=f.getElementById("span"+spancounter);
thisinnerspan.innerHTML="<img id='spimg"+spancounter+"' src='"+img.src+"' style='FILTER: alpha(opacity=100);'>"
thisinnerspan.style.posLeft = x_startpos;
thisinnerspan.style.posTop = y_startpos;
thisinnerspan.style.clip = "rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")";
clipleft+=width_slice;
clipright+=width_slice;
spancounter++;
}
clipleft=0
clipright=width_slice
cliptop+=height_slice
clipbottom+=height_slice
}
spancounter=0;

img.style.display = "none";
explode_IE(f);
}

function explode_IE(f) {
spancounter=0;

for (i=0;i<=y_slices-1;i++) {
for (ii=0;ii<=x_slices-1;ii++) {
try{
var thisspan=f.getElementById("span"+spancounter).style;
x_step[spancounter]=(x_randompos[spancounter]-thisspan.posLeft)/(max_loop);
y_step[spancounter]=(y_randompos[spancounter]-thisspan.posTop)/(max_loop);
thisspan.posLeft+=x_step[spancounter];
thisspan.posTop+=y_step[spancounter];
var eimg = f.getElementById("spimg"+spancounter);
eimg.filters.alpha.opacity = (eimg.filters.alpha.opacity-100/(max_loop));
spancounter++;
if(max_loop==i_loop) thisspan.display = "none";
}catch(e){}
}
}
i_loop++;

spancounter=0;
if(max_loop>=i_loop) var timer=setTimeout("explode_IE(parent.wog_view.document)",pause);
}
//爆裂代码结束
</script>

<form id="wog_view">
<img id="img" src="http://bbs.bc-cn.net/aaa/logo.gif">
</form>
<script>
explode_init(wog_view.document);
explode_start("img");
</script>

</code>

搜索更多相关主题的帖子: 爆裂 代码 
2006-12-07 16:36
漯河
Rank: 4
等 级:贵宾
威 望:12
帖 子:1255
专家分:0
注 册:2006-8-8
收藏
得分:0 
没有看懂

——life is full of ups and downs!
2006-12-09 14:15
快速回复:【爆裂代码】
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014841 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved