栏目搜索
 
 
 
 
你的位置:首页 > JavaScript > 利用Wipe等ActiveX技术,实现n(n>>2)幅图片轮换擦洗显示 >
 

利用Wipe等ActiveX技术,实现n(n>>2)幅图片轮换擦洗显示

发布者:[本站编辑] | 来源:[]

利用Wipe等ActiveX技术,实现n(n>>2)幅图片轮换擦洗显示_电脑维修资料库


一般的做法,只能显示两张图片,因为wipe擦洗技术限制只能两张图片间切换。 但可以通过将两张图片转为动画交替显示

<script>
var i=0,pictures=new array();//设置图片数组
var picbase=; //设置图片所在目录
pictures=1.gif
pictures=2.gif
pictures=3.gif
pictures=4.gif
pictures=5.gif
pictures=6.gif
pictures=7.gif
pictures=8.gif
pictures=9.gif
pictures=10.gif
pictures=11.gif
pictures=12.gif
pictures=13.gif
pictures=14.gif
pictures=15.gif
pictures=16.gif
pictures=17.gif
pictures=18.gif
pictures=19.gif
pictures=20.gif
pictures=21.gif
pictures=22.gif
var picturewidth=400//图片宽度
var pictureheight=290//图片高度
var delay=1//延迟时间
</script>
<script>
if (document.all) {
document.write('<object id=dacontrol_wipe ')
document.write('style=width:'+picturewidth+';height:'+pictureheight+'')
document.write('classid=clsid:b6ffc24c-7e13-11d0-9b47-00c04fc2f51d>')
document.write('</object>')
m = dacontrol_wipe.meterlibrary;

whattransformation = new activexobject(dximagetransform.microsoft.wipe);
whattransformation.gradientsize = 1.0;//设置渐变度
whattransformation.wipestyle = 0;//设置擦洗类型

var myarr=new array(),myarr2=new array();
var len=math.floor(pictures.length/2);//将图片分成两组
for(var i=0;i<len;i++){
myarr=m.importimage(picbase+pictures<2*i>)
myarr2=m.importimage(picbase+pictures<2*i+1>)
}
if(pictures<2*i>)
myarr=m.importimage(picbase+pictures<2*i>)
else
myarr=m.importimage(picbase+pictures<0>) ;
myarr=m.array(myarr)
myarr2=m.array(myarr2)
index = m.interpolate(0.5,len+0.5,len*2*delay).repeatforever();
index2 = m.interpolate(0,len,len*2*delay).repeatforever();
//交错运行半个时间单元
var whatpictures=new array();
whatpictures<0> = myarr.nthanim(index);
whatpictures<1> = myarr2.nthanim(index2);

forward = m.interpolate(0, 1, delay);
back = m.interpolate(1, 0, delay);
whatmovement = m.sequence(forward, back).repeatforever();
//设置参数方向

theresult = m.applydxtransform( whattransformation, whatpictures, whatmovement );
dacontrol_wipe.image = theresult.outputbvr;//设置显示图形
dacontrol_wipe.start();//开始
}
</script>
</t

 
返回列表 返回JavaScript
 
  推荐文章
 
     暂无
 
 
  随机资讯