Full version: jsB@nk » Browser » Window » Earthquake
URL: https://www.javascriptbank.com/earth-quake.html
This is a different script to create the shaking window effect.
Full version: jsB@nk » Browser » Window » Earthquake
URL: https://www.javascriptbank.com/earth-quake.html
<SCRIPT language=JavaScript>// [email protected]//change variables herevar speed = 5 //SPEED of earthquake.(less is more) var ecount = 100 //HOW LONG the earthquake lasts. var violence = 20 //HOW VIOLENT the earthquake isvar T = 0; //counter variablevar num_x; //X movementvar num_y; //Y movementvar positivity_x; //positivity of X movementvar positivity_y; //positivity of Y movement//RANDOM NUMBERS FUNCTION USED FOR MOVEMENTfunction randomnums() //creates two random numbers, num_x & num_y{positivity_x = Math.round(Math.random()); //positive or negative num_xpositivity_y = Math.round(Math.random()); //positive or negative num_ynum_x = Math.round(violence * Math.random()); //X movementnum_y = Math.round(violence * Math.random()); //Y movementif (positivity_x == 1){ //positive or negative X}else {num_x = -num_x;}if (positivity_y == 1){ //positive or negative Y}else {num_y = -num_y;}}//MAIN FUNCTIONfunction equake() {if (T >= ecount) {stop = true} else {setTimeout("window.moveBy(-num_x,-num_y)", speed);randomnums(); //MAKE FRESH RANDOM NUMS USING FUNCTION//choose one://window.resizeBy(num_x,num_y)//resize BROWSER BY (X,Y)setTimeout("window.moveBy(num_x,num_y)", -speed);//MOVE BROWSER BY (X,Y)//self.scroll(num_x,num_y); //SCROLL (X,Y)T = eval(T + 1); //add one to timer setTimeout("equake()", speed); //speed OF EARTHQUAKE}}</SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<SCRIPT language=javascript> if (confirm ("Earthquake!!!")){equake();window.status="EARTHQUAKE!!!!"}else {window.status="no earthquake :("}</SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->