Skip to content

Instantly share code, notes, and snippets.

@janjongboom
Created July 3, 2014 06:23
Show Gist options
  • Save janjongboom/6c43a3ffd122abf99176 to your computer and use it in GitHub Desktop.
Save janjongboom/6c43a3ffd122abf99176 to your computer and use it in GitHub Desktop.
Weird animations
div {
border-radius: 50%;
position: absolute;
width: 100px;
height: 100px;
background: linear-gradient(90deg, orange, blue)
}
div.move-out {
animation: 10s weird-move-out infinite;
}
@keyframes weird-move-out {
0% { transform: translateX(0) rotate(0); }
50% { transform: translateX(90vw) scale(0.1) rotate(180deg); }
75% { transform: translateX(10vw) rotate(270deg); }
100% { transform: translateX(100vw) scale(2) rotate(359deg); }
}
<div>
</div>
<button>Click me</button>
document.querySelector('button').onclick = function() {
document.querySelector('div').classList.toggle('move-out');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment