非常酷!3D漂浮图像
<P><xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/><BR><style><BR>v\:* { behavior: url(#default#VML); }<BR></style></P><P>把如下代码复制到<body>与</body>之间</P>
<P><SCRIPT><BR>// 3D-Slideshow<BR>// more javascript from <A href="http://www.smallrain.net">http://www.smallrain.net</A><BR>var slideurl=new Array()<BR>slideurl[0]="pic/blender.png"<BR>slideurl[1]="pic/aim.png"<BR>slideurl[2]="pic/babelfish.png"</P>
<P>// add a corresponding link for each image<BR>// if you don't wont to link an image, enter "#"<BR>var slidelink=new Array()<BR>slidelink[0]="<A href="http://www.butong.net">http://www.butong.net</A>"<BR>slidelink[1]="<A href="http://bz.butong.net">http://bz.butong.net</A>"<BR>slidelink[2]="<A href="http://www.butong.net/it/index.htm">http://www.butong.net/it/index.htm</A>"</P>
<P>// add a corresponding target for each link<BR>// acceptable values "_blank" or "_top" or "_parent" or "_self"<BR>var slidetarget=new Array()<BR>slidetarget[0]="_blank"<BR>slidetarget[1]="_self"<BR>slidetarget[2]="_top"</P>
<P>// set the width of the 3D-border (pixels)<BR>var backdepth=6</P>
<P>// set thecolorof the 3D-border (HTML-values required)<BR>var fillcolor="#666666"</P>
<P>// set the standstill (seconds) for the images (required for Netscape Navigator)<BR>var standstill=3</P>
<P>// set the form of the imageframe<BR>// acceptable values are "oval" or "rect"<BR>var imageform="oval"</P>
<P>// do not edit below this line<BR>var slidewidth=1<BR>var slideheight=1</P>
<P>var ns6=document.getElementById&&!document.all?1:0 <BR>var opera=navigator.userAgent.match(/Opera/) <BR>var ie5=document.getElementById&&document.all&&!opera?1:0 </P>
<P>standstill*=1000<BR>var floatingspeed=1<BR>var tempo=20<BR>var numberofimages=slideurl.length-1<BR>var stepx=new Array()<BR>var stepy=new Array()<BR>for (i=0;i<=numberofimages;i++) {<BR> stepx[i]=randommakerNS(floatingspeed)<BR> stepy[i]=randommakerNS(floatingspeed)<BR>}<BR>var imgwidth=new Array()<BR>var imgheight=new Array()<BR>for (i=0;i<=numberofimages;i++) {<BR> imgwidth[i]=10<BR> imgheight[i]=10<BR>}<BR>var x,y<BR>var marginbottom<BR>var marginleft=0<BR>var margintop=0<BR>var marginright<BR>var timer<BR>var i_fadestrength=new Array()<BR>var i_fadestep=new Array()<BR>var i_fadenow=new Array()<BR>var i_fadenowmax=new Array()<BR>for (i=0;i<=slideurl.length;i++) {<BR> i_fadenowmax[i]=2<BR> i_fadestrength[i]=randommakerNS(99) <BR> i_fadestep[i]=1<BR> i_fadenow[i]=0<BR>}</P>
<P>var spancontent=new Array()<BR>var i_spancontent=0<BR>var imgpreload=new Array()<BR>for (i=0;i<=slideurl.length;i++) {<BR> imgpreload[i]=new Image()<BR> imgpreload[i].src=slideurl[i]<BR>}<BR>for (i=0;i<=numberofimages;i++) {<BR> spancontent[i]="<a href='"+slidelink[i]+"' target='"+slidetarget[i]+"'><img src='"+slideurl[i]+"' border='0'></a>"<BR>}</P>
<P>var i_angle1=0<BR>var i_size=1<BR>var i_pic=0<BR>var posleft=0<BR>var postop=0<BR>var x_extrusionangle=0<BR>var y_extrusionangle=0<BR>var x_rotationcenter=0<BR>var y_rotationcenter=0<BR>var pagewidth<BR>var pageheight</P>
<P>function initNS() {<BR> marginbottom=window.innerHeight-11<BR> marginright=window.innerWidth-11 <BR> var thisspan=document.getElementById('span0')<BR> thisspan.innerHTML=spancontent[0]<BR> var thisspan=document.getElementById('span0')<BR> imgwidth[0]=parseInt(thisspan.offsetWidth)<BR> imgheight[0]=parseInt(thisspan.offsetHeight)<BR> var maxleftstart=marginright-imgwidth[0]<BR> var maxtopstart=marginbottom-imgheight[0]<BR> var thisspan=document.getElementById('span0').style<BR> thisspan.left=parseInt(thisspan.left)+randommakerNS(maxleftstart)<BR> thisspan.top=parseInt(thisspan.top)+randommakerNS(maxtopstart) <BR> thisspan.visibility="visible" <BR> checkmovementNS()<BR>}</P>
<P>function randommakerNS(range) { <BR> rand=Math.floor(range*Math.random())<BR> if (rand==0) {rand=Math.ceil(range/2)}<BR> return rand<BR>}</P>
<P>function checkmovementNS() {<BR> checkpositionNS()<BR> movepicturesNS()<BR> timer=setTimeout("checkmovementNS()",tempo)<BR>}</P>
<P>function movepicturesNS() {<BR> var thisspan=document.getElementById('span0').style<BR> thisspan.left=parseInt(thisspan.left)+stepx[0]<BR> thisspan.top=parseInt(thisspan.top)+stepy[0] <BR> i_fadenow[0]++<BR> if (i_fadenow[0]>=i_fadenowmax[0]) {<BR> i_fadenow[0]=0<BR> if (i_fadestrength[0]>=100) {i_fadestep[0]=i_fadestep[0]*-1}<BR> else if (i_fadestrength[0]<=0) {<BR> i_fadestep[0]=i_fadestep[0]*-1<BR> i_spancontent++<BR> if (i_spancontent>=spancontent.length) {i_spancontent=0}<BR> document.getElementById('span0').innerHTML=spancontent[i_spancontent]<BR> }<BR> } <BR> i_fadestrength[0]+=i_fadestep[0]<BR> document.getElementById('span0').style.MozOpacity=Math.round(i_fadestrength[0])/100<BR>}</P>
<P>function checkpositionNS() {<BR> imgwidth[0]=parseInt(document.getElementById('span0').offsetWidth)<BR> imgheight[0]=parseInt(document.getElementById('span0').offsetHeight) <BR> var thisspan=document.getElementById('span0').style<BR> var leftx=parseInt(thisspan.left)<BR> var topy=parseInt(thisspan.top)<BR> if (leftx>marginright-imgwidth[0]-floatingspeed) {<BR> thisspan.left=leftx-Math.abs(stepx[0]+1)<BR> stepx[0]=randommakerNS(floatingspeed)*-1 <BR> }<BR> if (leftx<marginleft) {<BR> thisspan.left=leftx+Math.abs(stepx[0])<BR> stepx[0]=randommakerNS(floatingspeed) <BR> } <BR> if (topy>marginbottom-imgheight[0]-floatingspeed) {<BR> thisspan.top=topy-Math.abs(stepy[0])<BR> stepy[0]=randommakerNS(floatingspeed)*-1<BR> }<BR> if (topy<margintop) {<BR> thisspan.top=topy+Math.abs(stepy[0])<BR> stepy[0]=randommakerNS(floatingspeed)<BR> }<BR>}</P>
<P>function initIE() {<BR> var i_preload=0<BR> for (i=0;i<=slideurl.length-1;i++) {<BR> var imgref=eval("document.n"+i)<BR> if (imgref.complete) {i_preload++}<BR> }<BR> if (i_preload>=slideurl.length-1) {<BR> slidewidth=document.getElementById('spn1').offsetWidth<BR> slideheight=document.getElementById('spn1').offsetHeight<BR> pagewidth=document.body.clientWidth<BR> pageheight=document.body.clientHeight<BR> document.getElementById('rectid').style.width=slidewidth<BR> document.getElementById('rectid').style.height=slideheight<BR> posleft=(pagewidth-slidewidth)/2<BR> postop=(pageheight-slideheight)/2<BR> x_rotationcenter=(posleft/slidewidth)/2<BR> y_rotationcenter=(postop/slideheight)/2<BR> var rotationcenter=0+","+y_rotationcenter+","+x_rotationcenter<BR> document.getElementById('rectid').style.left=posleft<BR> document.getElementById('rectid').style.top=postop<BR> document.getElementById('extrusionid').rotationcenter=rotationcenter<BR> rotateIE()<BR> }<BR> else {<BR> var timer=setTimeout("initIE()",200)<BR> }<BR>}</P>
<P>function rotateIE() {<BR> i_angle1+=1<BR> if (i_angle1>=360) {<BR> i_angle1=0<BR> }<BR> if (i_angle1==127) {<BR> i_pic++<BR> if (i_pic>=slideurl.length) {i_pic=0}<BR> document.getElementById('fillid').src=slideurl[i_pic]<BR> }<BR> document.getElementById('rectid').style.rotation=i_angle1<BR> document.getElementById('extrusionid').rotationangle=i_angle1+","+i_angle1<BR> var timer=setTimeout("rotateIE()",30)<BR>}</P>
<P>function openpageIE() {<BR> if (slidetarget[i_pic]=="_blank") {<BR> window.open(slidelink[i_pic])<BR> }<BR> else if (slidetarget[i_pic]=="_self") {<BR> document.location.href(slidelink[i_pic])<BR> }<BR> else if (slidetarget[i_pic]=="_top" || slidetarget[i_pic]=="_parent") {<BR> top.location.href(slidelink[i_pic])<BR> }<BR>}</P>
<P>if (ns6) {<BR> document.write("<span id='span0' style='position:absolute;top:0px;left:0px;filter:alpha(opacity=0);-moz-opacity:0'></span>")<BR> document.close()<BR> window.onload=initNS<BR>}<BR>if (ie5) {<BR> document.write('<div id="preloadimages" style="position:absolute;left:0px;top:-5px;visibility:hidden">')<BR> for (i=0;i<=slideurl.length-1;i++) {<BR> document.write('<span id="spn'+i+'" style="position:absolute;width:2px;left:0px;top:0px;">')<BR> document.write('<img src="'+slideurl[i]+'" name="n'+i+'">')<BR> document.write('</span>')<BR> }<BR> document.write('</div>')<BR> document.write('<v:'+imageform+' id="rectid" style="position:absolute;top:0;left:0;width:'+slidewidth+';height:'+slideheight+'" onClick="openpageIE()">')<BR> document.write('<v:extrusion id="extrusionid" on="true" type="perspective" color="'+fillcolor+'" rotationcenter="0,0,0" backdepth="'+backdepth+'" diffusity="2.5" metal="true">')<BR> document.write('</v:extrusion>')<BR>document.write('<v:fill id="fillid" opacity="100%" color="'+fillcolor+'" type="frame" src="'+slideurl[0]+'"/>')<BR> document.write('</v:'+imageform+'>')<BR> window.onload=initIE<BR> }<BR></script></P>
页:
[1]