Skip to content

Instantly share code, notes, and snippets.

@dannycroft
Created August 20, 2014 10:07
Show Gist options
  • Save dannycroft/265354fa89b6c8c43389 to your computer and use it in GitHub Desktop.
Save dannycroft/265354fa89b6c8c43389 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<title>Animations</title>
<body>
<script>
function createAndAnimate(part) {
var element = document.createElement('pre');
element.textContent = part;
document.body.appendChild(element);
element.animate(
[
{ 'transform': 'rotate(0deg)' },
{ 'transform': 'rotate(360deg)' },
],
{
'duration': 5000,
'iterations': Infinity,
'delay': Math.random() * 5000,
}
);
}
document.documentElement
.outerHTML
.split('\n')
.forEach(createAndAnimate);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment