<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 5 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 5 年前。
如果我将动画应用于具有 css 样式的元素,并进行转换:翻译 例如
transform: translateY(100px);
在动画结束时,元素跳转到所需位置。如何避免这种跳跃并使动画流畅地到达所需位置?
最佳答案
只需删除最后一个关键帧:
to {
transform: none;
}
div {
width:20px;
height:20px;
background-color:#f00;
animation:bounceInDown 1s;
transform: translateY(100px);
}
@keyframes bounceInDown {
from, 60%, 75%, 90% {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
opacity: 0;
transform: translate3d(0, -3000px, 0);
}
60% {
opacity: 1;
transform: translate3d(0, 25px, 0);
}
75% {
transform: translate3d(0, -10px, 0);
}
90% {
transform: translate3d(0, 5px, 0);
}
}
<div></div>
关于html - 元素具有 css 样式和转换 : translate animation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49668628/