发信人: marsz()
整理人: microant(1999-08-02 12:13:18), 站内信件
|
实例:图片的光影效果
适用浏览器:IE4+
说明:此效果将产生类似于点光源的照射效果,光亮会在图片上来回扫射,效果 极酷!
第一步:将下列代码复制到网页的Head和Body标记中间。
<style>
<!--#spotlight{filter:light}-->
</style>
第二步:将下列代码放置到网页的末端(</body>的后面)
<script language="JavaScript1.2">
/*
modified by mars 1999, www.joysoft.net
*/
if (document.all&&window.spotlight){
var x=new Array()
var direction=new Array()
var y=new Array()
if (spotlight.length==null){
spotlight[0]=document.all.spotlight
x[0]=0
direction[0]="right"
y[0]=spotlight[0].height
spotlight[0].filters.light.addPoint(100,50,100,255,255,255,90)
}
else
for (i=0;i<spotlight.length;i++){
x[i]=0
direction[i]="right"
y[i]=spotlight[i].height
spotlight[i].filters.light.addPoint(100,50,100,255,255,255,90)
}
}
function slidelight(cur){
spotlight[cur].filters.light.MoveLight(0,x[cur],y[cur],200,-1)
if (x[cur]<spotlight[cur].width+200&&direction[cur]=="right")
x[cur]+=10
else if (x[cur]>spotlight[cur].width+200){
direction[cur]="left"
x[cur]-=10
}
else if (x[cur]>-200&&x[cur]<-185){
direction[cur]="right"
x[cur]+=10
}
else{
x[cur]-=10
direction[cur]="left"
}
}
if (document.all&&window.spotlight){
if (spotlight.length==null)
setInterval("slidelight(0)",spotlight[0].speed)
else
for (t=0;t<spotlight.length;t++){
var temp='setInterval("slidelight('+t+')",'+spotlight[t].speed+')'
eval(temp)
}
}
</script>
第三步:将要产生光影效果的图片代码中加入“id=spotlight speed=50”,如< img src="somepic.gif" id=spotlight speed=50>
-- ________________________________________________
欢迎访问飞翔鸟软体驿站: HTTP://JOYSOFT.SOIM.NET
BEST REGUARDS, MARS MAILTO:[email protected]
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.106.180.9]
|
|