Live data from Hacker News

Javascript lullaby

news.ycombinator.com

1–2 of 2 posts

Javascript lullaby

#1
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)

Re: Javascript lullaby

#2
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);})();