gpt4 book ai didi

html - 为一条线设置动画并使其成为 au turn css3

转载 作者:行者123 更新时间:2023-11-28 01:05:59 25 4
gpt4 key购买 nike

我有一条线。我正在从左向右移动它。这很好。但是现在我想掉头或像蛇一样转动它。我该怎么做?

.top {
position: absolute;
width: 100px;
height: 5px;
left: 0;
background-color: red;
animation: move 5s;
}

@-webkit-keyframes move {
from {}
to {
left: 50px;
}
}
<div class="top"></div>

最佳答案

不确定这是否是您想要的,但希望对您有所帮助。

.top {
position: absolute;
width: 100px;
height: 5px;
left: 0;
top: 0;
background-color: red;
animation: move 5s 1s forwards;
}

@-webkit-keyframes move {
0% {
left: 0px;
top: 0px;
}
25% {
left: 50px;
}
50% {
top: 20px;
transform: rotate(180deg);
}
100% {
left: 0;
top: 20px;
transform: rotate(180deg);
}
}
<div class="top"></div>

关于html - 为一条线设置动画并使其成为 au turn css3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52357755/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com