Created
January 14, 2016 15:45
-
-
Save uupaa/f8d0f7a24a992023e3a1 to your computer and use it in GitHub Desktop.
回転アニメーション spin animation CSS
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
<!DOCTYPE html><html><head><title></title> | |
<meta name="viewport" content="width=device-width, user-scalable=no"> | |
<meta charset="utf-8"></head><body> | |
<style> | |
@keyframes spin { | |
to { transform: rotate(-10turn); } | |
} | |
#product-logo.spin { | |
animation: spin 500ms cubic-bezier(1, 0, 0, 1) forwards; | |
} | |
</style> | |
<img id="product-logo" src="logo.png" class="spin" /> | |
<script> | |
var logo = document.querySelector("#product-logo"); | |
logo.onclick = function(event) { | |
logo.classList.remove("spin"); | |
setTimeout(function() { logo.classList.add("spin"); }, 0); | |
}; | |
</script> | |
</body></html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment