舞臺燈光
文章導(dǎo)讀:
<html>
<head>
<title>舞臺燈光</title>
<style type="text/css">
<!--
body{
background-color:#000000;
}
td{
filter:light;
}
-->
</style>
</head>
<body>
<table>
<tr>
<td id="flttgt"><img src="mm.jpg"></td>
</tr>
</table>
<script language="javascript">
var g_numlights=0;
flttgt.onclick=keyhandler; //點擊鼠標(biāo)
flttgt.onmousemove=mousehandler; //鼠標(biāo)移動時
function setlights(){
flttgt.filters[0].clear(); //先清空所有光源
flttgt.filters[0].addcone(-10,- 10,5,275,370,0,0,150,60,10); //添加藍(lán)色光源
if (g_numlights>0){
flttgt.filters[0].addcone (285,-10,5,0,370,150,0,0,60,10); //添加紅色光源
if (g_numlights>1)
flttgt.filters[0].addcone (138,380,5,138,0,0,150,0,60,15); //添加綠色光
}
}
function keyhandler(){
g_numlights= (g_numlights+=1)%3;
setlights();
}
function mousehandler(){
x=(window.event.x-80);
y=(window.event.y-80);
flttgt.filters[0].movelight(0,x,y,5,1); //移動藍(lán)光
if (g_numlights>0){
flttgt.filters[0].movelight(1,x,y,5,1); //移動紅光
if (g_numlights>1)
flttgt.filters[0].movelight(2,x,y,5,1); //移動綠光
}
}
setlights();
</script>
</body>