woff 發表於 2009-5-23 16:09:47

溶解文字的特效


<HEAD><script language="javascript">
var message = new Array()
message=" 請修改這裡!"
message=" 請修改這裡"
message=" 請修改這裡 "
message=" 請修改這裡 "
message=" 請修改這裡"
var i_message=0
var covertop=100  // 設置文章離視窗頂端的距離(像素)。
var coverleft=50 // 設置文章離視窗左邊的距離(像素)。

// 本範例slidefader.gif圖檔是以白色背景
// 若你要改變背景顏色請自行製作一幅新圖檔 1200*96 slidefader.gif
// 設置slidefader.gif圖檔的尺寸。如果你要改變尺寸,你也應該製作一幅新圖檔(建議你不必更改)。
var coverwidth=1200
var coverheight=96

var texttop=covertop
var textleft=coverleft

// 設置文字效果的寬度,若你要改變寬度必須與上面在<style>標簽內【width:400px;】寬度屬性相同配合
var textwidth=400
var textheight=coverheight

var cliptop=0
var clipright=textwidth
var clipbottom=coverheight
var clipleft=0

var clippoints

// 設置溶解效果的速度
var step=30
var pause=60

var timer

function init() {
if (document.all) {
document.all.text.style.posTop=texttop
document.all.text.style.posLeft=textleft
document.all.cover.style.posTop=covertop
document.all.cover.style.posLeft=coverleft
clipleft=0
fadeout()
}
}
function fadeout() {
if (document.all.cover.style.posLeft >=(-coverwidth+textwidth+coverleft+step)) { 
clipleft+=step
clipright=clipleft+textwidth
clippoints="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
document.all.cover.style.clip=clippoints
document.all.cover.style.posLeft-=step
timer= setTimeout("fadeout()",pause)
}
else {
clearTimeout(timer)
i_message++
if (i_message>=message.length) {i_message=0}
text.innerHTML=message 
fadein()

}
}
function fadein() {
if (document.all.cover.style.posLeft <=coverleft) { 
clipleft-=step
clipright=clipleft+textwidth
clippoints="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
document.all.cover.style.clip=clippoints
document.all.cover.style.posLeft+=step
timer= setTimeout("fadein()",pause)
}
else {
clearTimeout(timer)
init()
}
}
</script>
<style type="text/css">
.textstyle{
position:absolute;
width:400px;
font-family:Arial;
font-size:12pt;
font-weight:bold;
text-align:center;
color:FFFFFF;
filter:glow(color=666666,strength=2);
}
.coverstyle{
position:absolute;
}
</style></HEAD>

<BODY onLoad="if(document.all&&window.print)init()"><script language="javascript1.2">
if (document.all&&window.print){
document.write('<DIV ID="text" class="textstyle">'+message+'</div>') src="slidefader.gif"></DIV>')
}
</script></BODY>

kirayamatoky 發表於 2013-11-14 00:16:43

說的不錯
頁: [1]
查看完整版本: 溶解文字的特效