这里是my CodePen在Chrome中正常工作。在Firefox中结合CSS过渡和动画
.animated-box {
width: 100px;
height: 100px;
margin: 10px auto;
background: black;
border-radius: 50px;
transition-duration: 0.2s;
}
.animated-box:hover {
border-radius: 18px;
animation-name: test;
animation-duration: 0.7s;
animation-delay: 0.2s;
}
@keyframes test {
0% {
border-radius: 18px;
}
12% {
border-radius: 15px;
}
41% {
border-radius: 21px;
}
70% {
border-radius: 16px;
}
100% {
border-radius: 18px;
}
}
<div class="animated-box"></div>
但是有一个问题,在Firefox。 如果同时存在CSS过渡和CSS动画属性,则不会播放动画。 如何使它工作?
将“out”动画制作为.animated-box
选择器是错误的解决方案,因为此动画将在页面加载后播放。
这里是a video比较Firefox和Chrome的结果。
那么,你的'过渡delay'没有做任何事情,所以我不知道为什么它的存在? ...如果你想同时做转换和动画,先把所有的代码放在第一位,然后我们才能说出为什么或如何使它工作 – LGSon
它的工作在Firefox上,以及..哪个版本的Firefox不工作? –
'transition-delay'用于在从圆形过渡到方形结束后产生“反弹”效果 – RNR