html { background: #4F4F4F; }
.path {
content: "";
width: 20px;
height: 20px;
position: absolute;
background: rgba(149, 147, 241, 0.5);
border-radius: 40px;
top: 28px;
left: 78px;
}
.hand-icon {
position: relative;
background-image: url('https://i.postimg.cc/8556gm60/hand.png');
background-repeat: no-repeat;
background-position: center;
width: 100px;
height: 100px;
animation: spin 2s infinite;
transform-origin: 52% 62%;
}
@keyframes spin {
0% { transform: rotate(30deg); margin-left: 20px; }
50% { transform: rotate(-15deg); margin-left: -20px; }
100% { transform: rotate(0deg); margin-left: 20px; }
}
<div class="swipe">
<div class="path"></div>
<div class="hand-icon"></div>
</div>
我有一个很好的CSS背景,但我是相当新的CSS@关键帧,即使我不能实现上面的截图。要求是使它无限动画,并显示您可以拖动屏幕从右到左。我所实现的,你可以看到在所附的代码。
我怎样才能结合两个动画,使紫色的路径动画以及手滑动?还有为什么第一步没有动画?这就像跳到30度,然后它去顺利。试图重新与100% { transform: rotate(0deg); margin-left: 20px; }
,但id不工作。有人能指出我在正确的方向?
大多数情况下,我希望使用此example的第一个动画
2条答案
按热度按时间hivapdat1#
此解决方案完全符合您的需求:
而且是的您需要一点JS,因为我们在启动两个动画之前要等待图像到达浏览器
问候
cbjzeqam2#
你可以让蓝色的点也有一个动画,扩大宽度,但保持右手边在同一个地方。
这个代码段假设您不想更改HTML(例如,将两者放在一个容器中),因此它不使用right:0固定右侧。