我试图让三个物体绕一个圆圈旋转。到目前为止,我已经能够让一个物体绕着圆圈旋转。如果不弄乱代码,我无法获得多个。谁能建议实现这一目标的最佳方法?这是代码的一部分和小提琴。谢谢!
这是 演示
.outCircle {
width: 200px;
height: 200px;
background-color: lightblue;
left: 270px;
position: absolute;
top: 50px;
-moz-border-radius: 100px;
-webkit-border-radius: 100px;
border-radius: 100px;
}
.rotate {
width: 100%;
height: 100%;
-webkit-animation: circle 10s infinite linear;
}
.counterrotate {
width: 50px;
height: 50px;
-webkit-animation: ccircle 10s infinite linear;
}
.inner {
width: 100px;
height: 100px;
background: red;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 100px;
position: absolute;
left: 0px;
top: 0px;
background-color: red;
display: block;
}
@-webkit-keyframes circle {
from {
-webkit-transform: rotateZ(0deg)
}
to {
-webkit-transform: rotateZ(360deg)
}
}
@-webkit-keyframes ccircle {
from {
-webkit-transform: rotateZ(360deg)
}
to {
-webkit-transform: rotateZ(0deg)
}
}
<div class="outCircle">
<div class="rotate">
<div class="counterrotate">
<div class="inner">hello
</div>
</div>
</div>
</div>
原文由 AndrewLeonardi 发布,翻译遵循 CC BY-SA 4.0 许可协议
适用于任意数量的外部项目的 Jquery 解决方案。
Jquery 无耻地从 ThiefMaster 偷走了 ♦ 以及他们在这个 问答 中的回答