Created
July 3, 2014 06:23
-
-
Save janjongboom/6c43a3ffd122abf99176 to your computer and use it in GitHub Desktop.
Weird animations
This file contains hidden or 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
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); } | |
} |
This file contains hidden or 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
<div> | |
</div> | |
<button>Click me</button> |
This file contains hidden or 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
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