Skip to content

Instantly share code, notes, and snippets.

@CezaryDanielNowak
Last active December 19, 2015 21:48
Show Gist options
  • Save CezaryDanielNowak/6022290 to your computer and use it in GitHub Desktop.
Save CezaryDanielNowak/6022290 to your computer and use it in GitHub Desktop.
(function() {
var makeWebsiteCreazy = function() {
var toanim = document.querySelectorAll('h1,h2,h3,h4,h5,img,input'); //,div:last-child
window.onscroll = function() {
[].forEach.call(toanim, function(el) {
var pickOne = parseInt( Math.random() * 6 ) + 1;
el.style.transition = 'all 2000ms ease-in-out';
el.style.transform = "scale(" + (pickOne==1 ? Math.random()*1.5 : 1) + ') rotate('+( pickOne==2 ? Math.random()*90 : 0 )+'deg) translateX('+( pickOne==3 ? Math.random()*20 : 0 )+'px) translateY('+( pickOne==4 ? Math.random()*20 : 0 )+'px) skewX('+( pickOne==5 ? Math.random()*90 : 0 )+'deg) skewY('+( pickOne==6 ? Math.random()*90 : 0 )+'deg)';
});
};
console.log(":-)");
};
makeWebsiteCreazy();
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment