Skip to content

Instantly share code, notes, and snippets.

@maikelwever
Created March 1, 2012 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maikelwever/1952652 to your computer and use it in GitHub Desktop.
Save maikelwever/1952652 to your computer and use it in GitHub Desktop.
rotate
// get the element we want to rotate
var target = document.getElementsByTagName("html")[0], timer;
// function that makes the site rotate
function rotate(degree) {
// clear any existing timers
clearTimeout(timer);
// set style for webkit browsers
target.style['-webkit-transform'] = 'rotate(' + degree + 'deg)';
// set style for mozilla browsers
target.style['-moz-transform'] = 'rotate(' + degree + 'deg)';
// if we are at 360 degrees, go to 0 degrees and exit
// after 5ms, rotate the site another 10 degrees.
timer = setTimeout(function() {
rotate(degree+10);
console.log('1');
},30);
}
// use this to start rotating
rotate(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment