var i=0,pictures=new Array();//设置图片数组,图片数为奇数
var picbase="";
pictures[i++]="../Images/yellowgreen.jpg"
pictures[i++]="../Images/yellowgreen1.jpg"
pictures[i++]="../Images/yellowgreen2.jpg"
pictures[i++]="../Images/yellowgreen.jpg"
var picturewidth=276//图片宽度
var pictureheight=299//图片高度
var delay=8//延迟时间
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 = 0.5;//设置渐变度
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[i]=m.ImportImage(picbase+pictures[2*i])
myArr2[i]=m.ImportImage(picbase+pictures[2*i+1])
}
if(pictures[2*i])
myArr[i]=m.ImportImage(picbase+pictures[2*i])
else
myArr[i]=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();//开始
}
本文介绍了一种使用Microsoft Wipe效果实现图片擦除动画的方法。通过JavaScript代码控制图片的渐变显示与隐藏,适用于IE浏览器。代码中详细展示了如何加载图片、设置擦除效果的参数及动画循环播放。
91

被折叠的 条评论
为什么被折叠?



