»
Tiếng AnhTiếng PhápTiếng Việt

In - Đèn disco - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Màu nền » Đèn disco
URL: https://www.javascriptbank.com/disco-background-effect.html

Đèn disco © JavaScriptBank.comHiệu ứng tạo ra những vùng sáng có thể chớp tắt liên tục mang các màu khác nhau trên một nền tối.

Phiên bản đầy đủ: jsB@nk » Màu nền » Đèn disco
URL: https://www.javascriptbank.com/disco-background-effect.html



JavaScript
<script language="javascript"><!--z=100flash=0.75 // permanent flash.time light is off before next light is lit. higher flashrate leaves light on longertimez=""thisnum=0function checknum(){ //prevent showing the same colour light in sequence. ie red after redlastnum=thisnumcount=Math.round(Math.random()*5)if(count==lastnum){checknum()}else{thisnum=countpreview()}}function preview(){clearTimeout(timez)red=100+Math.round(Math.random()*155)green=100+Math.round(Math.random()*155)blue=100+Math.round(Math.random()*155)speed=50+Math.round(Math.random()*400) //100=minspeed, 100+400=maxspeed//flash=0.1+Math.random()*0.9 // for random flash rate each run. higher flashrate leaves light on longerflashrate=speed*flash // time light is off before next light is lit.//count=Math.round(Math.random()*5) // transfered to function checknumif(count==0){document.all.test.filters.Light(1).addcone(50,70,z,50,70,0,green,0,100,90);dim=setTimeout("clearme()",flashrate)}if(count==1){document.all.test.filters.Light(1).addcone(150,70,z,150,70,green,green,0,100,90); //yellowdim=setTimeout("clearme()",flashrate)}if(count==2){document.all.test.filters.Light(1).addcone(250,70,z,250,70,red,0,0,100,90);dim=setTimeout("clearme()",flashrate)}if(count==3){document.all.test.filters.Light(1).addcone(350,70,z,350,70,0,0,blue,100,90);dim=setTimeout("clearme()",flashrate)}if(count==4){document.all.test.filters.Light(1).addcone(450,70,z,450,70,red,0,blue,100,90);dim=setTimeout("clearme()",flashrate)}if(count==5){document.all.test.filters.Light(1).addcone(550,70,z,550,70,red,green,blue,100,90);dim=setTimeout("clearme()",flashrate)}timez=setTimeout("checknum()",speed)}function clearme(){test.filters.Light(1).clear();document.all.test.filters.Light(0).Addambient(50,50,50,50) // colour and intensity of background lightreturn}setTimeout("checknum()",1000)// --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<div id="test" style="position:relative;filter:Light(1);width:600;height:140;background-color:white; border:10 ridge black;text-align:center;font-size:100"></div><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->