»
EnglishFrenchVietnamese

Print - Background Animator - JavaScriptBank.com

Full version: jsB@nk » Background » Background Animator
URL: https://www.javascriptbank.com/background-animator.html

Background Animator © JavaScriptBank.comThis JavaScripts makes your background alive.

Full version: jsB@nk » Background » Background Animator
URL: https://www.javascriptbank.com/background-animator.html



JavaScript
<SCRIPT LANGUAGE="JavaScript"><!-- Beginning of JavaScript -/*     This script downloaded from www.JavaScriptBank.com     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com*/// Background Animator// Author: Peter Gehrig // Web Site: http://www.24fun.com // The name of your backgroundimage-filevar imgsrc="../image/pic191.jpg"// Do not edit the variables below unless you know what you are doing ...var max_loop=15var pause=1000var imgpreload=new Image()imgpreload.src=imgsrcvar screenwidth=0var screenheight=0var imgwidthvar imgheightvar max_step=100var x_step=0var y_step=0var i_loop=0function initiate() {x_step=0y_step=0i_loop=0    if (document.layers) {        screenwidth=window.innerWidth/2        screenheight=window.innerHeight/2imgwidth=screenwidthimgheight=screenheight        document.bgimage.document.write("<img src="+imgsrc+" width="+screenwidth+">")        document.bgimage.document.close()        document.bgimage.left=0        document.bgimage.top=0           }    if (document.all) {     screenwidth=document.body.clientWidth/2    screenheight=document.body.clientHeight/2imgwidth=screenwidthimgheight=screenheight        bgimage.innerHTML="<img src="+imgsrc+" width="+screenwidth+">"        document.all.bgimage.style.posLeft=0        document.all.bgimage.style.posTop=0  }setnewsize()}function stretchimg() {imgwidth+=x_stepimgheight+=y_stepif (document.all && i_loop<=max_loop) {bgimage.innerHTML="<img src="+imgsrc+" width="+imgwidth+" height="+imgheight+">"i_loop++var timer=setTimeout("stretchimg()",pause)}else if (document.layers && i_loop<=max_loop) {document.bgimage.document.write("<img src="+imgsrc+" width="+imgwidth+" height="+imgheight+">")document.bgimage.document.close()i_loop++var timer=setTimeout("stretchimg()",3*pause)}else {clearTimeout(timer)var timer=setTimeout("shrinkimg()",2000)}}function shrinkimg() {imgwidth-=x_stepimgheight-=y_stepif (document.all && i_loop>=0) {bgimage.innerHTML="<img src="+imgsrc+" width="+imgwidth+" height="+imgheight+">"i_loop--var timer=setTimeout("shrinkimg()",pause)}else if (document.layers && i_loop<=max_loop) {document.bgimage.document.write("<img src="+imgsrc+" width="+imgheight+" height="+imgwidth+">")document.bgimage.document.close()i_loop--var timer=setTimeout("shrinkimg()",3*pause)}else {clearTimeout(timer)var timer=setTimeout("setnewsize()",2000)}}function setnewsize() {imgwidth=screenwidthimgheight=screenheightmax_loop=Math.floor(10*Math.random())x_step=Math.floor(max_step*Math.random())y_step=Math.floor(max_step*Math.random())i_loop=0stretchimg()}window.onresize=initiate// - End of JavaScript - --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="initiate()"> <DIV ID="bgimage" style="position:absolute;top:-8000px; z-index:-1;"></DIV><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/image/pic191.jpg