Created
August 4, 2012 21:24
-
-
Save dziudek/3260056 to your computer and use it in GitHub Desktop.
Animated circle
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
/** | |
* Animated circle | |
*/ | |
#circle { | |
background: #f5a; | |
border-radius: 50%; | |
box-sizing: border-box; | |
height: 200px; | |
margin: 50px; | |
width: 200px; | |
} | |
#circle > div { | |
box-sizing: border-box; | |
float: left; | |
height: 100px; | |
overflow: hidden; | |
width: 100px; | |
} | |
#circle > div > div { | |
background: #fff; | |
height: 100px; | |
transform: rotate3d(0, 0, 1, 0deg); | |
width: 100px; | |
} | |
#circle > div:nth-child(1) > div { transform-origin: 100% 100%; } | |
#circle > div:nth-child(2) > div { transform-origin: 0% 100%; } | |
#circle > div:nth-child(3) > div { transform-origin: 100% 0%; } | |
#circle > div:nth-child(4) > div { transform-origin: 0% 0%; } | |
#circle:hover > div > div { | |
animation-name: spin; | |
animation-duration: 0.2s; | |
animation-iteration-count: 1; | |
animation-direction: alternate; | |
animation-fill-mode: both; | |
animation-timing-function: linear; | |
} | |
#circle:hover > div:nth-child(1) > div { animation-delay: 0s; } | |
#circle:hover > div:nth-child(2) > div { animation-delay: 0.2s; } | |
#circle:hover > div:nth-child(4) > div { animation-delay: 0.4s; } | |
#circle:hover > div:nth-child(3) > div { animation-delay: 0.6s; } | |
@keyframes spin { | |
from { | |
transform: rotate3d(0, 0, 1, 0deg); | |
} | |
to { | |
transform: rotate3d(0, 0, 1, 90deg); | |
} | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<div id="circle"> | |
<div><div></div></div> | |
<div><div></div></div> | |
<div><div></div></div> | |
<div><div></div></div> | |
</div> |
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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment