Skip to content

Instantly share code, notes, and snippets.

@random-robbie
Created July 27, 2015 15:32
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 random-robbie/fb024799cf01cde8ace4 to your computer and use it in GitHub Desktop.
Save random-robbie/fb024799cf01cde8ace4 to your computer and use it in GitHub Desktop.
(function(){
function rotate(degrees)
{
$('html').css({
'-webkit-transform':'rotate(-' + degrees + 'deg)',
'-moz-transform':'rotate(-' + degrees + 'deg)',
'-ms-transform':'rotate(-' + degrees + 'deg)',
'-o-transform':'rotate(-' + degrees + 'deg)',
'transform':'rotate(-' + degrees + 'deg)',
'-webkit-transition':'2s',
'-moz-transition':'2s',
'-ms-transition':'2s',
'-o-transition':'2s',
'transition':'2s',
'-webkit-transform-origin':'50% 50%',
'-moz-transform-origin':'50% 50%',
'-ms-transform-origin':'50% 50%',
'-o-transform-origin':'50% 50%',
'transform-origin':'50% 50%',
'-webkit-backface-visibility':'hidden'
});
}
var degrees = 180,
interval;
document.onmousemove = function()
{
if(degrees == 0){ rotate(0); degrees = 180; }
clearInterval(interval);
interval = setInterval(function(){
rotate(degrees);
degrees = (degrees === 180) ? 0 : 180;
}, 30 * 60 * 1000); // 30 min
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment