| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 512 人关注过本帖
标题:谁有图片破碎后随风而逝的JS特效
只看楼主 加入收藏
bestlife
Rank: 1
等 级:新手上路
帖 子:484
专家分:0
注 册:2005-7-8
收藏
 问题点数:0 回复次数:3 
谁有图片破碎后随风而逝的JS特效
RTRT
搜索更多相关主题的帖子: 破碎 特效 随风而逝 
2006-12-06 11:14
bestlife
Rank: 1
等 级:新手上路
帖 子:484
专家分:0
注 册:2005-7-8
收藏
得分:0 

自己找了个

//爆裂代码
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=parent.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);
}
//爆裂代码结束


修炼修炼再修炼 成长成长再成长
2006-12-06 13:30
冰河世纪
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:2167
专家分:0
注 册:2006-11-7
收藏
得分:0 
干啥呢 这是?

冰一样的少年,外表是冰,冷酷而强大;内心是冰,却一暖成水,柔柔漫漫
2006-12-06 13:31
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
参数 f和obj是什么?
2006-12-06 15:00
快速回复:谁有图片破碎后随风而逝的JS特效
数据加载中...
 
   



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

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