Skip to content

Instantly share code, notes, and snippets.

@triptych
Created October 18, 2010 20:36
Show Gist options
  • Save triptych/633006 to your computer and use it in GitHub Desktop.
Save triptych/633006 to your computer and use it in GitHub Desktop.
shake a window
<HTML>
<HEAD>
<TITLE>Javascript: Shake</TITLE>
</HEAD>
<body>
<script language="JavaScript" type="text/javascript">
function init() {
setTimeout("shake(3)",1000);
setTimeout("this.focus()",4000);
setTimeout("shake(3)",4100);
}
function register()
{
var isAol = "no";
var res = 800 ;
}
function shake(n) {
if (self.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
}
}
}
}
a=275;
b=275;
r=20;
x=1;
z=1;
function rotate(r) {
while (z<=3) {
for (var i = 0; i <360; i++) {
x = (r * Math.cos((i * Math.PI)/180)) + a;
y = (r * Math.sin((i * Math.PI)/180)) + b;
window.moveTo(x,y);
}
z+= 1;
}
setTimeout("shake(3)",10000);
}
</script>
</head>
<body ONLOAD="init()">
<p>To make the browser window shake, put the SCRIPT in the HEAD and put the ONLOAD attibute in the BODY tag</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment