Two problems. Black border
seems to be egg shaped a little (highly visible if you will change duration of animation
from 60s
to 1s
). Images even with bootstrap's class="img-responsive center-block"
are not changing their width/height. How can i fix that?
JSFiddle mirror: https://jsfiddle.net/9g7oswgk/3/
EDIT #1: Found solution for almost-perfect circle border in my snippet but had to remove text inside of it. All i had to do was to change padding-bottom
value from 100%
to 99%
. As of responsive section, @Ganpat gave ideal solution to it for adding additional wrap class. With 1s
animation might look imperfect, but with 60s it's imperfection is nearly invisible.
EDIT #2: Found solution for responsive images inside this border. Just had to replace hardcoded width: 150px; height: 150px;
with width: 40%;
to their class named img-orbit
. Apparently 50%
makes them too big, but 40% is K.
EDIT #3: Seems like images are centered on -20%
value.
.orbit{
text-align: center;
color: black;
padding-bottom: 99%;
position: relative;
border: 3px solid black;
border-radius: 50%;
-webkit-animation: spin-right 60s linear infinite;
-moz-animation: spin-right 60s linear infinite;
-ms-animation: spin-right 60s linear infinite;
-o-animation: spin-right 60s linear infinite;
animation: spin-right 60s linear infinite; /* change here from 60s to 1s*/
}
/* small circles */
.img-orbit{
width: 40%;
position: absolute;
border: 2px solid black;
border-radius: 50%;
box-shadow: 0 0 34px blue;
-webkit-animation: spin-left 60s linear infinite;
-moz-animation: spin-left 60s linear infinite;
-ms-animation: spin-left 60s linear infinite;
-o-animation: spin-left 60s linear infinite;
animation: spin-left 60s linear infinite;
}
.img-orbit2{
top: 30%;
left: -20%;
}
.img-orbit4{
top: 30%;
right: -20%;
}
.some-class{
width: 50%;
margin: auto;
}
@-webkit-keyframes spin-right {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes spin-right {
100% {
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes spin-left {
100% {
-webkit-transform: rotate(-360deg);
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-o-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
@keyframes spin-left {
100% {
-webkit-transform: rotate(-360deg);
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-o-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<div class="container">
<div class="some-class">
<div class='orbit'>
<img class="img-orbit img-orbit2" src="http://lorempixel.com/200/200/" class=" img-responsive center-block">
<img class="img-orbit img-orbit4" src="http://lorempixel.com/200/200/" class=" img-responsive center-block">
</div>
</div>
</div>