xkrabb
6/19/2017 - 4:49 PM

Animation along a circular path - Solution 2

Animation along a circular path - Solution 2

{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
// alert('Hello world!');
<div class="path">
	<img src="http://lea.verou.me/book/adamcatlace.jpg" class="avatar" />
	<img src="http://lea.verou.me/book/adamcatlace.jpg" class="avatar1" />
</div>
/**
 * 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, .avatar1 {
	animation: spin 30s infinite linear;
}
.avatar1 {
	animation-delay: 3s;
}

/* Anything below this is just styling */

.avatar, .avatar1 {
	display: block;
	width: 50px;
	margin: calc(50% - 25px) auto 0;
	border-radius: 50%;
	overflow: hidden;
}
.avatar1 {
	margin: 0 auto;
	margin-top: -50px;
}

.path {
	width: 300px; height: 300px;
	padding: 20px;
	margin: 100px auto;
	border-radius: 50%;
	background: #fb3;
}