gpt4 book ai didi

CSS 动画 - 使对象水平旋转 100%

转载 作者:行者123 更新时间:2023-11-28 12:08:30 25 4
gpt4 key购买 nike

我创建了一个 CSS 动画(飞猫),但是当我将位置设置为 %99 并将旋转(transform: scaleX(-1))设置为 100% 时,猫开始以 0% 旋转并且以 100% 结束,我想在 99% 和 100% 之间旋转猫。

@keyframes move-ass {
0% {left: -250px}
50% {left: 250px;}
100% {left: -250px; transform: scaleX(-1)}
}

这是 fiddle .

最佳答案

根据您的解释,这就是您想要制作动画的内容。

旋转动画应为 50%。

body {
text-align: center;
}
.cat {
position: absolute;
top: 150px;
left: -250px;
background-image: url(https://s-media-cache-ak0.pinimg.com/originals/ee/dd/e5/eedde5a7ab6c65899c25028ee9224e13.gif);
background-size: cover;
width: 100px;
height: 200px;
animation: move-ass 10s infinite;
}
@keyframes move-ass {
0% {left: -250px; transform: scaleX(1)}
40% {left: 240px; transform: scaleX(1)}
50% {left: 250px; transform: scaleX(-1)}
100% {left: -250px; transform: scaleX(-1)}
}
<div class="cat"></div>

Updated Fiddle

关于CSS 动画 - 使对象水平旋转 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36416727/

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