Javascript lullaby
var i = 0; j=15; setInterval(function() { i = i+0.1; if (j>0) j = j-0.05; jQuery("body").css({'-webkit-transform': 'rotate('+j*Math.sin(i)+'deg)'}); }, 100)
1 comments
How about a version that doesn't require jquery, works in Chrome & Safari, and doesn't pollute globally:
(function(){ var i = 0, j=15, body = document.querySelector('body'); setInterval(function(){ i = i+0.1; if (j>0) j = j-0.05;body.style.webkitTransform = 'rotate('+j*Math.sin(i)+'deg)';}, 100);})();
(function(){ var i = 0, j=15, body = document.querySelector('body'); setInterval(function(){ i = i+0.1; if (j>0) j = j-0.05;body.style.webkitTransform = 'rotate('+j*Math.sin(i)+'deg)';}, 100);})();