Created
March 1, 2012 19:55
-
-
Save maikelwever/1952652 to your computer and use it in GitHub Desktop.
rotate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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