Skip to content

Instantly share code, notes, and snippets.

@csssecrets
Last active October 10, 2021 14:56
Show Gist options
  • Save csssecrets/6c647a5599dc11145f2c to your computer and use it in GitHub Desktop.
Save csssecrets/6c647a5599dc11145f2c to your computer and use it in GitHub Desktop.
Animation along a circular path - Solution 2
/**
* Animation along a circular path - Solution 2
*/
@keyframes spin {
from {
transform: rotate(0turn)
translateY(-150px) translateY(50%)
rotate(1turn)
}
to {
transform: rotate(1turn)
translateY(-150px) translateY(50%)
rotate(0turn);
}
}
.avatar {
animation: spin 3s infinite linear;
}
/* Anything below this is just styling */
.avatar {
display: block;
width: 50px;
margin: calc(50% - 25px) auto 0;
border-radius: 50%;
overflow: hidden;
}
.path {
width: 300px; height: 300px;
padding: 20px;
margin: 100px auto;
border-radius: 50%;
background: #fb3;
}
<div class="path">
<img src="http://lea.verou.me/book/adamcatlace.jpg" class="avatar" />
</div>
// alert('Hello world!');
{"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