我正在尝试在CSS
中制作动画,我在网上阅读了一些示例,但无法确定我的代码哪里出现了问题...
我想让我的土豆图像从左到右移动,然后转身,再返回到左侧,但我可能在代码中弄错了什么?有什么建议或应该如何解决这个问题?
这是我的代码:
#pot {
bottom: 15%;
position: absolute;
-webkit-animation: linear infinite alternate;
-webkit-animation-name: run;
-webkit-animation-duration: 5s;
}
@-webkit-keyframes run {
0% {
left: 0;
}
50% {
right: 0;
}
100% {
left: 0;
, webkit-transform: scaleX(-1);
}
}
<div id="pot">
<img src="https://istack.dev59.com/qgNyF.webp?s=328&g=1" width=100px height=100px>
</div>
(抱歉,mos、safari和opera用户)https://jsfiddle.net/oxc12av7/
50%{ left : 100%;}
而不是50%{ right : 0;}
- 这在您的fiddle中对我有效。 - Andrew