body {
display:flex;
justify-content:center;
align-items:center;
}
.bigCircle {
margin-top:100px;
width:400px;
height:400px;
border-radius:50%;
border:1px solid grey;
position:relative;
}
.littleCircle {
width:50%;
height:50%;
border-radius:50%;
border:1px solid grey;
position:absolute;
margin:auto;
left:0;
top:0;
bottom:0;
right:0;
}
.item {
width:102px;
height:52px;
border-radius:5px;
border:1px solid green;
display:flex;
justify-content:center;
align-items:center;
color:red;
box-sizing:border-box;
flex-shrink:0;
position:absolute;
animation:littleLoopRotate 10s linear infinite;
}
.item-box {
width:100%;
height:100%;
animation:loopRotate 10s linear infinite;
}
@keyframes loopRotate {
100% {
transform:rotate(360deg);
}
}@keyframes littleLoopRotate {
100% {
transform:rotate(-360deg);
}
}更新时间:2022-09-26 21:28:08
小盒子保持平行:大圆顺时针旋转,小盒子逆时针自转 旋转一圈的时间相同
各个盒子定位圆环公式:
r=旋转圆的半径 cx=r cy=-r width=自身宽度 height=自身高度 deg=圆心角
x轴(left): cx+r*cos(deg)-width/2
y周(top):cy-r*sin(deg)-height/2