login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > JS > Overige > aardbeving!!

aardbeving!!

Auteur: mebus - 19 december 2004 - 10:20 - Gekeurd door: Dennisvb - Hits: 5497 - Aantal punten: 2.38 (4 stemmen)





Een aardbeving effect voor je website.

Code:
  1. <SCRIPT LANGUAGE="JavaScript">
  2.  
  3. ////////////////////////VARIABLES
  4. //Verander hier de variables
  5.  
  6. var speed = 1 //Snelheid van aardbeving (Minder is sneller)
  7. var ecount = 100 //Hoe lag de aardbeving standhoud
  8. var violence = 50 //Hoe gewelddadig de aardbeving is
  9. var T = 0; //counter variable
  10. var num_x; //X movement
  11. var num_y; //Y movement
  12. var positivity_x; //positivity of X movement
  13. var positivity_y; //positivity of Y movement
  14.  
  15. /////////////////////////RANDOM NUMBERS FUNCTION USED FOR MOVEMENT
  16.  
  17. function randomnums() //creates two random numbers, num_x & num_y
  18. {
  19.  
  20. positivity_x = Math.round(Math.random()); //positive or negative num_x
  21. positivity_y = Math.round(Math.random()); //positive or negative num_y
  22. num_x = Math.round(violence * Math.random()); //X movement
  23. num_y = Math.round(violence * Math.random()); //Y movement
  24.  
  25. if (positivity_x == 1){ //positive or negative X
  26. }
  27. else
  28. {
  29. num_x = -num_x;
  30. }
  31.  
  32. if (positivity_y == 1){ //positive or negative Y
  33. }
  34. else
  35. {
  36. num_y = -num_y;
  37. }
  38.  
  39. }
  40.  
  41. ////////////////////////////////////MAIN FUNCTION
  42.  
  43. function equake() {
  44. if (T >= ecount) {stop = true}
  45. else {
  46.  
  47. setTimeout("window.moveBy(-num_x,-num_y)", speed);
  48.  
  49. randomnums(); //MAKE FRESH RANDOM NUMS USING FUNCTION
  50.  
  51.  
  52. //choose one:
  53. //window.resizeBy(num_x,num_y)//resize BROWSER BY (X,Y)
  54. setTimeout("window.moveBy(num_x,num_y)", -speed);//MOVE BROWSER BY (X,Y)
  55. //self.scroll(num_x,num_y); //SCROLL (X,Y)
  56.  
  57.  
  58.  
  59. T = eval(T + 1); //add one to timer
  60. setTimeout("equake()", speed); //speed OF EARTHQUAKE
  61.  
  62. }
  63. }
  64. //////////////////////////////////
  65.  
  66. </SCRIPT>
  67.  
  68. <!-- Dit is de boodschap die de bezoeker krijgt, in de body tags -->
  69.  
  70.  
  71. <SCRIPT LANGUAGE="javascript">
  72. if (confirm ("Onder de tafels!")){
  73. equake();
  74. window.status="Onder de tafels!"
  75. }
  76. else {window.status="Met annuleren werkt hij niet!"}
  77. </script>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (1)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.024s