我想要旋转圆圈内的球,这样它就会接触到更大圆圈的每一个角落,并且动画无限连续,就像它是一个标志动画一样.
body {
background-color: #272727;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.line {
position: relative;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #fff;
}
.circle {
width: 82px;
height: 82px;
background-color: #000;
border-radius: 50%;
position: absolute;
left: 4px;
top: 18px;
animation: rotate 5s linear infinite;
transform-origin: 50px 50px;
}
@keyframes rotate {
100% {
transform: rotate(1turn);
}
}
<div class="line">
<div class="circle"></div>
</div>
我实现了代码,但我搞不懂如何通过变换原点属性旋转较小的球,以便它在较大的圆圈内旋转,而不是从较大的圆圈出来.