Last active
December 19, 2015 21:48
-
-
Save CezaryDanielNowak/6022290 to your computer and use it in GitHub Desktop.
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
(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