Last active
October 10, 2021 15:26
-
-
Save csssecrets/87d80a51a5294ec07aea to your computer and use it in GitHub Desktop.
Animation along a circular path - Solution 1
This file contains 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
/** | |
* Animation along a circular path - Solution 1 | |
*/ | |
@keyframes spin { | |
to { transform: rotate(1turn); } | |
} | |
.avatar { | |
animation: spin 3s infinite linear; | |
transform-origin: 50% 150px; | |
} | |
.avatar > img { | |
animation: inherit; | |
animation-direction: reverse; | |
} | |
/* Anything below this is just styling */ | |
.avatar { | |
width: 50px; | |
margin: 0 auto; | |
border-radius: 50%; | |
overflow: hidden; | |
} | |
.avatar > img { | |
display: block; | |
width: inherit; | |
} | |
.path { | |
width: 300px; height: 300px; | |
padding: 20px; | |
border-radius: 50%; | |
background: #fb3; | |
} |
This file contains 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 class="path"> | |
<div class="avatar"> | |
<img src="http://lea.verou.me/book/adamcatlace.jpg" /> | |
</div> | |
</div> |
This file contains 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
// alert('Hello world!'); |
This file contains 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-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment