Board logo

标题: HTML 第十一课:镜面特效 [打印本页]

作者: 画儿    时间: 2009-9-22 21:53     标题: HTML 第十一课:镜面特效

HTML 第十一课:镜面特效

 

代码繁琐,使用简单。替换下面描红的汉字部分就ok。抽时间再给朋友们解析。

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>音画贴的名字</title>
<style type="text/css">
<!--
body {
 margin-left: 0px;
 margin-top: 0px;
 margin-right: 0px;
 margin-bottom: 0px;
}
-->
</style></head>

<body>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="600">
  <param name="movie" value="
flash地址" />
  <param name="quality" value="high" />
  <param name="wmode" value="transparent" />
  <embed src="flash地址
" width="1000" height="600" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</body>
<HTML xmlns:v = "urn:schemas-microsoft-com:vml">
<HEAD>
<TITLE>音画贴的名字</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<STYLE>v\:* {
 BEHAVIOR: url(#default#VML)
}
</STYLE>
<SCRIPT>
var slideurl=new Array()
slideurl[0]="
图片地址"
slideurl[1]="图片地址"
"
slideurl[2]="图片地址"
"
slideurl[3]="图片地址"
"
slideurl[4]="图片地址"
"
slideurl[5]="图片地址"
"
slideurl[6]="图片地址"
"
 
var slidelink=new Array()
slideurl[0]="图片地址"
"
slideurl[1]="图片地址"
"
slideurl[2]="图片地址"
"
slideurl[3]="图片地址"
"
slideurl[4]="图片地址"
"
slideurl[5]="图片地址"
"
slideurl[6]="图片地址"
"
var slidetarget=new Array()
slidetarget[0]="_blank"
slidetarget[1]="_self"
slidetarget[2]="_top"
slidetarget[3]="_blank"
slidetarget[4]="_self"
slidetarget[5]="_top"
slidetarget[6]="_blank"
var backdepth=7
 
var fillcolor="#666666"
 
var standstill=5
 
var imageform="oval"
 
var slidewidth=1
var slideheight=1
 
var ns6=document.getElementById&&!document.all?1:0
var opera=navigator.userAgent.match(/Opera/)
var ie5=document.getElementById&&document.all&&!opera?1:0
 
standstill*=1000
var floatingspeed=1
var tempo=20
var numberofimages=slideurl.length-1
var stepx=new Array()
var stepy=new Array()
for (i=0;i<=numberofimages;i++) {
 stepx
=randommakerNS(floatingspeed)
 stepy
=randommakerNS(floatingspeed)
}
var imgwidth=new Array()
var imgheight=new Array()
for (i=0;i<=numberofimages;i++) {
 imgwidth
=10
 imgheight
=10
}
var x,y
var marginbottom
var marginleft=0
var margintop=0
var marginright
var timer
var i_fadestrength=new Array()
var i_fadestep=new Array()
var i_fadenow=new Array()
var i_fadenowmax=new Array()
for (i=0;i<=slideurl.length;i++) {
 i_fadenowmax
=2
 i_fadestrength
=randommakerNS(99) 
 i_fadestep
=1
 i_fadenow
=0
}
 
var spancontent=new Array()
var i_spancontent=0
var imgpreload=new Array()
for (i=0;i<=slideurl.length;i++) {
 imgpreload
=new Image()
 imgpreload
.src=slideurl
}
for (i=0;i<=numberofimages;i++) {
 spancontent
="<a href='"+slidelink+"' target='"+slidetarget+"'><img src='"+slideurl
+"' border='0'></a>"
}
 
var i_angle1=0
var i_size=1
var i_pic=0
var posleft=0
var postop=0
var x_extrusionangle=0
var y_extrusionangle=0
var x_rotationcenter=0
var y_rotationcenter=0
var pagewidth
var pageheight
 
function initNS() {
    marginbottom=window.innerHeight-11
    marginright=window.innerWidth-11          
 var thisspan=document.getElementById('span0')
 thisspan.innerHTML=spancontent[0]
 var thisspan=document.getElementById('span0')
 imgwidth[0]=parseInt(thisspan.offsetWidth)
 imgheight[0]=parseInt(thisspan.offsetHeight)
 var maxleftstart=marginright-imgwidth[0]
 var maxtopstart=marginbottom-imgheight[0]
 var thisspan=document.getElementById('span0').style
    thisspan.left=parseInt(thisspan.left)+randommakerNS(maxleftstart)
 thisspan.top=parseInt(thisspan.top)+randommakerNS(maxtopstart)
 thisspan.visibility="visible"
    checkmovementNS()
}
 
function randommakerNS(range) {  
 rand=Math.floor(range*Math.random())
 if (rand==0) {rand=Math.ceil(range/2)}
    return rand
}
 
function checkmovementNS() {
 checkpositionNS()
 movepicturesNS()
    timer=setTimeout("checkmovementNS()",tempo)
}
 
function movepicturesNS() {
    var thisspan=document.getElementById('span0').style
    thisspan.left=parseInt(thisspan.left)+stepx[0]
 thisspan.top=parseInt(thisspan.top)+stepy[0] 
 i_fadenow[0]++
 if (i_fadenow[0]>=i_fadenowmax[0]) {
  i_fadenow[0]=0
  if (i_fadestrength[0]>=100) {i_fadestep[0]=i_fadestep[0]*-1}
  else if (i_fadestrength[0]<=0) {
   i_fadestep[0]=i_fadestep[0]*-1
   i_spancontent++
   if (i_spancontent>=spancontent.length) {i_spancontent=0}
   document.getElementById('span0').innerHTML=spancontent[i_spancontent]
  }
 } 
 i_fadestrength[0]+=i_fadestep[0]
 document.getElementById('span0').style.MozOpacity=Math.round(i_fadestrength[0])/100
}
 
function checkpositionNS() {
 imgwidth[0]=parseInt(document.getElementById('span0').offsetWidth)
 imgheight[0]=parseInt(document.getElementById('span0').offsetHeight)        
 var thisspan=document.getElementById('span0').style
 var leftx=parseInt(thisspan.left)
 var topy=parseInt(thisspan.top)
 if (leftx>marginright-imgwidth[0]-floatingspeed) {
  thisspan.left=leftx-Math.abs(stepx[0]+1)
  stepx[0]=randommakerNS(floatingspeed)*-1 
 }
 if (leftx<marginleft) {
  thisspan.left=leftx+Math.abs(stepx[0])
  stepx[0]=randommakerNS(floatingspeed)   
 } 
 if (topy>marginbottom-imgheight[0]-floatingspeed) {
  thisspan.top=topy-Math.abs(stepy[0])
  stepy[0]=randommakerNS(floatingspeed)*-1
 }
 if (topy<margintop) {
  thisspan.top=topy+Math.abs(stepy[0])
  stepy[0]=randommakerNS(floatingspeed)
 }
}
 
function initIE() {
 var i_preload=0
 for (i=0;i<=slideurl.length-1;i++) {
  var imgref=eval("document.n"+i)
  if (imgref.complete) {i_preload++}
 }
 if (i_preload>=slideurl.length-1) {
  slidewidth=document.getElementById('spn1').offsetWidth
  slideheight=document.getElementById('spn1').offsetHeight
  pagewidth=document.body.clientWidth
  pageheight=document.body.clientHeight
  document.getElementById('rectid').style.width=slidewidth
  document.getElementById('rectid').style.height=slideheight
  posleft=(pagewidth-slidewidth)/2
  postop=(pageheight-slideheight)/2
  x_rotationcenter=(posleft/slidewidth)/2
  y_rotationcenter=(postop/slideheight)/2
  var rotationcenter=0+","+y_rotationcenter+","+x_rotationcenter
  document.getElementById('rectid').style.left=posleft
  document.getElementById('rectid').style.top=postop
  document.getElementById('extrusionid').rotationcenter=rotationcenter
  rotateIE()
 }
 else {
  var timer=setTimeout("initIE()",200)
 }
}
 
function rotateIE() {
 i_angle1+=1
 if (i_angle1>=360) {
  i_angle1=0
 }
 if (i_angle1==127) {
  i_pic++
  if (i_pic>=slideurl.length) {i_pic=0}
  document.getElementById('fillid').src=slideurl[i_pic]
 }
 document.getElementById('rectid').style.rotation=i_angle1
 document.getElementById('extrusionid').rotationangle=i_angle1+","+i_angle1
 var timer=setTimeout("rotateIE()",30)
}
 
function openpageIE() {
 if (slidetarget[i_pic]=="_blank") {
  window.open(slidelink[i_pic])
 }
 else if (slidetarget[i_pic]=="_self") {
  document.location.href(slidelink[i_pic])
 }
 else if (slidetarget[i_pic]=="_top" || slidetarget[i_pic]=="_parent") {
  top.location.href(slidelink[i_pic])
 }
}
 
if (ns6) {
 document.write("<span id='span0' style='position:absolute;top:0px;left:0px;filter:alpha(opacity=0);-moz-opacity:0'></span>")
    document.close()
 window.onload=initNS
}
if (ie5) {
 document.write('<div id="preloadimages" style="position:absolute;left:0px;top:-5px;visibility:hidden">')
 for (i=0;i<=slideurl.length-1;i++) {
  document.write('<span id="spn'+i+'" style="position:absolute;width:2px;left:0px;top:0px;">')
  document.write('<img src="'+slideurl
+'" name="n'+i+'">')
  document.write('</span>')
 }
 document.write('</div>')
    document.write('<v:'+imageform+' id="rectid"  style="position:absolute;top:0;left:0;width:'+slidewidth+';height:'+slideheight+'" onClick="openpageIE()">')
    document.write('<v:extrusion id="extrusionid" on="true" type="perspective" color="'+fillcolor+'" rotationcenter="0,0,0" backdepth="'+backdepth+'" diffusity="2.5" metal="true">')
  document.write('</v:extrusion>')
document.write('<v:fill id="fillid" opacity="100%" color="'+fillcolor+'" type="frame" src="'+slideurl[0]+'"/>')
   document.write('</v:'+imageform+'>')
 window.onload=initIE
   }
</SCRIPT>
<TABLE WIDTH=1000 BORDER=0 CELLPADDING=0 CELLSPACING=0>
  <TR>
    <TD> <IMG SRC="图片" WIDTH=0 HEIGHT=0></TD>
  </TR>
</TABLE>
<P align=center> </P>
<P align=center> </P><EMBED src=音乐地址 width=0 height=0 type="audio/x-pn-realaudio- plugin" controls="ControlPanel,StatusBar" autostart="true" loop="true">
<P align=center> </P></TD></TR></TBODY></TABLE>

</html>


作者: 画儿    时间: 2009-9-22 21:54

效果如下(点击查看)

  镜面特效:禅语 New




欢迎光临 清净莲海六合敬修学网 祈愿:世界和平 正法久住 (http://bbs.jixiangyun.com/) Powered by Discuz! 6.0.0