Skip to content

Instantly share code, notes, and snippets.

@samccone
Created June 25, 2012 02:41
Show Gist options
  • Save samccone/2986125 to your computer and use it in GitHub Desktop.
Save samccone/2986125 to your computer and use it in GitHub Desktop.
Ready Set Remix
<html>
<style>
img {
position: absolute;
-webkit-transition: all 10s cubic-bezier(0.175, 0.885, 0.320, 1);
}
body {
background-color: #1D1d1d;
cursor: pointer;
overflow: hidden;
}
</style>
<body>
</body>
<script>
for( var i = 0; i < 90; ++i ) {
tmp = document.createElement('img');
tmp.setAttribute('src', 'http://i.imgur.com/cSNJq.png');
document.body.appendChild(tmp);
}
var images = document.getElementsByTagName('img');
function magical() {
for( var i = 0; i < images.length; ++i ) {
images[i].style.left = Math.floor(Math.random() * (window.innerWidth - 200))+ "px";
images[i].style.top = Math.floor(Math.random() * (window.innerHeight - 200))+ "px";
images[i].style.opacity = Math.random();
images[i].style["-webkit-transform"] = "scale("+Math.random() * 1.4 +")";
}
}
magical();
setInterval(function(){magical()}, 10000);
document.body.addEventListener('click', magical);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment